[ 
https://issues.apache.org/jira/browse/COLLECTIONS-861?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniele updated COLLECTIONS-861:
--------------------------------
    Description: 
*CollectionUtils.select(Iterable, Predicate, Collection, Collection):*

A ConcurrentModificationException can be thrown, but not signed in the 
specification, also "return the outputCollection" is ambiguous because 
outputCollection is a parameter and it seems like the method should return that 
parameter as it is, but in is modified inside the method.

*Test used:*
{code:java}
public class CollectionUtils_12_failure_Test extends 
CollectionUtils_12_failure_Test_scaffolding {    
public void testSelect_OutputCollection() throws Throwable {
        PriorityQueue<Object> priorityQueue0 = new 
PriorityQueue<Object>(comparator0);
        UniquePredicate<Object> uniquePredicate0 = new 
UniquePredicate<Object>();
        try {
            _methodResult__ = CollectionUtils.select((Iterable<?>) 
priorityQueue0, 
                (Predicate<? super Object>) uniquePredicate0, 
(Collection<Object>) priorityQueue0, 
                (Collection<Object>) priorityQueue0);
            
org.junit.Assert.assertTrue(_methodResult__.equals(((Collection<Object>) 
priorityQueue0)));
            //** Postcondition on which the oracle of method select depends: 
methodResultID.equals(args[2])
        } catch (ConcurrentModificationException e) {
            verifyException("java.util.PriorityQueue$Itr", e);
            org.junit.Assert.fail();
        }
    }
}{code}
*CollectionUtils.selectRejected(Iterable, Predicate, Collection):*

A RuntimeException can be thrown, but not signed in the specification, also 
"return  outputCollection" is ambiguous because outputCollection is a parameter 
and it seems like the method should return that parameter as it is, but in is 
modified inside the method.

*Test used (generated by EvoSuite):*
{code:java}
public class CollectionUtils_14_failure_Test{    
public void testSelectRejected_OutputCollection() throws Throwable {
        Predicate<Object> predicate0 = ExceptionPredicate.exceptionPredicate();
        NullIsExceptionPredicate<Object> nullIsExceptionPredicate0 = new 
NullIsExceptionPredicate<Object>(predicate0);
        LinkedList<Object> linkedList0 = new LinkedList<Object>();
        Vector<Comparable<Object>> vector0 = new 
Vector<Comparable<Object>>(6935, 6935);
        try{
            _methodResult__ = CollectionUtils.selectRejected((Iterable<? 
extends Comparable<Object>>) vector0, 
                (Predicate<? super Comparable<Object>>) 
nullIsExceptionPredicate0, (Collection<Object>) linkedList0);
            //** Postcondition on which the oracle of method selectRejected 
depends: methodResultID.equals(args[2])
            
org.junit.Assert.assertTrue(_methodResult__.equals(((Collection<Object>) 
linkedList0)));
        } catch (RuntimeException e) {
            
verifyException("org.apache.commons.collections4.functors.ExceptionPredicate", 
e);
            org.junit.Assert.fail();
        }
    }
}{code}
 

  was:
*CollectionUtils.select(Iterable, Predicate, Collection, Collection):*

A ConcurrentModificationException can be thrown, but not signed in the 
specification, also "return the outputCollection" is ambiguous because 
outputCollection is a parameter and it seems like the method should return that 
parameter as it is, but in is modified inside the method.

*Test used:*
{code:java}
public class CollectionUtils_12_failure_Test extends 
CollectionUtils_12_failure_Test_scaffolding {    
public void testSelect_OutputCollection() throws Throwable {
        PriorityQueue<Object> priorityQueue0 = new 
PriorityQueue<Object>(comparator0);
        UniquePredicate<Object> uniquePredicate0 = new 
UniquePredicate<Object>();
        try {
            _methodResult__ = CollectionUtils.select((Iterable<?>) 
priorityQueue0, 
                (Predicate<? super Object>) uniquePredicate0, 
(Collection<Object>) priorityQueue0, 
                (Collection<Object>) priorityQueue0);
            
org.junit.Assert.assertTrue(_methodResult__.equals(((Collection<Object>) 
priorityQueue0)));
            //** Postcondition on which the oracle of method select depends: 
methodResultID.equals(args[2])
        } catch (ConcurrentModificationException e) {
            verifyException("java.util.PriorityQueue$Itr", e);
            org.junit.Assert.fail();
        }
    }
}{code}
*CollectionUtils.selectRejected(Iterable, Predicate, Collection):*

A RuntimeException can be thrown, but not signed in the specification, also 
"return  outputCollection" is ambiguous because outputCollection is a parameter 
and it seems like the method should return that parameter as it is, but in is 
modified inside the method.

*Test used (generated by EvoSuite):*
{code:java}
public class CollectionUtils_14_failure_Test{    
public void testSelectRejected_OutputCollection() throws Throwable {
        Predicate<Object> predicate0 = ExceptionPredicate.exceptionPredicate();
        NullIsExceptionPredicate<Object> nullIsExceptionPredicate0 = new 
NullIsExceptionPredicate<Object>(predicate0);
        LinkedList<Object> linkedList0 = new LinkedList<Object>();
        Vector<Comparable<Object>> vector0 = new 
Vector<Comparable<Object>>(6935, 6935);
        try{
            _methodResult__ = CollectionUtils.selectRejected((Iterable<? 
extends Comparable<Object>>) vector0, 
            (Predicate<? super Comparable<Object>>) nullIsExceptionPredicate0, 
(Collection<Object>) linkedList0);
            //** Postcondition on which the oracle of method selectRejected 
depends: methodResultID.equals(args[2])
            
org.junit.Assert.assertTrue(_methodResult__.equals(((Collection<Object>) 
linkedList0)));
        } catch (RuntimeException e) {
            
verifyException("org.apache.commons.collections4.functors.ExceptionPredicate", 
e);
            org.junit.Assert.fail();
        }
    }
} {code}
 


> Documentation Bug: CollectionUtils.select(Iterable, Predicate, Collection, 
> Collection), CollectionUtils.selectRejected(Iterable, Predicate, Collection)
> -------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: COLLECTIONS-861
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-861
>             Project: Commons Collections
>          Issue Type: Bug
>            Reporter: Daniele
>            Priority: Minor
>
> *CollectionUtils.select(Iterable, Predicate, Collection, Collection):*
> A ConcurrentModificationException can be thrown, but not signed in the 
> specification, also "return the outputCollection" is ambiguous because 
> outputCollection is a parameter and it seems like the method should return 
> that parameter as it is, but in is modified inside the method.
> *Test used:*
> {code:java}
> public class CollectionUtils_12_failure_Test extends 
> CollectionUtils_12_failure_Test_scaffolding {    
> public void testSelect_OutputCollection() throws Throwable {
>         PriorityQueue<Object> priorityQueue0 = new 
> PriorityQueue<Object>(comparator0);
>         UniquePredicate<Object> uniquePredicate0 = new 
> UniquePredicate<Object>();
>         try {
>             _methodResult__ = CollectionUtils.select((Iterable<?>) 
> priorityQueue0, 
>                 (Predicate<? super Object>) uniquePredicate0, 
> (Collection<Object>) priorityQueue0, 
>                 (Collection<Object>) priorityQueue0);
>             
> org.junit.Assert.assertTrue(_methodResult__.equals(((Collection<Object>) 
> priorityQueue0)));
>             //** Postcondition on which the oracle of method select depends: 
> methodResultID.equals(args[2])
>         } catch (ConcurrentModificationException e) {
>             verifyException("java.util.PriorityQueue$Itr", e);
>             org.junit.Assert.fail();
>         }
>     }
> }{code}
> *CollectionUtils.selectRejected(Iterable, Predicate, Collection):*
> A RuntimeException can be thrown, but not signed in the specification, also 
> "return  outputCollection" is ambiguous because outputCollection is a 
> parameter and it seems like the method should return that parameter as it is, 
> but in is modified inside the method.
> *Test used (generated by EvoSuite):*
> {code:java}
> public class CollectionUtils_14_failure_Test{    
> public void testSelectRejected_OutputCollection() throws Throwable {
>         Predicate<Object> predicate0 = 
> ExceptionPredicate.exceptionPredicate();
>         NullIsExceptionPredicate<Object> nullIsExceptionPredicate0 = new 
> NullIsExceptionPredicate<Object>(predicate0);
>         LinkedList<Object> linkedList0 = new LinkedList<Object>();
>         Vector<Comparable<Object>> vector0 = new 
> Vector<Comparable<Object>>(6935, 6935);
>         try{
>             _methodResult__ = CollectionUtils.selectRejected((Iterable<? 
> extends Comparable<Object>>) vector0, 
>                 (Predicate<? super Comparable<Object>>) 
> nullIsExceptionPredicate0, (Collection<Object>) linkedList0);
>             //** Postcondition on which the oracle of method selectRejected 
> depends: methodResultID.equals(args[2])
>             
> org.junit.Assert.assertTrue(_methodResult__.equals(((Collection<Object>) 
> linkedList0)));
>         } catch (RuntimeException e) {
>             
> verifyException("org.apache.commons.collections4.functors.ExceptionPredicate",
>  e);
>             org.junit.Assert.fail();
>         }
>     }
> }{code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to