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:
java.lang.Cloneable
,junit.framework.Test
- Direct Known Subclasses:
AbstractTestSortedBag
public abstract class AbstractTestBag extends AbstractTestObject
Abstract test class forBag
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 Constructor Description AbstractTestBag(java.lang.String testName)
JUnit constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract org.apache.commons.collections.Bag
makeBag()
Return a new, empty bag to used for testing.java.lang.Object
makeObject()
Implements the superclass method to return the Bag.void
testBagAdd()
void
testBagEqualsSelf()
void
testContains()
void
testContainsAll()
void
testEmptyBagCompatibility()
Compare the current serialized form of the Bag against the canonical version in CVS.void
testEmptyBagSerialization()
void
testEquals()
void
testEqualsHashBag()
void
testFullBagCompatibility()
Compare the current serialized form of the Bag against the canonical version in CVS.void
testFullBagSerialization()
void
testHashCode()
void
testIterator()
void
testIteratorFail()
void
testIteratorFailDoubleRemove()
void
testIteratorFailNoMore()
void
testIteratorRemoveProtectsInvariants()
void
testRemove()
void
testRemoveAll()
void
testRetainAll()
void
testSize()
void
testToArray()
void
testToArrayPopulate()
-
Methods 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, writeExternalFormToDisk
-
Methods inherited from class org.apache.commons.collections.BulkTest
clone, ignoredTests, makeSuite, toString
-
Methods 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
-
-
-
-
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 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
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
-
-