org.apache.commons.collections.iterators

Class AbstractTestListIterator


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 Summary

AbstractTestListIterator(String testName)
JUnit constructor.

Method Summary

Object
addSetValue()
The value to be used in the add and set tests.
Iterator
makeEmptyIterator()
Implements the abstract superclass method to return the list iterator.
abstract ListIterator
makeEmptyListIterator()
Implement this method to return a list iterator over an empty collection.
Iterator
makeFullIterator()
Implements the abstract superclass method to return the list iterator.
abstract 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.

Constructor Details

AbstractTestListIterator

public AbstractTestListIterator(String testName)
JUnit constructor.
Parameters:
testName - the test class name

Method Details

addSetValue

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

makeEmptyIterator

public Iterator makeEmptyIterator()
Implements the abstract superclass method to return the list iterator.
Returns:
an empty iterator

makeEmptyListIterator

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

makeFullIterator

public Iterator makeFullIterator()
Implements the abstract superclass method to return the list iterator.
Returns:
a full iterator

makeFullListIterator

public abstract ListIterator makeFullListIterator()
Implement this method to return a list iterator over a collection with elements.
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

testAdd

public void testAdd()
Test add behaviour.

testAddThenRemove

public void testAddThenRemove()
Test remove after add behaviour.

testAddThenSet

public void testAddThenSet()

testEmptyListIteratorIsIndeedEmpty

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

testRemoveThenSet

public void testRemoveThenSet()

testSet

public void testSet()
Test set behaviour.

testWalkForwardAndBack

public void testWalkForwardAndBack()
Test navigation through the iterator.

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