|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.commons.collections.BulkTest
org.apache.commons.collections.TestObject
org.apache.commons.collections.TestCollection
org.apache.commons.collections.TestList
Tests base List methods and contracts.
To use, simply extend this class, and implement the #makeList method.
If your TestList.BulkTestSubList fails one of these tests by design, you may still use this base set of cases. Simply override the test case (method) your TestList.BulkTestSubList fails.
| Nested Class Summary | |
(package private) static class |
TestList.BulkTestSubList |
| Field Summary |
| Fields inherited from class org.apache.commons.collections.TestCollection |
collection, confirmed |
| Fields inherited from class org.apache.commons.collections.TestObject |
COLLECTIONS_MAJOR_VERSION |
| Fields inherited from class org.apache.commons.collections.BulkTest |
verboseName |
| Fields inherited from class junit.framework.TestCase |
|
| Constructor Summary | |
TestList(java.lang.String testName) |
|
| Method Summary | |
private void |
backwardTest(java.util.ListIterator iter, int i)Traverses to the beginning of the given iterator. |
BulkTest |
bulkTestSubList()Returns a BulkTest for testing List#subList(int,int). |
protected void |
failFastAll(java.util.List list)Invokes all the methods on the given sublist to make sure they raise a ConcurrentModificationException. |
protected void |
failFastMethod(java.util.List list, java.lang.reflect.Method m)Invokes the given method on the given sublist to make sure it raises a ConcurrentModificationException. |
private void |
forwardTest(java.util.ListIterator iter, int i)Traverses to the end of the given iterator. |
protected java.util.List |
getConfirmedList()Returns the confirmed field cast to a TestList.BulkTestSubList. |
protected java.util.List |
getList()Returns the collection field cast to a TestList.BulkTestSubList. |
protected java.util.Collection |
makeCollection()Returns makeEmptyList(). |
protected java.util.Collection |
makeConfirmedCollection()Returns an empty ArrayList. |
protected java.util.Collection |
makeConfirmedFullCollection()Returns a full ArrayList. |
protected abstract java.util.List |
makeEmptyList()Return a new, empty TestList.BulkTestSubList to be used for testing. |
protected java.util.Collection |
makeFullCollection()Returns makeFullList(). |
protected java.util.List |
makeFullList()Return a new, full TestList.BulkTestSubList to be used for testing. |
void |
testEmptyListCompatibility()Compare the current serialized form of the List against the canonical version in CVS. |
void |
testEmptyListSerialization() |
void |
testFullListCompatibility()Compare the current serialized form of the List against the canonical version in CVS. |
void |
testFullListSerialization() |
void |
testListAddByIndex()Tests List#add(int,Object). |
void |
testListAddByIndexBoundsChecking()Tests bounds checking for List#add(int, Object) on an empty list. |
void |
testListAddByIndexBoundsChecking2()Tests bounds checking for List#add(int, Object) on a full list. |
void |
testListEquals()Tests Object.equals(Object). |
void |
testListGetByIndex()Tests List#get(int). |
void |
testListGetByIndexBoundsChecking()Tests bounds checking for List#get(int) on an empty list. |
void |
testListGetByIndexBoundsChecking2()Tests bounds checking for List#get(int) on a full list. |
void |
testListHashCode()Tests Object.hashCode(). |
void |
testListIndexOf()Tests List#indexOf(). |
void |
testListIteratorAdd()Tests the ListIterator.add(Object) method of the list iterator. |
void |
testListIteratorSet()Tests the ListIterator.set(Object) method of the list iterator. |
void |
testListLastIndexOf()Tests List#lastIndexOf(). |
void |
testListListIterator()Tests the read-only bits of List#listIterator(). |
void |
testListListIteratorByIndex()Tests the read-only bits of List#listIterator(int). |
void |
testListRemoveByIndex()Tests List#remove(int). |
void |
testListRemoveByIndexBoundsChecking()Tests bounds checking for List#remove(int) on an empty list. |
void |
testListRemoveByIndexBoundsChecking2()Tests bounds checking for List#remove(int) on a full list. |
void |
testListSetByIndex()Test List#set(int,Object). |
void |
testListSetByIndexBoundsChecking()Tests bounds checking for List#set(int,Object) on an empty list. |
void |
testListSetByIndexBoundsChecking2()Tests bounds checking for List#set(int,Object) on a full list. |
void |
testListSubListFailFastOnAdd()Tests that a sublist raises a ConcurrentModificationException if elements are added to the original list. |
void |
testListSubListFailFastOnRemove()Tests that a sublist raises a ConcurrentModificationException if elements are removed from the original list. |
protected void |
verify()Verifies that the test list implementation matches the confirmed list implementation. |
| Methods inherited from class org.apache.commons.collections.BulkTest |
clone, ignoredSimpleTests, makeSuite, toString |
| Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, setUp, tearDown |
| Methods inherited from class junit.framework.Assert |
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public TestList(java.lang.String testName)
| Method Detail |
protected abstract java.util.List makeEmptyList()
TestList.BulkTestSubList to be used for testing.
protected java.util.List makeFullList()
TestList.BulkTestSubList to be used for testing.
protected final java.util.Collection makeCollection()
makeEmptyList().
makeCollection in class TestCollectionprotected final java.util.Collection makeFullCollection()
makeFullList().
makeFullCollection in class TestCollectionprotected java.util.List getList()
collection field cast to a TestList.BulkTestSubList.
protected java.util.List getConfirmedList()
confirmed field cast to a TestList.BulkTestSubList.
public void testListAddByIndexBoundsChecking()
List#add(int, Object) on an empty list.
public void testListAddByIndexBoundsChecking2()
List#add(int, Object) on a full list.
public void testListAddByIndex()
List#add(int,Object).
public void testListEquals()
Object.equals(Object).
public void testListHashCode()
Object.hashCode().
public void testListGetByIndex()
List#get(int).
public void testListGetByIndexBoundsChecking()
List#get(int) on an empty list.
public void testListGetByIndexBoundsChecking2()
List#get(int) on a full list.
public void testListIndexOf()
List#indexOf().
public void testListLastIndexOf()
List#lastIndexOf().
public void testListSetByIndexBoundsChecking()
List#set(int,Object) on an empty list.
public void testListSetByIndexBoundsChecking2()
List#set(int,Object) on a full list.
public void testListSetByIndex()
List#set(int,Object).
public void testListRemoveByIndexBoundsChecking()
List#remove(int) on an empty list.
public void testListRemoveByIndexBoundsChecking2()
List#remove(int) on a full list.
public void testListRemoveByIndex()
List#remove(int).
public void testListListIterator()
List#listIterator().
public void testListListIteratorByIndex()
List#listIterator(int).
private void forwardTest(java.util.ListIterator iter,
int i)
iter - the iterator to traversei - the starting index
private void backwardTest(java.util.ListIterator iter,
int i)
iter - the iterator to traversei - the starting indexpublic void testListIteratorAdd()
ListIterator.add(Object) method of the list iterator.
public void testListIteratorSet()
ListIterator.set(Object) method of the list iterator.
public void testEmptyListSerialization()
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundException
public void testFullListSerialization()
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundException
public void testEmptyListCompatibility()
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundException
public void testFullListCompatibility()
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionprotected java.util.Collection makeConfirmedCollection()
ArrayList.
makeConfirmedCollection in class TestCollectionprotected java.util.Collection makeConfirmedFullCollection()
ArrayList.
makeConfirmedFullCollection in class TestCollectionprotected void verify()
verify in class TestCollectionpublic BulkTest bulkTestSubList()
BulkTest for testing List#subList(int,int). The returned bulk test will run through every TestList method, including another bulkTestSubList. Sublists are tested until the size of the sublist is less than 10. Each sublist is 6 elements smaller than its parent list. (By default this means that two rounds of sublists will be tested). The verify() method is overloaded to test that the original list is modified when the sublist is.
public void testListSubListFailFastOnAdd()
ConcurrentModificationException if elements are added to the original list.
public void testListSubListFailFastOnRemove()
ConcurrentModificationException if elements are removed from the original list.
protected void failFastAll(java.util.List list)
ConcurrentModificationException.
protected void failFastMethod(java.util.List list,
java.lang.reflect.Method m)
ConcurrentModificationException. Unless the method happens to be the equals() method, in which case the test is skipped. There seems to be a bug in java.util.AbstractList.subList(int,int).equals(Object) -- it never raises a ConcurrentModificationException.
list - the sublist to testm - the method to invoke
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||