Class AbstractTestBag
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.apache.commons.collections.BulkTest
org.apache.commons.collections.AbstractTestObject
org.apache.commons.collections.bag.AbstractTestBag
- All Implemented Interfaces:
Cloneable,junit.framework.Test
- Direct Known Subclasses:
AbstractTestSortedBag
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.
-
Field Summary
Fields inherited from class org.apache.commons.collections.AbstractTestObject
COLLECTIONS_MAJOR_VERSION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.apache.commons.collections.BagmakeBag()Return a new, empty bag to used for testing.Implements the superclass method to return the Bag.voidvoidvoidvoidvoidCompare the current serialized form of the Bag against the canonical version in CVS.voidvoidvoidvoidCompare the current serialized form of the Bag against the canonical version in CVS.voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidtestSize()voidvoidMethods inherited from class org.apache.commons.collections.AbstractTestObject
getCanonicalEmptyCollectionName, getCanonicalFullCollectionName, getCompatibilityVersion, isEqualsCheckable, isTestSerialization, readExternalFormFromBytes, readExternalFormFromDisk, skipSerializedCanonicalTests, supportsEmptyCollections, supportsFullCollections, testCanonicalEmptyCollectionExists, testCanonicalFullCollectionExists, testEqualsNull, testObjectEqualsSelf, testObjectHashCodeEqualsContract, testObjectHashCodeEqualsSelfHashCode, testSerializeDeserializeThenCompare, testSimpleSerialization, writeExternalFormToBytes, writeExternalFormToDiskMethods inherited from class org.apache.commons.collections.BulkTest
clone, ignoredTests, makeSuite, toStringMethods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown
-
Constructor Details
-
AbstractTestBag
JUnit constructor.- Parameters:
testName- the test class name
-
-
Method Details
-
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
Implements the superclass method to return the Bag.- Specified by:
makeObjectin classAbstractTestObject- 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
- Throws:
IOExceptionClassNotFoundException
-
testFullBagSerialization
- Throws:
IOExceptionClassNotFoundException
-
testEmptyBagCompatibility
Compare the current serialized form of the Bag against the canonical version in CVS.- Throws:
IOExceptionClassNotFoundException
-
testFullBagCompatibility
Compare the current serialized form of the Bag against the canonical version in CVS.- Throws:
IOExceptionClassNotFoundException
-