|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.junit.Assert
net.sf.molae.pipe.test.ObjectTest<B>
net.sf.molae.pipe.test.CollectionTest<B,E>
net.sf.molae.pipe.test.ListTest<B,E>
public class ListTest<B extends List<E>,E>
Test methods to check the contract of list implementing classes.
| Nested Class Summary | |
|---|---|
static class |
ListTest.SubListTest<E>
Test methods to check the contract of sub lists. |
| Constructor Summary | |
|---|---|
protected |
ListTest(B testObject)
Creates a new test with the specified candidate. |
| Method Summary | ||
|---|---|---|
void |
assertConsistency()
Checks consistency of all reading list methods. |
|
void |
assertImmutability()
Calls all modifying methods of the underlying list and checks if they throw an UnsupportedOperationException. |
|
protected void |
assertValidArray(String message,
Object[] a)
Checks if the specified array is a valid result of the toArray() or
toArray(Object[])
operation, respectively. |
|
protected void |
checkAddAll(String message,
List<E> l)
This implementation uses List.equals(Object). |
|
static
|
getInstance(List<E> testObject)
Creates a new instance of this class with the specified testObject as test object. |
|
void |
performCycle()
Checks consistency of all list methods. |
|
protected void |
performCycle(int index,
E subst)
Checks consistency of all list methods. |
|
| Methods inherited from class net.sf.molae.pipe.test.CollectionTest |
|---|
assertAddProhibited, assertEqualContent, assertEqualSequence, checkConsistency, getInstance, getTestValue, performBulkCycle, performIntegerTest, performValuesTest, setIntegerTestValues, setTestValues |
| Methods inherited from class net.sf.molae.pipe.test.ObjectTest |
|---|
assertFalse, assertTestValuesSet, getTestObject, setTestValuesSet, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected ListTest(B testObject)
testObject - the candidate of the test
NullPointerException - if the specified test objects is
null.| Method Detail |
|---|
public static final <E> ListTest<List<E>,E> getInstance(List<E> testObject)
testObject - the candidate of the test
NullPointerException - if the specified test objects is
null.
protected void checkAddAll(String message,
List<E> l)
List.equals(Object).
checkAddAll in class CollectionTest<B extends List<E>,E>message - the message to be displayed if the assertion failsl - the list to compare
AssertionFailedError - if the specified list is not equal to the
test object.
protected void assertValidArray(String message,
Object[] a)
Checks if the specified array is a valid result of the
toArray() or
toArray(Object[])
operation, respectively.
This implementation uses List.equals(Object).
assertValidArray in class CollectionTest<B extends List<E>,E>message - the message to be displayed if the assertion failsa - the result of a toArray() operation.
AssertionFailedError - if the specified array is not a valid
result.public void assertConsistency()
assertConsistency in class CollectionTest<B extends List<E>,E>AssertionFailedError - if the list contract is broken by
the tested list.public void assertImmutability()
UnsupportedOperationException.
assertImmutability in class CollectionTest<B extends List<E>,E>AssertionFailedError - if any of the called operations
did not throw an UnsupportedOperationException
protected void performCycle(int index,
E subst)
index - the index of the element that is testedsubst - a value to which the list entry is set during the cycle.
AssertionFailedError - if the list contract is broken by
the specified list.
UnsupportedOperationException - if any of the called
methods is not implemented.public void performCycle()
performCycle in class CollectionTest<B extends List<E>,E>AssertionFailedError - if the list contract is broken by
the specified list.
UnsupportedOperationException - if any of the called
methods is not implemented.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||