Class ListIteratorTester<E>


  • public abstract class ListIteratorTester<E>
    extends AbstractIteratorTester<E,​java.util.ListIterator<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.

    • 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

      • 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 class AbstractIteratorTester<E,​java.util.ListIterator<E>>