|
|||||||||
| 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.IteratorTest<B>
net.sf.molae.pipe.test.ListIteratorTest<B,E>
public class ListIteratorTest<B extends ListIterator<E>,E>
Test methods to check the contract of list iterator implementing classes.
| Constructor Summary | |
|---|---|
protected |
ListIteratorTest(B testObject,
List<E> list,
int index)
Creates a new test with the specified candidate. |
| Method Summary | ||
|---|---|---|
void |
assertConsistency()
Checks consistency of list iterator without moving the cursor. |
|
protected void |
assertUnmodifying()
Calls all modifying methods of the underlying iterator and checks if they throw an UnsupportedOperationException. |
|
protected void |
checkConsistency()
This method is called at the start of the test cycle and after each modification of the test object. |
|
protected void |
modifyAtStartTest()
Asserts that a call of set before
next throws an
IllegalStateException. |
|
protected static
|
newInstance(List<E> list)
Creates a new test from the specified base list. |
|
protected static
|
newInstance(List<E> list,
int index)
Creates a new test from the specified base list. |
|
protected void |
performCycle()
Calls set,
remove and
add. |
|
protected void |
readTest()
Performs all tests that do not change the collection underlying the iterator. |
|
| Methods inherited from class net.sf.molae.pipe.test.IteratorTest |
|---|
getInstance |
| 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 ListIteratorTest(B testObject,
List<E> list,
int index)
testObject - the candidate of the test
NullPointerException - if the specified test objects is
null.| Method Detail |
|---|
protected static <E> ListIteratorTest<ListIterator<E>,E> newInstance(List<E> list)
list - the base list of the list iterator to test
NullPointerException - if the specified test objects is
null.
protected static <E> ListIteratorTest<ListIterator<E>,E> newInstance(List<E> list,
int index)
list - the base list of the list iterator to testindex - index of first element to be returned from the list
iterator (by a call to the next method).
IndexOutOfBoundsException - index < 0 || index > size() of base list.
NullPointerException - if the specified test objects is
null.public void assertConsistency()
assertConsistency in class ObjectTest<B extends ListIterator<E>>AssertionFailedError - if the test object does not pass the test.protected void assertUnmodifying()
UnsupportedOperationException.
assertUnmodifying in class IteratorTest<B extends ListIterator<E>>AssertionFailedError - if any of the called operations
did not throw an UnsupportedOperationExceptionprotected void readTest()
IteratorTestnext at the end throws an
NoSuchElementException.
readTest in class IteratorTest<B extends ListIterator<E>>protected void checkConsistency()
readTest().
AssertionFailedError - if the test object is not consistent.protected void performCycle()
set,
remove and
add.
AssertionFailedError - if the test object is not consistent.
UnsupportedOperationException - if any of the called methods
is not implemented.protected void modifyAtStartTest()
set before
next throws an
IllegalStateException.
modifyAtStartTest in class IteratorTest<B extends ListIterator<E>>AssertionFailedError - if the test object does not pass the test.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||