Class ListIteratorTester<E>
- java.lang.Object
-
- com.google.common.collect.testing.AbstractIteratorTester<E,java.util.ListIterator<E>>
-
- com.google.common.collect.testing.ListIteratorTester<E>
-
@GwtCompatible public abstract class ListIteratorTester<E> extends AbstractIteratorTester<E,java.util.ListIterator<E>>
A utility similar toIteratorTester
for testing aListIterator
against a known good reference implementation. As withIteratorTester
, a concrete subclass must provide target iterators on demand. It also requires three additional constructor parameters:elementsToInsert
, the elements to be passed toset()
andadd()
calls;features
, the features supported by the iterator; andexpectedElements
, the elements the iterator should return in order.The items in
elementsToInsert
will be repeated ifsteps
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 java.util.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
Constructors Modifier Constructor Description protected
ListIteratorTester(int steps, java.lang.Iterable<E> elementsToInsert, java.lang.Iterable<? extends IteratorFeature> features, java.lang.Iterable<E> expectedElements, int startIndex)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.lang.Iterable<? extends AbstractIteratorTester.Stimulus<E,? super java.util.ListIterator<E>>>
getStimulusValues()
I'd like to make this a parameter to the constructor, but I can't because the stimulus instances refer tothis
.protected abstract java.util.ListIterator<E>
newTargetIterator()
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 Detail
-
ListIteratorTester
protected ListIteratorTester(int steps, java.lang.Iterable<E> elementsToInsert, java.lang.Iterable<? extends IteratorFeature> features, java.lang.Iterable<E> expectedElements, int startIndex)
-
-
Method Detail
-
getStimulusValues
protected final java.lang.Iterable<? extends AbstractIteratorTester.Stimulus<E,? super java.util.ListIterator<E>>> getStimulusValues()
Description copied from class:AbstractIteratorTester
I'd like to make this a parameter to the constructor, but I can't because the stimulus instances refer tothis
.- Specified by:
getStimulusValues
in classAbstractIteratorTester<E,java.util.ListIterator<E>>
-
newTargetIterator
protected abstract java.util.ListIterator<E> newTargetIterator()
Description copied from class:AbstractIteratorTester
Returns 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:
newTargetIterator
in classAbstractIteratorTester<E,java.util.ListIterator<E>>
-
-