org.apache.commons.collections.iterators
Class AbstractTestListIterator

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.collections.BulkTest
              extended by org.apache.commons.collections.AbstractTestObject
                  extended by org.apache.commons.collections.iterators.AbstractTestIterator
                      extended by org.apache.commons.collections.iterators.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

Field Summary
 
Fields inherited from class org.apache.commons.collections.AbstractTestObject
COLLECTIONS_MAJOR_VERSION
 
Constructor Summary
AbstractTestListIterator(java.lang.String testName)
          JUnit constructor.
 
Method Summary
 java.lang.Object addSetValue()
          The value to be used in the add and set tests.
 java.util.Iterator makeEmptyIterator()
          Implements the abstract superclass method to return the list iterator.
abstract  java.util.ListIterator makeEmptyListIterator()
          Implement this method to return a list iterator over an empty collection.
 java.util.Iterator makeFullIterator()
          Implements the abstract superclass method to return the list iterator.
abstract  java.util.ListIterator makeFullListIterator()
          Implement this method to return a list iterator over a collection with elements.
 boolean supportsAdd()
          Whether or not we are testing an iterator that supports add().
 boolean supportsSet()
          Whether or not we are testing an iterator that supports set().
 void testAdd()
          Test add behaviour.
 void testAddThenRemove()
          Test remove after add behaviour.
 void testAddThenSet()
           
 void testEmptyListIteratorIsIndeedEmpty()
          Test that the empty list iterator contract is correct.
 void testRemoveThenSet()
           
 void testSet()
          Test set behaviour.
 void testWalkForwardAndBack()
          Test navigation through the iterator.
 
Methods inherited from class org.apache.commons.collections.iterators.AbstractTestIterator
makeObject, supportsEmptyIterator, supportsFullIterator, supportsRemove, testEmptyIterator, testFullIterator, testRemove, verify
 
Methods inherited from class org.apache.commons.collections.AbstractTestObject
getCanonicalEmptyCollectionName, getCanonicalFullCollectionName, getCompatibilityVersion, isEqualsCheckable, isTestSerialization, readExternalFormFromBytes, readExternalFormFromDisk, skipSerializedCanonicalTests, supportsEmptyCollections, supportsFullCollections, testCanonicalEmptyCollectionExists, testCanonicalFullCollectionExists, testEqualsNull, testObjectEqualsSelf, testObjectHashCodeEqualsContract, testObjectHashCodeEqualsSelfHashCode, testSerializeDeserializeThenCompare, testSimpleSerialization, writeExternalFormToBytes, writeExternalFormToDisk
 
Methods inherited from class org.apache.commons.collections.BulkTest
clone, ignoredTests, makeSuite, toString
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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.



Copyright © 2001-2010 Apache Software Foundation. All Rights Reserved.