[ https://issues.apache.org/jira/browse/COLLECTIONS-860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniele updated COLLECTIONS-860: -------------------------------- Description: *CollectionBag.add(E):* Using "null" as parameter the method throws a "NullPointerException", but not signed into the specification. *CollectionBag.add(E, int):* A "ClassCastException" can be generated, but not signed into the specification. SetUp: |/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Sun May 05 21:30:38 GMT 2024 */ package org.apache.commons.collections4.bag; import shaded.org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.junit.AfterClass; import static shaded.org.evosuite.shaded.org.mockito.Mockito.*; @EvoSuiteClassExclude public class CollectionBag_3_Test_scaffolding { @org.junit.Rule public shaded.org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new shaded.org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); private shaded.org.evosuite.runtime.thread.ThreadStopper threadStopper = new shaded.org.evosuite.runtime.thread.ThreadStopper (shaded.org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { shaded.org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.collections4.bag.CollectionBag"; shaded.org.evosuite.runtime.GuiSupport.initialize(); shaded.org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; shaded.org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; shaded.org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; shaded.org.evosuite.runtime.Runtime.getInstance().resetRuntime(); try \\{ initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {} } @AfterClass public static void clearEvoSuiteFramework() { java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); } @Before public void initTestCase() { threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); shaded.org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); setSystemProperties(); shaded.org.evosuite.runtime.GuiSupport.setHeadless(); shaded.org.evosuite.runtime.Runtime.getInstance().resetRuntime(); shaded.org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase() { threadStopper.killAndJoinClientThreads(); shaded.org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); shaded.org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); shaded.org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public static void setSystemProperties() { java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); } private static void initializeClasses() { shaded.org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(CollectionBag_3_Test_scaffolding.class.getClassLoader() , "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$ConditionDistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$DistanceAlgo", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$2", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$1", "org.apache.commons.collections4.functors.ExceptionPredicate", "org.apache.commons.collections4.functors.ComparatorPredicate$1", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$4", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$ConditionDistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$5", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$3", "org.apache.commons.collections4.bag.SynchronizedBag", "org.apache.commons.collections4.functors.ClosureTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$4", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$2", "org.apache.commons.collections4.functors.EqualPredicate", "org.apache.commons.collections4.functors.NullPredicate", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$1", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$3", "org.apache.commons.collections4.functors.OnePredicate", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$DistanceCalculator", "org.apache.commons.collections4.functors.WhileClosure", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3", "org.apache.commons.collections4.functors.TransformerPredicate", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4", "org.apache.commons.collections4.bag.PredicatedBag", "org.apache.commons.collections4.functors.PrototypeFactory$PrototypeSerializationFactory", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$2", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$3", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$4", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$5", "org.apache.commons.collections4.functors.PredicateDecorator", "org.apache.commons.collections4.functors.AnyPredicate", "org.apache.commons.collections4.map.MultiValueMap$ReflectionFactory", "org.apache.commons.collections4.functors.CloneTransformer", "org.apache.commons.collections4.Transformer", "org.apache.commons.collections4.multimap.AbstractMultiValuedMap$KeysMultiSet$MapEntryTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$NegConditionDistanceCalculator", "org.apache.commons.collections4.iterators.UnmodifiableIterator", "org.apache.commons.collections4.bag.UnmodifiableBag", "org.apache.commons.collections4.functors.NOPClosure", "org.apache.commons.collections4.functors.PredicateTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$1", "org.apache.commons.collections4.functors.IfTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$4", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$DistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$ConditionDistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$ConditionDistanceCalculator", "org.apache.commons.collections4.functors.NonePredicate", "org.apache.commons.collections4.functors.ComparatorPredicate$Criterion", "org.apache.commons.collections4.functors.SwitchTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$3", "org.apache.commons.collections4.functors.NOPTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$DistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$2", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$1", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$ExceptionDistanceCalculator", "org.apache.commons.collections4.functors.TruePredicate", "org.apache.commons.collections4.Closure", "org.apache.commons.collections4.functors.NotNullPredicate", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$ConditionDistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$DistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$ExceptionDistanceCalculator", "org.apache.commons.collections4.functors.DefaultEquator", "org.apache.commons.collections4.bag.UnmodifiableSortedBag", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$DistanceAlgo", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$ConditionDistanceCalculator", "org.apache.commons.collections4.FunctorException", "org.apache.commons.collections4.Factory", "org.apache.commons.collections4.functors.NotPredicate", "org.apache.commons.collections4.functors.ChainedTransformer", "org.apache.commons.collections4.functors.PrototypeFactory", "org.apache.commons.collections4.functors.AndPredicate", "org.apache.commons.collections4.functors.ChainedClosure", "org.apache.commons.collections4.collection.PredicatedCollection", "org.apache.commons.collections4.functors.SwitchClosure", "org.apache.commons.collections4.set.AbstractSetDecorator", "org.apache.commons.collections4.functors.TransformedPredicate", "org.apache.commons.collections4.functors.AllPredicate", "org.apache.commons.collections4.functors.ConstantFactory", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$DistanceAlgo", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$4", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$3", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$NegExceptionDistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$NegExceptionDistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$1", "org.apache.commons.collections4.functors.PrototypeFactory$1", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$3", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$2", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$4", "org.apache.commons.collections4.functors.NullIsExceptionPredicate", "org.apache.commons.collections4.bag.PredicatedSortedBag", "org.apache.commons.collections4.functors.MapTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$DistanceAlgo", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$ExceptionDistanceCalculator", "org.apache.commons.collections4.functors.NullIsFalsePredicate", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$2", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$1", "org.apache.commons.collections4.functors.InstanceofPredicate", "org.apache.commons.collections4.Equator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$DistanceAlgo", "org.apache.commons.collections4.functors.IdentityPredicate", "org.apache.commons.collections4.functors.TransformerClosure", "org.apache.commons.collections4.bag.TransformedBag", "org.apache.commons.collections4.functors.ComparatorPredicate", "org.apache.commons.collections4.set.AbstractSerializableSetDecorator", "org.apache.commons.collections4.functors.FalsePredicate", "org.apache.commons.collections4.functors.InstantiateFactory", "org.apache.commons.collections4.bag.AbstractMapBag$BagIterator", "org.apache.commons.collections4.functors.OrPredicate", "org.apache.commons.collections4.functors.CatchAndRethrowClosure", "org.apache.commons.collections4.collection.TransformedCollection", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$ExceptionDistanceCalculator", "org.apache.commons.collections4.bag.CollectionBag", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$ConditionDistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$DistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$DistanceAlgo", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$NegConditionDistanceCalculator", "org.apache.commons.collections4.collection.AbstractCollectionDecorator", "org.apache.commons.collections4.collection.SynchronizedCollection", "org.apache.commons.collections4.bag.TreeBag", "org.apache.commons.collections4.set.UnmodifiableSet", "org.apache.commons.collections4.functors.NullIsTruePredicate", "org.apache.commons.collections4.bag.AbstractMapBag", "org.apache.commons.collections4.bag.TransformedSortedBag", "org.apache.commons.collections4.bag.HashBag", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure", "org.apache.commons.collections4.functors.UniquePredicate", "org.apache.commons.collections4.functors.ExceptionFactory", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$1", "org.apache.commons.collections4.Predicate", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$DistanceAlgo", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$2", "org.apache.commons.collections4.bag.AbstractSortedBagDecorator", "org.apache.commons.collections4.bag.CollectionSortedBag", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$3", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$4", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$5", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$DistanceAlgo", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$4", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$3", "org.apache.commons.collections4.functors.IfClosure", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$2", "org.apache.commons.collections4.bag.AbstractMapBag$MutableInteger", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$1", "org.apache.commons.collections4.collection.PredicatedCollection$Builder", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$DistanceCalculator", "org.apache.commons.collections4.bag.SynchronizedSortedBag", "org.apache.commons.collections4.functors.AbstractQuantifierPredicate", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$DistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$DistanceCalculator", "org.apache.commons.collections4.functors.ExceptionClosure", "org.apache.commons.collections4.functors.FactoryTransformer", "org.apache.commons.collections4.functors.ForClosure", "org.apache.commons.collections4.functors.StringValueTransformer", "org.apache.commons.collections4.Unmodifiable", "org.apache.commons.collections4.functors.InstantiateTransformer", "org.apache.commons.collections4.functors.PrototypeFactory$PrototypeCloneFactory", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$ConditionDistanceCalculator", "org.apache.commons.collections4.SortedBag", "org.apache.commons.collections4.functors.ConstantTransformer", "org.apache.commons.collections4.functors.ExceptionTransformer", "org.apache.commons.collections4.functors.InvokerTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$5", "org.apache.commons.collections4.Bag", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure", "org.apache.commons.collections4.bag.AbstractBagDecorator" ); } private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException { mock(Class.forName("java.util.Comparator", false, CollectionBag_3_Test_scaffolding.class.getClassLoader())); } }\|| Test used (generated by EvoSuite): |/* * This file was automatically generated by EvoSuite * Sun May 05 21:30:41 GMT 2024 */ package org.apache.commons.collections4.bag; import org.junit.Test; import static org.junit.Assert.*; import static shaded.org.evosuite.runtime.EvoAssertions.*; import java.util.Collection; import org.apache.commons.collections.Predicate; import org.apache.commons.collections.bag.CollectionBag; import org.apache.commons.collections.bag.TreeBag; import org.apache.commons.collections.functors.NonePredicate; import org.junit.runner.RunWith; import shaded.org.evosuite.runtime.EvoRunner; import shaded.org.evosuite.runtime.EvoRunnerParameters; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVNET = true, separateClassLoader = true) public class CollectionBag_4_failure_Test extends CollectionBag_4_failure_Test_scaffolding { //Covered goal: org.apache.commons.collections4.bag.CollectionBag.add(Ljava/lang/Object;I)Z: true ---> methodResultID==true – path condition org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure (id = 7) @Test(timeout = 4000) public void testAdd_Always() throws Throwable Unknown macro: \{ TreeBag<Predicate<Object>> treeBag0 = new TreeBag<Predicate<Object>>(); CollectionBag<Predicate<Object>> collectionBag0 = new CollectionBag<Predicate<Object>>(treeBag0); Predicate<Object> predicate0 = NonePredicate.nonePredicate((Collection<? extends Predicate<? super Object>>) collectionBag0); // Undeclared exception! try { //** Guard on which the oracle of method add depends: true org.junit.Assume.assumeTrue(true); //** Automatically generated test oracle is: true, always., with guard: \{ description: true, always., conditionText: true } boolean //** Automatically generated test oracle is} {_}methodResult{_}_ = collectionBag0.add(predicate0, 24); //** Postcondition on which the oracle of method add depends: methodResultID==true org.junit.Assert.assertTrue({_}methodResult{_}_ == true); } catch (ClassCastException e){ // // org.apache.commons.collections4.functors.TruePredicate cannot be cast to java.lang.Comparable // verifyException("java.util.TreeMap", e); org.junit.Assert.fail(); } if (true) throw new RuntimeException("Failure-driven test case completed without pinpointing any failure. This should not happen. Please check"); } }| was: *CollectionBag.add(E):* Using "null" as parameter the method throws a "NullPointerException", but not signed into the specification. *CollectionBag.add(E, int):* A "ClassCastException" can be generated, but not signed into the specification. SetUp: |/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Sun May 05 21:30:38 GMT 2024 */ package org.apache.commons.collections4.bag; import shaded.org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.junit.AfterClass; import static shaded.org.evosuite.shaded.org.mockito.Mockito.*; @EvoSuiteClassExclude public class CollectionBag_3_Test_scaffolding { @org.junit.Rule public shaded.org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new shaded.org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); private shaded.org.evosuite.runtime.thread.ThreadStopper threadStopper = new shaded.org.evosuite.runtime.thread.ThreadStopper (shaded.org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { shaded.org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.collections4.bag.CollectionBag"; shaded.org.evosuite.runtime.GuiSupport.initialize(); shaded.org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; shaded.org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; shaded.org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; shaded.org.evosuite.runtime.Runtime.getInstance().resetRuntime(); try \{ initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {} } @AfterClass public static void clearEvoSuiteFramework(){ java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); shaded.org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); setSystemProperties(); shaded.org.evosuite.runtime.GuiSupport.setHeadless(); shaded.org.evosuite.runtime.Runtime.getInstance().resetRuntime(); shaded.org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); shaded.org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); shaded.org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); shaded.org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public static void setSystemProperties() { java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); } private static void initializeClasses() { shaded.org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(CollectionBag_3_Test_scaffolding.class.getClassLoader() , "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$ConditionDistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$DistanceAlgo", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$2", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$1", "org.apache.commons.collections4.functors.ExceptionPredicate", "org.apache.commons.collections4.functors.ComparatorPredicate$1", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$4", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$ConditionDistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$5", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$3", "org.apache.commons.collections4.bag.SynchronizedBag", "org.apache.commons.collections4.functors.ClosureTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$4", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$2", "org.apache.commons.collections4.functors.EqualPredicate", "org.apache.commons.collections4.functors.NullPredicate", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$1", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$3", "org.apache.commons.collections4.functors.OnePredicate", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$DistanceCalculator", "org.apache.commons.collections4.functors.WhileClosure", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3", "org.apache.commons.collections4.functors.TransformerPredicate", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4", "org.apache.commons.collections4.bag.PredicatedBag", "org.apache.commons.collections4.functors.PrototypeFactory$PrototypeSerializationFactory", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$2", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$3", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$4", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$5", "org.apache.commons.collections4.functors.PredicateDecorator", "org.apache.commons.collections4.functors.AnyPredicate", "org.apache.commons.collections4.map.MultiValueMap$ReflectionFactory", "org.apache.commons.collections4.functors.CloneTransformer", "org.apache.commons.collections4.Transformer", "org.apache.commons.collections4.multimap.AbstractMultiValuedMap$KeysMultiSet$MapEntryTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$NegConditionDistanceCalculator", "org.apache.commons.collections4.iterators.UnmodifiableIterator", "org.apache.commons.collections4.bag.UnmodifiableBag", "org.apache.commons.collections4.functors.NOPClosure", "org.apache.commons.collections4.functors.PredicateTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$1", "org.apache.commons.collections4.functors.IfTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$4", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$DistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$ConditionDistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$ConditionDistanceCalculator", "org.apache.commons.collections4.functors.NonePredicate", "org.apache.commons.collections4.functors.ComparatorPredicate$Criterion", "org.apache.commons.collections4.functors.SwitchTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$3", "org.apache.commons.collections4.functors.NOPTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$DistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$2", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$1", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$ExceptionDistanceCalculator", "org.apache.commons.collections4.functors.TruePredicate", "org.apache.commons.collections4.Closure", "org.apache.commons.collections4.functors.NotNullPredicate", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$ConditionDistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$DistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$ExceptionDistanceCalculator", "org.apache.commons.collections4.functors.DefaultEquator", "org.apache.commons.collections4.bag.UnmodifiableSortedBag", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$DistanceAlgo", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$ConditionDistanceCalculator", "org.apache.commons.collections4.FunctorException", "org.apache.commons.collections4.Factory", "org.apache.commons.collections4.functors.NotPredicate", "org.apache.commons.collections4.functors.ChainedTransformer", "org.apache.commons.collections4.functors.PrototypeFactory", "org.apache.commons.collections4.functors.AndPredicate", "org.apache.commons.collections4.functors.ChainedClosure", "org.apache.commons.collections4.collection.PredicatedCollection", "org.apache.commons.collections4.functors.SwitchClosure", "org.apache.commons.collections4.set.AbstractSetDecorator", "org.apache.commons.collections4.functors.TransformedPredicate", "org.apache.commons.collections4.functors.AllPredicate", "org.apache.commons.collections4.functors.ConstantFactory", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$DistanceAlgo", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$4", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$3", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$NegExceptionDistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$NegExceptionDistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$1", "org.apache.commons.collections4.functors.PrototypeFactory$1", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$3", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$2", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$4", "org.apache.commons.collections4.functors.NullIsExceptionPredicate", "org.apache.commons.collections4.bag.PredicatedSortedBag", "org.apache.commons.collections4.functors.MapTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$DistanceAlgo", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$ExceptionDistanceCalculator", "org.apache.commons.collections4.functors.NullIsFalsePredicate", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$2", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$1", "org.apache.commons.collections4.functors.InstanceofPredicate", "org.apache.commons.collections4.Equator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$DistanceAlgo", "org.apache.commons.collections4.functors.IdentityPredicate", "org.apache.commons.collections4.functors.TransformerClosure", "org.apache.commons.collections4.bag.TransformedBag", "org.apache.commons.collections4.functors.ComparatorPredicate", "org.apache.commons.collections4.set.AbstractSerializableSetDecorator", "org.apache.commons.collections4.functors.FalsePredicate", "org.apache.commons.collections4.functors.InstantiateFactory", "org.apache.commons.collections4.bag.AbstractMapBag$BagIterator", "org.apache.commons.collections4.functors.OrPredicate", "org.apache.commons.collections4.functors.CatchAndRethrowClosure", "org.apache.commons.collections4.collection.TransformedCollection", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$ExceptionDistanceCalculator", "org.apache.commons.collections4.bag.CollectionBag", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$ConditionDistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$DistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$DistanceAlgo", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$NegConditionDistanceCalculator", "org.apache.commons.collections4.collection.AbstractCollectionDecorator", "org.apache.commons.collections4.collection.SynchronizedCollection", "org.apache.commons.collections4.bag.TreeBag", "org.apache.commons.collections4.set.UnmodifiableSet", "org.apache.commons.collections4.functors.NullIsTruePredicate", "org.apache.commons.collections4.bag.AbstractMapBag", "org.apache.commons.collections4.bag.TransformedSortedBag", "org.apache.commons.collections4.bag.HashBag", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure", "org.apache.commons.collections4.functors.UniquePredicate", "org.apache.commons.collections4.functors.ExceptionFactory", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$1", "org.apache.commons.collections4.Predicate", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$DistanceAlgo", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$2", "org.apache.commons.collections4.bag.AbstractSortedBagDecorator", "org.apache.commons.collections4.bag.CollectionSortedBag", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$3", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$4", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$5", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$DistanceAlgo", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$4", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$3", "org.apache.commons.collections4.functors.IfClosure", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$2", "org.apache.commons.collections4.bag.AbstractMapBag$MutableInteger", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$1", "org.apache.commons.collections4.collection.PredicatedCollection$Builder", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$DistanceCalculator", "org.apache.commons.collections4.bag.SynchronizedSortedBag", "org.apache.commons.collections4.functors.AbstractQuantifierPredicate", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$DistanceCalculator", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$DistanceCalculator", "org.apache.commons.collections4.functors.ExceptionClosure", "org.apache.commons.collections4.functors.FactoryTransformer", "org.apache.commons.collections4.functors.ForClosure", "org.apache.commons.collections4.functors.StringValueTransformer", "org.apache.commons.collections4.Unmodifiable", "org.apache.commons.collections4.functors.InstantiateTransformer", "org.apache.commons.collections4.functors.PrototypeFactory$PrototypeCloneFactory", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$ConditionDistanceCalculator", "org.apache.commons.collections4.SortedBag", "org.apache.commons.collections4.functors.ConstantTransformer", "org.apache.commons.collections4.functors.ExceptionTransformer", "org.apache.commons.collections4.functors.InvokerTransformer", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$5", "org.apache.commons.collections4.Bag", "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure", "org.apache.commons.collections4.bag.AbstractBagDecorator" ); } private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException { mock(Class.forName("java.util.Comparator", false, CollectionBag_3_Test_scaffolding.class.getClassLoader())); } }| Test used (generated by EvoSuite): |/* * This file was automatically generated by EvoSuite * Sun May 05 21:30:41 GMT 2024 */ package org.apache.commons.collections4.bag; import org.junit.Test; import static org.junit.Assert.*; import static shaded.org.evosuite.runtime.EvoAssertions.*; import java.util.Collection; import org.apache.commons.collections.Predicate; import org.apache.commons.collections.bag.CollectionBag; import org.apache.commons.collections.bag.TreeBag; import org.apache.commons.collections.functors.NonePredicate; import org.junit.runner.RunWith; import shaded.org.evosuite.runtime.EvoRunner; import shaded.org.evosuite.runtime.EvoRunnerParameters; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVNET = true, separateClassLoader = true) public class CollectionBag_4_failure_Test extends CollectionBag_4_failure_Test_scaffolding { //Covered goal: org.apache.commons.collections4.bag.CollectionBag.add(Ljava/lang/Object;I)Z: true ---> methodResultID==true -- path condition org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure (id = 7) @Test(timeout = 4000) public void testAdd_Always() throws Throwable { TreeBag<Predicate<Object>> treeBag0 = new TreeBag<Predicate<Object>>(); CollectionBag<Predicate<Object>> collectionBag0 = new CollectionBag<Predicate<Object>>(treeBag0); Predicate<Object> predicate0 = NonePredicate.nonePredicate((Collection<? extends Predicate<? super Object>>) collectionBag0); // Undeclared exception! try { //** Guard on which the oracle of method add depends: true org.junit.Assume.assumeTrue(true); //** Automatically generated test oracle is: true, always., with guard: \{ description: true, always., conditionText: true } boolean //** Automatically generated test oracle is: true, always., with guard: \{ description: true, always., conditionText: true } _methodResult__ = collectionBag0.add(predicate0, 24); //** Postcondition on which the oracle of method add depends: methodResultID==true org.junit.Assert.assertTrue(_methodResult__ == true); } catch (ClassCastException e) { // // org.apache.commons.collections4.functors.TruePredicate cannot be cast to java.lang.Comparable // verifyException("java.util.TreeMap", e); org.junit.Assert.fail(); } if (true) throw new RuntimeException("Failure-driven test case completed without pinpointing any failure. This should not happen. Please check"); } }| > Documentation Bug: CollectionBag.add(E), CollectionBag.add(E, int) > ------------------------------------------------------------------ > > Key: COLLECTIONS-860 > URL: https://issues.apache.org/jira/browse/COLLECTIONS-860 > Project: Commons Collections > Issue Type: Bug > Reporter: Daniele > Priority: Minor > > *CollectionBag.add(E):* > Using "null" as parameter the method throws a "NullPointerException", but not > signed into the specification. > *CollectionBag.add(E, int):* > A "ClassCastException" can be generated, but not signed into the > specification. > SetUp: > |/** > * Scaffolding file used to store all the setups needed to run > * tests automatically generated by EvoSuite > * Sun May 05 21:30:38 GMT 2024 > */ > package org.apache.commons.collections4.bag; > import shaded.org.evosuite.runtime.annotation.EvoSuiteClassExclude; > import org.junit.BeforeClass; > import org.junit.Before; > import org.junit.After; > import org.junit.AfterClass; > import static shaded.org.evosuite.shaded.org.mockito.Mockito.*; > @EvoSuiteClassExclude > public class CollectionBag_3_Test_scaffolding { > @org.junit.Rule > public shaded.org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = > new shaded.org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); > private static final java.util.Properties defaultProperties = > (java.util.Properties) java.lang.System.getProperties().clone(); > private shaded.org.evosuite.runtime.thread.ThreadStopper threadStopper = > new shaded.org.evosuite.runtime.thread.ThreadStopper > (shaded.org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); > @BeforeClass > public static void initEvoSuiteFramework() > { shaded.org.evosuite.runtime.RuntimeSettings.className = > "org.apache.commons.collections4.bag.CollectionBag"; > shaded.org.evosuite.runtime.GuiSupport.initialize(); > shaded.org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; > shaded.org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = > 10000; shaded.org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; > shaded.org.evosuite.runtime.Runtime.getInstance().resetRuntime(); > try \\{ initMocksToAvoidTimeoutsInTheTests(); } > catch(ClassNotFoundException e) {} > } > @AfterClass > public static void clearEvoSuiteFramework() > { java.lang.System.setProperties((java.util.Properties) > defaultProperties.clone()); } > > @Before > public void initTestCase() > { threadStopper.storeCurrentThreads(); > threadStopper.startRecordingTime(); > shaded.org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); > setSystemProperties(); > shaded.org.evosuite.runtime.GuiSupport.setHeadless(); > shaded.org.evosuite.runtime.Runtime.getInstance().resetRuntime(); > shaded.org.evosuite.runtime.agent.InstrumentingAgent.activate(); } > > @After > public void doneWithTestCase() > { threadStopper.killAndJoinClientThreads(); > shaded.org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); > shaded.org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); > shaded.org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } > > public static void setSystemProperties() > { java.lang.System.setProperties((java.util.Properties) > defaultProperties.clone()); } > private static void initializeClasses() > { > shaded.org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(CollectionBag_3_Test_scaffolding.class.getClassLoader() > , > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$ConditionDistanceCalculator", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$DistanceAlgo", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$2", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$1", > "org.apache.commons.collections4.functors.ExceptionPredicate", > "org.apache.commons.collections4.functors.ComparatorPredicate$1", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$4", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$ConditionDistanceCalculator", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$5", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$3", > "org.apache.commons.collections4.bag.SynchronizedBag", > "org.apache.commons.collections4.functors.ClosureTransformer", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$4", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$2", > "org.apache.commons.collections4.functors.EqualPredicate", > "org.apache.commons.collections4.functors.NullPredicate", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$1", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$3", > "org.apache.commons.collections4.functors.OnePredicate", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$DistanceCalculator", > "org.apache.commons.collections4.functors.WhileClosure", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3", > "org.apache.commons.collections4.functors.TransformerPredicate", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4", > "org.apache.commons.collections4.bag.PredicatedBag", > "org.apache.commons.collections4.functors.PrototypeFactory$PrototypeSerializationFactory", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$2", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$3", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$4", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$5", > "org.apache.commons.collections4.functors.PredicateDecorator", > "org.apache.commons.collections4.functors.AnyPredicate", > "org.apache.commons.collections4.map.MultiValueMap$ReflectionFactory", > "org.apache.commons.collections4.functors.CloneTransformer", > "org.apache.commons.collections4.Transformer", > "org.apache.commons.collections4.multimap.AbstractMultiValuedMap$KeysMultiSet$MapEntryTransformer", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$NegConditionDistanceCalculator", > "org.apache.commons.collections4.iterators.UnmodifiableIterator", > "org.apache.commons.collections4.bag.UnmodifiableBag", > "org.apache.commons.collections4.functors.NOPClosure", > "org.apache.commons.collections4.functors.PredicateTransformer", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$1", > "org.apache.commons.collections4.functors.IfTransformer", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$4", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$DistanceCalculator", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$ConditionDistanceCalculator", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$ConditionDistanceCalculator", > "org.apache.commons.collections4.functors.NonePredicate", > "org.apache.commons.collections4.functors.ComparatorPredicate$Criterion", > "org.apache.commons.collections4.functors.SwitchTransformer", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$3", > "org.apache.commons.collections4.functors.NOPTransformer", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$DistanceCalculator", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$2", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$1", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$ExceptionDistanceCalculator", > "org.apache.commons.collections4.functors.TruePredicate", > "org.apache.commons.collections4.Closure", > "org.apache.commons.collections4.functors.NotNullPredicate", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$ConditionDistanceCalculator", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$DistanceCalculator", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$ExceptionDistanceCalculator", > "org.apache.commons.collections4.functors.DefaultEquator", > "org.apache.commons.collections4.bag.UnmodifiableSortedBag", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$DistanceAlgo", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$ConditionDistanceCalculator", > "org.apache.commons.collections4.FunctorException", > "org.apache.commons.collections4.Factory", > "org.apache.commons.collections4.functors.NotPredicate", > "org.apache.commons.collections4.functors.ChainedTransformer", > "org.apache.commons.collections4.functors.PrototypeFactory", > "org.apache.commons.collections4.functors.AndPredicate", > "org.apache.commons.collections4.functors.ChainedClosure", > "org.apache.commons.collections4.collection.PredicatedCollection", > "org.apache.commons.collections4.functors.SwitchClosure", > "org.apache.commons.collections4.set.AbstractSetDecorator", > "org.apache.commons.collections4.functors.TransformedPredicate", > "org.apache.commons.collections4.functors.AllPredicate", > "org.apache.commons.collections4.functors.ConstantFactory", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$DistanceAlgo", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$4", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$3", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$NegExceptionDistanceCalculator", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$NegExceptionDistanceCalculator", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$1", > "org.apache.commons.collections4.functors.PrototypeFactory$1", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$3", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$2", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$4", > "org.apache.commons.collections4.functors.NullIsExceptionPredicate", > "org.apache.commons.collections4.bag.PredicatedSortedBag", > "org.apache.commons.collections4.functors.MapTransformer", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$DistanceAlgo", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$ExceptionDistanceCalculator", > "org.apache.commons.collections4.functors.NullIsFalsePredicate", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$2", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$1", > "org.apache.commons.collections4.functors.InstanceofPredicate", > "org.apache.commons.collections4.Equator", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$DistanceAlgo", > "org.apache.commons.collections4.functors.IdentityPredicate", > "org.apache.commons.collections4.functors.TransformerClosure", > "org.apache.commons.collections4.bag.TransformedBag", > "org.apache.commons.collections4.functors.ComparatorPredicate", > "org.apache.commons.collections4.set.AbstractSerializableSetDecorator", > "org.apache.commons.collections4.functors.FalsePredicate", > "org.apache.commons.collections4.functors.InstantiateFactory", > "org.apache.commons.collections4.bag.AbstractMapBag$BagIterator", > "org.apache.commons.collections4.functors.OrPredicate", > "org.apache.commons.collections4.functors.CatchAndRethrowClosure", > "org.apache.commons.collections4.collection.TransformedCollection", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$ExceptionDistanceCalculator", > "org.apache.commons.collections4.bag.CollectionBag", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$ConditionDistanceCalculator", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$DistanceCalculator", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure$DistanceAlgo", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$NegConditionDistanceCalculator", > > "org.apache.commons.collections4.collection.AbstractCollectionDecorator", > "org.apache.commons.collections4.collection.SynchronizedCollection", > "org.apache.commons.collections4.bag.TreeBag", > "org.apache.commons.collections4.set.UnmodifiableSet", > "org.apache.commons.collections4.functors.NullIsTruePredicate", > "org.apache.commons.collections4.bag.AbstractMapBag", > "org.apache.commons.collections4.bag.TransformedSortedBag", > "org.apache.commons.collections4.bag.HashBag", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure", > "org.apache.commons.collections4.functors.UniquePredicate", > "org.apache.commons.collections4.functors.ExceptionFactory", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$1", > "org.apache.commons.collections4.Predicate", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$DistanceAlgo", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$2", > "org.apache.commons.collections4.bag.AbstractSortedBagDecorator", > "org.apache.commons.collections4.bag.CollectionSortedBag", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$3", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3_failure$4", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$5", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4$DistanceAlgo", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$4", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$3", > "org.apache.commons.collections4.functors.IfClosure", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$2", > "org.apache.commons.collections4.bag.AbstractMapBag$MutableInteger", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$1", > "org.apache.commons.collections4.collection.PredicatedCollection$Builder", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1$DistanceCalculator", > "org.apache.commons.collections4.bag.SynchronizedSortedBag", > "org.apache.commons.collections4.functors.AbstractQuantifierPredicate", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_3$DistanceCalculator", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure$DistanceCalculator", > "org.apache.commons.collections4.functors.ExceptionClosure", > "org.apache.commons.collections4.functors.FactoryTransformer", > "org.apache.commons.collections4.functors.ForClosure", > "org.apache.commons.collections4.functors.StringValueTransformer", > "org.apache.commons.collections4.Unmodifiable", > "org.apache.commons.collections4.functors.InstantiateTransformer", > "org.apache.commons.collections4.functors.PrototypeFactory$PrototypeCloneFactory", > > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_1_failure$ConditionDistanceCalculator", > "org.apache.commons.collections4.SortedBag", > "org.apache.commons.collections4.functors.ConstantTransformer", > "org.apache.commons.collections4.functors.ExceptionTransformer", > "org.apache.commons.collections4.functors.InvokerTransformer", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2$5", > "org.apache.commons.collections4.Bag", > "org.apache.commons.collections4.bag.EvoSuiteEvaluator_2_failure", > "org.apache.commons.collections4.bag.AbstractBagDecorator" ); } > > private static void initMocksToAvoidTimeoutsInTheTests() throws > ClassNotFoundException > { mock(Class.forName("java.util.Comparator", false, > CollectionBag_3_Test_scaffolding.class.getClassLoader())); } > }\|| > > Test used (generated by EvoSuite): > > |/* > * This file was automatically generated by EvoSuite > * Sun May 05 21:30:41 GMT 2024 > */ > package org.apache.commons.collections4.bag; > import org.junit.Test; > import static org.junit.Assert.*; > import static shaded.org.evosuite.runtime.EvoAssertions.*; > import java.util.Collection; > import org.apache.commons.collections.Predicate; > import org.apache.commons.collections.bag.CollectionBag; > import org.apache.commons.collections.bag.TreeBag; > import org.apache.commons.collections.functors.NonePredicate; > import org.junit.runner.RunWith; > import shaded.org.evosuite.runtime.EvoRunner; > import shaded.org.evosuite.runtime.EvoRunnerParameters; > @RunWith(EvoRunner.class) > @EvoRunnerParameters(mockJVMNonDeterminism = true, useVNET = true, > separateClassLoader = true) > public class CollectionBag_4_failure_Test extends > CollectionBag_4_failure_Test_scaffolding { > //Covered goal: > org.apache.commons.collections4.bag.CollectionBag.add(Ljava/lang/Object;I)Z: > true ---> methodResultID==true – path condition > org.apache.commons.collections4.bag.EvoSuiteEvaluator_4_failure (id = 7) > @Test(timeout = 4000) > public void testAdd_Always() throws Throwable > Unknown macro: \{ TreeBag<Predicate<Object>> treeBag0 = new > TreeBag<Predicate<Object>>(); CollectionBag<Predicate<Object>> > collectionBag0 = new CollectionBag<Predicate<Object>>(treeBag0); > Predicate<Object> predicate0 = NonePredicate.nonePredicate((Collection<? > extends Predicate<? super Object>>) collectionBag0); // Undeclared > exception! try { //** Guard on which the oracle of method > add depends: true org.junit.Assume.assumeTrue(true); > //** Automatically generated test oracle is: true, always., with guard: \{ > description: true, always., conditionText: true } boolean //** > Automatically generated test oracle is} > {_}methodResult{_}_ = collectionBag0.add(predicate0, 24); > //** Postcondition on which the oracle of method add depends: > methodResultID==true > org.junit.Assert.assertTrue({_}methodResult{_}_ == true); > } catch (ClassCastException e){ // // > org.apache.commons.collections4.functors.TruePredicate cannot be cast to > java.lang.Comparable // > verifyException("java.util.TreeMap", e); org.junit.Assert.fail(); > } > if (true) > throw new RuntimeException("Failure-driven test case completed > without pinpointing any failure. This should not happen. Please check"); > } > }| > > -- This message was sent by Atlassian Jira (v8.20.10#820010)