Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-860

Documentation Bug: CollectionBag.add(E), CollectionBag.add(E, int)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 4.5.0-M3
    • None
    • None

    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:

      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();
              }
          }
      } 

       

      Attachments

        Activity

          People

            ggregory Gary D. Gregory
            ferra Daniele
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: