org.apache.commons.collections.iterators
Class AbstractTestIterator

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
All Implemented Interfaces:
java.lang.Cloneable, junit.framework.Test
Direct Known Subclasses:
AbstractTestListIterator, AbstractTestMapIterator

public abstract class AbstractTestIterator
extends AbstractTestObject

Abstract class for testing the Iterator interface.

This class provides a framework for testing an implementation of Iterator. Concrete subclasses must provide the iterator to be tested. They must also specify certain details of how the 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
AbstractTestIterator(java.lang.String testName)
          JUnit constructor.
 
Method Summary
abstract  java.util.Iterator makeEmptyIterator()
          Implement this method to return an iterator over an empty collection.
abstract  java.util.Iterator makeFullIterator()
          Implement this method to return an iterator over a collection with elements.
 java.lang.Object makeObject()
          Implements the abstract superclass method to return the full iterator.
 boolean supportsEmptyIterator()
          Whether or not we are testing an iterator that can be empty.
 boolean supportsFullIterator()
          Whether or not we are testing an iterator that can contain elements.
 boolean supportsRemove()
          Whether or not we are testing an iterator that supports remove().
 void testEmptyIterator()
          Test the empty iterator.
 void testFullIterator()
          Test normal iteration behaviour.
 void testRemove()
          Test remove behaviour.
 void verify()
          Allows subclasses to add complex cross verification
 
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

AbstractTestIterator

public AbstractTestIterator(java.lang.String testName)
JUnit constructor.

Parameters:
testName - the test class name
Method Detail

makeEmptyIterator

public abstract java.util.Iterator makeEmptyIterator()
Implement this method to return an iterator over an empty collection.

Returns:
an empty iterator

makeFullIterator

public abstract java.util.Iterator makeFullIterator()
Implement this method to return an iterator over a collection with elements.

Returns:
a full iterator

makeObject

public java.lang.Object makeObject()
Implements the abstract superclass method to return the full iterator.

Specified by:
makeObject in class AbstractTestObject
Returns:
a full iterator

supportsEmptyIterator

public boolean supportsEmptyIterator()
Whether or not we are testing an iterator that can be empty. Default is true.

Returns:
true if Iterator can be empty

supportsFullIterator

public boolean supportsFullIterator()
Whether or not we are testing an iterator that can contain elements. Default is true.

Returns:
true if Iterator can be full

supportsRemove

public boolean supportsRemove()
Whether or not we are testing an iterator that supports remove(). Default is true.

Returns:
true if Iterator supports remove

verify

public void verify()
Allows subclasses to add complex cross verification


testEmptyIterator

public void testEmptyIterator()
Test the empty iterator.


testFullIterator

public void testFullIterator()
Test normal iteration behaviour.


testRemove

public void testRemove()
Test remove behaviour.



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