java.lang.Objectjunit.framework.TestCase
org.apache.commons.collections.BulkTest
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
TestIntIterator, TestSynchronizedSet, TestMap, TestSynchronizedList, TestMapValues, AbstractTestList, TestPredicatedSortedSet, TestTransformedSortedMap, TestLazyMap, AbstractTestSortedBag, TestMapValues, TestObjectArrayListIterator2, TestIteratorCharIterator, TestSortedSetSubSet, TestBoundedFifoBuffer2, TestByteCollectionCollection, TestUnmodifiableBidiMap, TestIterator, TestBag, TestTransformedBag, TestSingletonIterator, TestListIteratorFloatListIterator, AbstractTestIterator, TestBufferUtils, TestUnmodifiableIterator, TestCollectionShortCollection, TestStaticBucketMap, TestDoubleIteratorIterator, TestIteratorFloatIterator, TestSingletonIterator2, TestListView, TestCaseInsensitiveMap, TestListOrderedMap2, TestSingletonListIterator, TestHashBag, TestListUtils, TestHashBag, TestUnmodifiableSet, TestUnmodifiableBuffer, TestFastArrayList, TestBoundedFifoBuffer, TestShortCollectionCollection, TestCompositeSet, TestSynchronizedBuffer, TestFastArrayList1, TestListOrderedSet, TestComparableComparator, TestFastHashMap, TestHeadMap, TestCharCollectionCollection, AbstractTestBag, TestIteratorByteIterator, TestBlockingBuffer, TestSubMap, TestMapBackedSet, TestLinkedList, TestBooleanComparator, TestBeanMap, TestShortListIteratorListIterator, TestUnmodifiableSortedSet, TestUniqueFilterIterator, AbstractTestOrderedMapIterator, TestShortIteratorIterator, TestPredicatedSortedBag, TestBoundedFifoBuffer, TestTransformedSet, TestTypedSortedSet, TestSynchronizedSortedSet, TestHashedMap, TestUnmodifiableMap, TestFloatListIterator, TestUnmodifiableMapIterator, InnerTestMapIterator, TestCollectionByteCollection, TestListIteratorShortListIterator, TestArrayIterator, TestArrayListIterator, AbstractTestOrderedMap, TestTransformedList, TestUnmodifiableOrderedMapIterator, TestByteIteratorIterator, BulkTestSubList, TestReferenceMap, TestIntListIteratorListIterator, AbstractTestCollection, TestEnumerationUtils, TestTransformedSortedBag, TestListIteratorDoubleListIterator, TestCharListIterator, TestListIteratorWrapper, TestTransformedMap, TestPredicatedSortedMap, TestCharListIteratorListIterator, AbstractTestMap, TestFloatListIteratorListIterator, AbstractTestMapIterator, TestSingletonMap, TestIdentityMap, TestListView, TestCompositeMap, TestAbstractLinkedList, TestReferenceMap, AbstractTestIterableMap, TestUnboundedFifoBuffer, TestSynchronizedCollection, TestLongIterator, TestSetUtils, TestTypedSet, TestFixedSizeList, TestMapUtils, TestPredicatedList, TestTreeBidiMap, TestCollection, TestArrayStack, TestPriorityBuffer, TestIntListIterator, TestLRUMap, TestMapEntrySet, TestBidiOrderedMapIterator, TestIntIteratorIterator, TestCollectionIntCollection, TestTypedBag, TestFlatMapIterator, TestShortListIterator, TestPredicatedBuffer, TestUnmodifiableSortedBidiMap, TestDoubleListIterator, TestList, TestUnmodifiableCollection, TestSequencedHashMap, TestComparator, TestListOrderedMap, TestCursorableLinkedList, TestCircularFifoBuffer, TestFixedSizeMap, TestMapEntrySet, TestInverseBidiMap, TestBagUtils, TestCursorableLinkedList, AbstractTestSortedSet, AbstractTestSortedBidiMap, TestListOrderedSet2, TestCollectionCharCollection, TestTypedCollection, TestDoubleCollectionCollection, AbstractTestListIterator, TestIteratorIntIterator, TestBoundedFifoBuffer2, TestMultiHashMap, TestCollatingIterator, TestDualTreeBidiMap, TestFlat3Map, TestObjectArrayIterator, TestNullComparator1, TestCharIteratorIterator, TestComparatorChain, TestUnboundedFifoBuffer, TestShortIterator, TestViewMap, TestListIteratorCharListIterator, TestTreeBag, TestPredicatedMap, TestDualHashBidiMap, TestObjectArrayListIterator, TestDoubleIterator, TestFastHashMap1, TestFloatCollectionCollection, TestSetUniqueList, TestSet, TestIteratorChain, TestAbstractOrderedBidiMapDecorator, TestLRUMap, TestIntCollectionCollection, TestBidiMapIterator, AbstractTestSortedMap, TestNodeCachingLinkedList, AbstractTestSet, TestUnmodifiableOrderedMap, TestLongIteratorIterator, TestNullComparator, TestIteratorUtils, TestCollectionLongCollection, TestCharIterator, TestFastTreeMap, TestMultiKeyMap, TestFastTreeMap1, TestPredicatedBag, TestUnmodifiableList, AbstractTestObject, TestReaderCharIterator, TestLongCollectionCollection, TestLinkedMap, TestBinaryHeap, TestPredicatedCollection, TestCollectionFloatCollection, TestFixedSizeSortedMap, TestUnmodifiableSortedMap, TestByteIterator, TestFilterIterator, TestMapKeySet, TestInputStreamByteIterator, TestNullComparator2, TestArrayList, TestStaticBucketMap, TestArrayListIterator2, TestTypedSortedBag, TestListIteratorIntListIterator, TestListIteratorByteListIterator, TestFloatIteratorIterator, BulkTestSubList, TestPredicatedSet, TestLongListIterator, TestTreeMap, TestFloatIterator, TestListIterator, TestTypedList, TestUnmodifiableListIterator, TestListIteratorLongListIterator, TestDualTreeBidiMap2, TestIteratorShortIterator, TestTransformedSortedSet, TestIteratorLongIterator, TestMapBackedSet2, TestListView, TestReferenceIdentityMap, TestMapKeySet, TestReverseComparator, TestObject, InnerTestOrderedMapIterator, TestIteratorDoubleIterator, TestLongListIteratorListIterator, TestArrayIterator2, TestTransformedCollection, TestTailMap, TestLazySortedMap, TestCollectionDoubleCollection, TestDoubleListIteratorListIterator, AbstractTestOrderedBidiMap, AbstractTestBidiMap, TestTreeBag, TestProxyMap, AbstractTestComparator, TestByteListIteratorListIterator, TestObjectGraphIterator, TestPredicatedCollection, TestDoubleOrderedMap, TestByteListIterator, TestCompositeCollection, TestUnmodifiableOrderedBidiMap, TestTreeList
A simple test method is the type of test traditionally
supplied by by TestCase . To define a simple test, create a public
no-argument method whose name starts with "test". You can specify the
the name of simple test in the constructor of BulkTest;
a subsequent call to TestCase#run will run that simple test.
A bulk test method, on the other hand, returns a new instance
of BulkTest, which can itself define new simple and bulk
test methods. By using the #makeSuite method, you can
automatically create a hierarchal suite of tests and child bulk tests.
For instance, consider the following two classes:
public class TestSet extends BulkTest {
private Set set;
public TestSet(Set set) {
this.set = set;
}
public void testContains() {
boolean r = set.contains(set.iterator().next()));
assertTrue("Set should contain first element, r);
}
public void testClear() {
set.clear();
assertTrue("Set should be empty after clear", set.isEmpty());
}
}
public class TestHashMap extends BulkTest {
private Map makeFullMap() {
HashMap result = new HashMap();
result.put("1", "One");
result.put("2", "Two");
return result;
}
public void testClear() {
Map map = makeFullMap();
map.clear();
assertTrue("Map empty after clear", map.isEmpty());
}
public BulkTest bulkTestKeySet() {
return new TestSet(makeFullMap().keySet());
}
public BulkTest bulkTestEntrySet() {
return new TestSet(makeFullMap().entrySet());
}
}
In the above examples, TestSet defines two
simple test methods and no bulk test methods; TestHashMap
defines one simple test method and two bulk test methods. When
makeSuite(TestHashMap.class).run is executed,
five simple test methods will be run, in this order:
null from the bulk test method. If you only
want to override specific simple tests within a bulk test, use the
#ignoredSimpleTests method.
Note that if you want to use the bulk test methods, you must
define your suite() method to use #makeSuite .
The ordinary TestSuite constructor doesn't know how to
interpret bulk test methods.
Paul - Jack$ - Id: BulkTest.java,v 1.2.2.1 2004/05/22 12:14:05 scolebourne Exp $| Field Summary | ||
|---|---|---|
| String | verboseName | The full name of this bulk test instance. This is the full name that is compared to #ignoredSimpleTests to see if this test should be ignored. It's also displayed in the text runner to ease debugging. |
| Constructor: |
|---|
BulkTest instance that will run the
specified simple test.
|
| Method from org.apache.commons.collections.BulkTest Summary: |
|---|
| clone, ignoredSimpleTests, makeSuite, toString |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.apache.commons.collections.BulkTest Detail: |
|---|
BulkTest. |
If a simple test that's defined by this
A simple test's name is formed by taking the class name of the
root TestHashMap.bulkTestEntrySet.testClearis the name of one of the simple tests defined in the sample classes described above. If the sample TestHashMap class
included this method:
public String[] ignoredSimpleTests() {
return new String[] { "TestHashMap.bulkTestEntrySet.testClear" };
}
then the entry set's clear method wouldn't be tested, but the key
set's clear method would. |
The class is examined for simple and bulk test methods; any child bulk tests are also examined recursively; and the results are stored in a hierarchal TestSuite .
The given class must be a subclass of |
BulkTest. |