org.apache.commons.collections.bag

Class AbstractTestBag


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 Summary

AbstractTestBag(String testName)
JUnit constructor.

Method Summary

abstract Bag
makeBag()
Return a new, empty bag to used for testing.
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()

Constructor Details

AbstractTestBag

public AbstractTestBag(String testName)
JUnit constructor.
Parameters:
testName - the test class name

Method Details

makeBag

public abstract Bag makeBag()
Return a new, empty bag to used for testing.
Returns:
the bag to be tested

makeObject

public Object makeObject()
Implements the superclass method to return the Bag.
Returns:
the bag to be tested

testBagAdd

public void testBagAdd()

testBagEqualsSelf

public void testBagEqualsSelf()

testContains

public void testContains()

testContainsAll

public void testContainsAll()

testEmptyBagCompatibility

public void testEmptyBagCompatibility()
            throws IOException,
                   ClassNotFoundException
Compare the current serialized form of the Bag against the canonical version in CVS.

testEmptyBagSerialization

public void testEmptyBagSerialization()
            throws IOException,
                   ClassNotFoundException

testEquals

public void testEquals()

testEqualsHashBag

public void testEqualsHashBag()

testFullBagCompatibility

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

testFullBagSerialization

public void testFullBagSerialization()
            throws IOException,
                   ClassNotFoundException

testHashCode

public void testHashCode()

testIterator

public void testIterator()

testIteratorFail

public void testIteratorFail()

testIteratorFailDoubleRemove

public void testIteratorFailDoubleRemove()

testIteratorFailNoMore

public void testIteratorFailNoMore()

testIteratorRemoveProtectsInvariants

public void testIteratorRemoveProtectsInvariants()

testRemove

public void testRemove()

testRemoveAll

public void testRemoveAll()

testRetainAll

public void testRetainAll()

testSize

public void testSize()

testToArray

public void testToArray()

testToArrayPopulate

public void testToArrayPopulate()

Copyright © 2001-2015 Apache Software Foundation. All Rights Reserved.