net.sf.molae.pipe.test
Class IteratorTest
java.lang.Object
|
+--junit.framework.Assert
|
+--net.sf.molae.pipe.test.ObjectTest
|
+--net.sf.molae.pipe.test.IteratorTest
- Direct Known Subclasses:
- ListIteratorTest
- public class IteratorTest
- extends ObjectTest
Test methods to check the contract of iterator implementing classes.
|
Constructor Summary |
protected |
IteratorTest(Iterator testObject)
Creates a new test with the specified candidate. |
| 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 |
IteratorTest
protected IteratorTest(Iterator testObject)
- Creates a new test with the specified candidate.
- Parameters:
testObject - the candidate of the test- Throws:
NullPointerException - if the specified test objects is
null.
assertUnmodifying
protected void assertUnmodifying()
- Calls all modifying methods of the underlying iterator and
checks if they throw an
UnsupportedOperationException.
- Throws:
AssertionFailedError - if any of the called operations
did not throw an UnsupportedOperationException
readTest
protected void readTest()
- Performs all tests that do not change the collection underlying
the iterator.
For a simple iterator this is testing that trying to call
next at the end throws an
NoSuchElementException.
- Throws:
AssertionFailedError - if the test object does not pass the test.NoSuchElementException - if next() returns no
element although hasNext() was true.
modifyAtStartTest
protected void modifyAtStartTest()
- Asserts that a call of
remove before
next throws an
IllegalStateException.
- Throws:
AssertionFailedError - if the test object does not pass the test.