Class AbstractTestListIterator

  • All Implemented Interfaces:
    java.lang.Cloneable, junit.framework.Test
    Direct Known Subclasses:
    AbstractTestList.TestListIterator

    public abstract class AbstractTestListIterator
    extends AbstractTestIterator
    Abstract class for testing the ListIterator interface.

    This class provides a framework for testing an implementation of ListIterator. Concrete subclasses must provide the list iterator to be tested. They must also specify certain details of how the list iterator operates by overriding the supportsXxx() methods if necessary.

    Since:
    Commons Collections 3.0
    • Constructor Detail

      • AbstractTestListIterator

        public AbstractTestListIterator​(java.lang.String testName)
        JUnit constructor.
        Parameters:
        testName - the test class name
    • Method Detail

      • makeEmptyListIterator

        public abstract java.util.ListIterator makeEmptyListIterator()
        Implement this method to return a list iterator over an empty collection.
        Returns:
        an empty iterator
      • makeFullListIterator

        public abstract java.util.ListIterator makeFullListIterator()
        Implement this method to return a list iterator over a collection with elements.
        Returns:
        a full iterator
      • makeEmptyIterator

        public java.util.Iterator makeEmptyIterator()
        Implements the abstract superclass method to return the list iterator.
        Specified by:
        makeEmptyIterator in class AbstractTestIterator
        Returns:
        an empty iterator
      • makeFullIterator

        public java.util.Iterator makeFullIterator()
        Implements the abstract superclass method to return the list iterator.
        Specified by:
        makeFullIterator in class AbstractTestIterator
        Returns:
        a full iterator
      • supportsAdd

        public boolean supportsAdd()
        Whether or not we are testing an iterator that supports add(). Default is true.
        Returns:
        true if Iterator supports add
      • supportsSet

        public boolean supportsSet()
        Whether or not we are testing an iterator that supports set(). Default is true.
        Returns:
        true if Iterator supports set
      • addSetValue

        public java.lang.Object addSetValue()
        The value to be used in the add and set tests. Default is null.
      • testEmptyListIteratorIsIndeedEmpty

        public void testEmptyListIteratorIsIndeedEmpty()
        Test that the empty list iterator contract is correct.
      • testWalkForwardAndBack

        public void testWalkForwardAndBack()
        Test navigation through the iterator.
      • testAdd

        public void testAdd()
        Test add behaviour.
      • testSet

        public void testSet()
        Test set behaviour.
      • testRemoveThenSet

        public void testRemoveThenSet()
      • testAddThenSet

        public void testAddThenSet()
      • testAddThenRemove

        public void testAddThenRemove()
        Test remove after add behaviour.