Class ListIteratorTester<E>
java.lang.Object
com.google.common.collect.testing.AbstractIteratorTester<E,ListIterator<E>>
com.google.common.collect.testing.ListIteratorTester<E>
A utility similar to
IteratorTester for testing a ListIterator against a known
good reference implementation. As with IteratorTester, a concrete subclass must provide
target iterators on demand. It also requires three additional constructor parameters:
elementsToInsert, the elements to be passed to set() and add() calls;
features, the features supported by the iterator; and expectedElements, the elements the
iterator should return in order.
The items in elementsToInsert will be repeated if steps is larger than the
number of provided elements.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.collect.testing.AbstractIteratorTester
AbstractIteratorTester.KnownOrder, AbstractIteratorTester.MultiExceptionListIterator, AbstractIteratorTester.Stimulus<E,T extends Iterator<E>> -
Field Summary
Fields inherited from class com.google.common.collect.testing.AbstractIteratorTester
add, hasNext, hasPrevious, next, nextIndex, previous, previousIndex, remove, set -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedListIteratorTester(int steps, Iterable<E> elementsToInsert, Iterable<? extends IteratorFeature> features, Iterable<E> expectedElements, int startIndex) -
Method Summary
Modifier and TypeMethodDescriptionprotected final Iterable<? extends AbstractIteratorTester.Stimulus<E, ? super ListIterator<E>>> I'd like to make this a parameter to the constructor, but I can't because the stimulus instances refer tothis.protected abstract ListIterator<E> Returns a new target iterator each time it's called.Methods inherited from class com.google.common.collect.testing.AbstractIteratorTester
iteratorStimuli, listIteratorStimuli, test, testForEachRemaining, verify
-
Constructor Details
-
ListIteratorTester
-
-
Method Details
-
getStimulusValues
protected final Iterable<? extends AbstractIteratorTester.Stimulus<E,? super ListIterator<E>>> getStimulusValues()Description copied from class:AbstractIteratorTesterI'd like to make this a parameter to the constructor, but I can't because the stimulus instances refer tothis.- Specified by:
getStimulusValuesin classAbstractIteratorTester<E,ListIterator<E>>
-
newTargetIterator
Description copied from class:AbstractIteratorTesterReturns a new target iterator each time it's called. This is the iterator you are trying to test. This must return an Iterator that returns the expected elements passed to the constructor in the given order. Warning: it is not enough to simply pull multiple iterators from the same source Iterable, unless that Iterator is unmodifiable.- Specified by:
newTargetIteratorin classAbstractIteratorTester<E,ListIterator<E>>
-