Class AbstractTestBag

  • All Implemented Interfaces:
    java.lang.Cloneable, junit.framework.Test
    Direct Known Subclasses:
    AbstractTestSortedBag

    public abstract class AbstractTestBag
    extends AbstractTestObject
    Abstract test class for Bag methods and contracts.

    To use, simply extend this class, and implement the makeBag() method.

    If your bag fails one of these tests by design, you may still use this base set of cases. Simply override the test case (method) your bag fails.

    • Constructor Detail

      • AbstractTestBag

        public AbstractTestBag​(java.lang.String testName)
        JUnit constructor.
        Parameters:
        testName - the test class name
    • Method Detail

      • makeBag

        public abstract org.apache.commons.collections.Bag makeBag()
        Return a new, empty bag to used for testing.
        Returns:
        the bag to be tested
      • makeObject

        public java.lang.Object makeObject()
        Implements the superclass method to return the Bag.
        Specified by:
        makeObject in class AbstractTestObject
        Returns:
        the bag to be tested
      • testBagAdd

        public void testBagAdd()
      • testBagEqualsSelf

        public void testBagEqualsSelf()
      • testRemove

        public void testRemove()
      • testRemoveAll

        public void testRemoveAll()
      • testContains

        public void testContains()
      • testContainsAll

        public void testContainsAll()
      • testSize

        public void testSize()
      • testRetainAll

        public void testRetainAll()
      • testIterator

        public void testIterator()
      • testIteratorFail

        public void testIteratorFail()
      • testIteratorFailNoMore

        public void testIteratorFailNoMore()
      • testIteratorFailDoubleRemove

        public void testIteratorFailDoubleRemove()
      • testIteratorRemoveProtectsInvariants

        public void testIteratorRemoveProtectsInvariants()
      • testToArray

        public void testToArray()
      • testToArrayPopulate

        public void testToArrayPopulate()
      • testEquals

        public void testEquals()
      • testEqualsHashBag

        public void testEqualsHashBag()
      • testHashCode

        public void testHashCode()
      • testEmptyBagSerialization

        public void testEmptyBagSerialization()
                                       throws java.io.IOException,
                                              java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • testFullBagSerialization

        public void testFullBagSerialization()
                                      throws java.io.IOException,
                                             java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • testEmptyBagCompatibility

        public void testEmptyBagCompatibility()
                                       throws java.io.IOException,
                                              java.lang.ClassNotFoundException
        Compare the current serialized form of the Bag against the canonical version in CVS.
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • testFullBagCompatibility

        public void testFullBagCompatibility()
                                      throws java.io.IOException,
                                             java.lang.ClassNotFoundException
        Compare the current serialized form of the Bag against the canonical version in CVS.
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException