[ 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 "(Integer) null" as parameter the method throws a "NullPointerException", but not described into the specification. *CollectionBag.add(E, int):* A "ClassCastException" can be generated, but not described into the specification. *Test used:* {code:java} public class CollectionBag_4_failure_Test{ 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); try { boolean _methodResult__ = collectionBag0.add(predicate0, 24); org.junit.Assert.assertTrue(_methodResult__ == true); } catch (ClassCastException e) { verifyException("java.util.TreeMap", e); org.junit.Assert.fail(); } } } {code} 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. *Test used:* {code:java} public class CollectionBag_4_failure_Test{ 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); try { boolean _methodResult__ = collectionBag0.add(predicate0, 24); org.junit.Assert.assertTrue(_methodResult__ == true); } catch (ClassCastException e) { verifyException("java.util.TreeMap", e); org.junit.Assert.fail(); } } } {code} > 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 "(Integer) null" as parameter the method throws a > "NullPointerException", but not described into the specification. > *CollectionBag.add(E, int):* > A "ClassCastException" can be generated, but not described into the > specification. > *Test used:* > {code:java} > public class CollectionBag_4_failure_Test{ > 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); > try { > boolean _methodResult__ = collectionBag0.add(predicate0, 24); > org.junit.Assert.assertTrue(_methodResult__ == true); > } catch (ClassCastException e) { > verifyException("java.util.TreeMap", e); > org.junit.Assert.fail(); > } > } > } {code} > -- This message was sent by Atlassian Jira (v8.20.10#820010)