Rename TestIterator to AbstractTestIterator

Rename TestListIterator to AbstractTestListIterator
Add extra tests


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131210 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-10-01 21:54:56 +00:00
parent 21fb588f46
commit dd7f7aca14
40 changed files with 646 additions and 437 deletions

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/Attic/TestIterator.java,v 1.5 2003/08/31 17:28:40 scolebourne Exp $
* $Revision: 1.5 $
* $Date: 2003/08/31 17:28:40 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/AbstractTestIterator.java,v 1.1 2003/10/01 21:54:54 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -64,122 +61,166 @@ import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.commons.collections.TestObject;
/**
* Base class for testing Iterator interface
* Abstract class for testing the Iterator interface.
* <p>
* 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
* @version $Revision: 1.1 $ $Date: 2003/10/01 21:54:54 $
*
* @author Morgan Delagrange
* @author Stephen Colebourne
*/
public abstract class TestIterator extends TestObject {
public abstract class AbstractTestIterator extends TestObject {
public TestIterator(String testName) {
/**
* JUnit constructor.
*
* @param testName the test class name
*/
public AbstractTestIterator(String testName) {
super(testName);
}
public abstract Iterator makeEmptyIterator();
public abstract Iterator makeFullIterator();
//-----------------------------------------------------------------------
/**
* Implement this method to return an iterator over an empty collection.
*
* @return an empty iterator
*/
protected abstract Iterator makeEmptyIterator();
/**
* Whether or not we are testing an iterator that can be
* empty. Default is true.
* Implement this method to return an iterator over a collection with elements.
*
* @return true if Iterators can be empty
* @return a full iterator
*/
public boolean supportsEmptyIterator() {
protected abstract Iterator makeFullIterator();
/**
* Implements the abstract superclass method to return the full iterator.
*
* @return a full iterator
*/
protected Object makeObject() {
return makeFullIterator();
}
/**
* Whether or not we are testing an iterator that can be empty.
* Default is true.
*
* @return true if Iterator can be empty
*/
protected boolean supportsEmptyIterator() {
return true;
}
/**
* Whether or not we are testing an iterator that can contain
* elements. Default is true.
* Whether or not we are testing an iterator that can contain elements.
* Default is true.
*
* @return true if Iterators can be empty
* @return true if Iterator can be full
*/
public boolean supportsFullIterator() {
protected boolean supportsFullIterator() {
return true;
}
/**
* Whether or not we are testing an iterator that supports
* remove(). Default is true.
* Whether or not we are testing an iterator that supports remove().
* Default is true.
*
* @return true if Iterators can be empty
* @return true if Iterator supports remove
*/
public boolean supportsRemove() {
protected boolean supportsRemove() {
return true;
}
//-----------------------------------------------------------------------
/**
* Should throw a NoSuchElementException.
* Test the empty iterator.
*/
public void testEmptyIterator() {
if (supportsEmptyIterator() == false) {
return;
}
Iterator iter = makeEmptyIterator();
assertTrue("hasNext() should return false for empty iterators", iter.hasNext() == false);
Iterator it = makeEmptyIterator();
// hasNext() should return false
assertEquals("hasNext() should return false for empty iterators", false, it.hasNext());
// next() should throw a NoSuchElementException
try {
iter.next();
it.next();
fail("NoSuchElementException must be thrown when Iterator is exhausted");
} catch (NoSuchElementException e) {
}
}
/**
* NoSuchElementException (or any other exception)
* should not be thrown for the first element.
* NoSuchElementException must be thrown when
* hasNext() returns false
* Test normal iteration behaviour.
*/
public void testFullIterator() {
if (supportsFullIterator() == false) {
return;
}
Iterator iter = makeFullIterator();
Iterator it = makeFullIterator();
assertTrue("hasNext() should return true for at least one element", iter.hasNext());
// hasNext() must be true (ensure makeFullIterator is correct!)
assertEquals("hasNext() should return true for at least one element", true, it.hasNext());
// next() must not throw exception (ensure makeFullIterator is correct!)
try {
iter.next();
it.next();
} catch (NoSuchElementException e) {
fail("Full iterators must have at least one element");
}
while (iter.hasNext()) {
iter.next();
// iterate through
while (it.hasNext()) {
it.next();
}
// next() must throw NoSuchElementException now
try {
iter.next();
it.next();
fail("NoSuchElementException must be thrown when Iterator is exhausted");
} catch (NoSuchElementException e) {
}
}
/**
* Test remove
* Test remove behaviour.
*/
public void testRemove() {
Iterator it = makeFullIterator();
if (supportsRemove() == false) {
// check for UnsupportedOperationException if not supported
try {
it.remove();
} catch (UnsupportedOperationException ex) {}
return;
}
// should throw IllegalStateException before next() called
try {
it.remove();
fail();
} catch (IllegalStateException ex) {}
// remove after next should be fine
it.next();
it.remove();
// should throw IllegalStateException for second remove()
try {
it.remove();
fail();

View File

@ -0,0 +1,312 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/AbstractTestListIterator.java,v 1.1 2003/10/01 21:54:54 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.collections.iterators;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.NoSuchElementException;
/**
* Abstract class for testing the ListIterator interface.
* <p>
* 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
* @version $Revision: 1.1 $ $Date: 2003/10/01 21:54:54 $
*
* @author Rodney Waldhoff
* @author Stephen Colebourne
*/
public abstract class AbstractTestListIterator extends AbstractTestIterator {
/**
* JUnit constructor.
*
* @param testName the test class name
*/
public AbstractTestListIterator(String testName) {
super(testName);
}
//-----------------------------------------------------------------------
/**
* Implement this method to return a list iterator over an empty collection.
*
* @return an empty iterator
*/
protected abstract ListIterator makeEmptyListIterator();
/**
* Implement this method to return a list iterator over a collection with elements.
*
* @return a full iterator
*/
protected abstract ListIterator makeFullListIterator();
/**
* Implements the abstract superclass method to return the list iterator.
*
* @return an empty iterator
*/
protected Iterator makeEmptyIterator() {
return makeEmptyListIterator();
}
/**
* Implements the abstract superclass method to return the list iterator.
*
* @return a full iterator
*/
protected Iterator makeFullIterator() {
return makeFullListIterator();
}
/**
* Whether or not we are testing an iterator that supports add().
* Default is true.
*
* @return true if Iterator supports add
*/
protected boolean supportsAdd() {
return true;
}
/**
* Whether or not we are testing an iterator that supports set().
* Default is true.
*
* @return true if Iterator supports set
*/
protected boolean supportsSet() {
return true;
}
/**
* The value to be used in the add and set tests.
* Default is null.
*/
protected Object addSetValue() {
return null;
}
//-----------------------------------------------------------------------
/**
* Test that the empty list iterator contract is correct.
*/
public void testEmptyListIteratorIsIndeedEmpty() {
if (supportsEmptyIterator() == false) {
return;
}
ListIterator it = makeEmptyListIterator();
assertEquals(false, it.hasNext());
assertEquals(0, it.nextIndex());
assertEquals(false, it.hasPrevious());
assertEquals(-1, it.previousIndex());
// next() should throw a NoSuchElementException
try {
it.next();
fail("NoSuchElementException must be thrown from empty ListIterator");
} catch (NoSuchElementException e) {
}
// previous() should throw a NoSuchElementException
try {
it.previous();
fail("NoSuchElementException must be thrown from empty ListIterator");
} catch (NoSuchElementException e) {
}
}
/**
* Test navigation through the iterator.
*/
public void testWalkForwardAndBack() {
ArrayList list = new ArrayList();
ListIterator it = makeFullListIterator();
while (it.hasNext()) {
list.add(it.next());
}
// check state at end
assertEquals(false, it.hasNext());
assertEquals(true, it.hasPrevious());
try {
it.next();
fail("NoSuchElementException must be thrown from next at end of ListIterator");
} catch (NoSuchElementException e) {
}
// loop back through comparing
for (int i = list.size() - 1; i >= 0; i--) {
assertEquals(i + 1, it.nextIndex());
assertEquals(i, it.previousIndex());
Object obj = list.get(i);
assertEquals(obj, it.previous());
}
// check state at start
assertEquals(true, it.hasNext());
assertEquals(false, it.hasPrevious());
try {
it.previous();
fail("NoSuchElementException must be thrown from previous at start of ListIterator");
} catch (NoSuchElementException e) {
}
}
/**
* Test add behaviour.
*/
public void testAdd() {
ListIterator it = makeFullListIterator();
if (supportsAdd() == false) {
// check for UnsupportedOperationException if not supported
try {
it.add(addSetValue());
} catch (UnsupportedOperationException ex) {}
return;
}
// add at start should be OK
it.add(addSetValue());
// add in middle and at end should be OK
while (it.hasNext()) {
it.next();
it.add(addSetValue());
}
}
/**
* Test set behaviour.
*/
public void testSet() {
ListIterator it = makeFullListIterator();
if (supportsSet() == false) {
// check for UnsupportedOperationException if not supported
try {
it.set(addSetValue());
} catch (UnsupportedOperationException ex) {}
return;
}
// should throw IllegalStateException before next() called
try {
it.set(addSetValue());
fail();
} catch (IllegalStateException ex) {}
// set after next should be fine
it.next();
it.set(addSetValue());
// repeated set calls should be fine
it.set(addSetValue());
// remove then set
if (supportsRemove()) {
it.next();
it.remove();
try {
it.set(addSetValue());
fail("IllegalStateException must be thrown from set after remove");
} catch (IllegalStateException e) {
}
}
// add then set
if (supportsAdd()) {
it.next();
it.add(addSetValue());
try {
it.set(addSetValue());
fail("IllegalStateException must be thrown from set after add");
} catch (IllegalStateException e) {
}
}
}
/**
* Test remove after add behaviour.
*/
public void testRemoveAfterAdd() {
ListIterator it = makeFullListIterator();
// add then remove
if (supportsAdd() && supportsRemove()) {
it.next();
it.add(addSetValue());
try {
it.remove();
fail("IllegalStateException must be thrown from remove after add");
} catch (IllegalStateException e) {
}
}
}
}

View File

@ -1,7 +1,7 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestAll.java,v 1.5 2003/08/31 17:28:40 scolebourne Exp $
* $Revision: 1.5 $
* $Date: 2003/08/31 17:28:40 $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestAll.java,v 1.6 2003/10/01 21:54:54 scolebourne Exp $
* $Revision: 1.6 $
* $Date: 2003/10/01 21:54:54 $
*
* ====================================================================
*
@ -68,7 +68,7 @@ import junit.framework.TestSuite;
/**
* Entry point for all Collections tests.
* @author Rodney Waldhoff
* @version $Id: TestAll.java,v 1.5 2003/08/31 17:28:40 scolebourne Exp $
* @version $Id: TestAll.java,v 1.6 2003/10/01 21:54:54 scolebourne Exp $
*/
public class TestAll extends TestCase {
public TestAll(String testName) {
@ -83,6 +83,7 @@ public class TestAll extends TestCase {
suite.addTest(TestArrayListIterator2.suite());
suite.addTest(TestObjectArrayIterator.suite());
suite.addTest(TestObjectArrayListIterator.suite());
suite.addTest(TestObjectArrayListIterator2.suite());
suite.addTest(TestCollatingIterator.suite());
suite.addTest(TestFilterIterator.suite());
suite.addTest(TestFilterListIterator.suite());

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestArrayIterator.java,v 1.4 2003/08/31 17:28:40 scolebourne Exp $
* $Revision: 1.4 $
* $Date: 2003/08/31 17:28:40 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestArrayIterator.java,v 1.5 2003/10/01 21:54:54 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -65,18 +62,20 @@ import java.util.NoSuchElementException;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Tests the ArrayIterator to ensure that the next() method will actually
* perform the iteration rather than the hasNext() method.
* The code of this test was supplied by Mauricio S. Moura
* The code of this test was supplied by Mauricio S. Moura.
*
* @version $Revision: 1.5 $ $Date: 2003/10/01 21:54:54 $
*
* @author James Strachan
* @author Mauricio S. Moura
* @author Morgan Delagrange
* @author Stephen Colebourne
* @version $Id: TestArrayIterator.java,v 1.4 2003/08/31 17:28:40 scolebourne Exp $
*/
public class TestArrayIterator extends TestIterator {
public class TestArrayIterator extends AbstractTestIterator {
protected String[] testArray = { "One", "Two", "Three" };
@ -96,13 +95,6 @@ public class TestArrayIterator extends TestIterator {
return new ArrayIterator(testArray);
}
/**
* Return a new, empty {@link Object} to used for testing.
*/
public Object makeObject() {
return makeFullIterator();
}
public boolean supportsRemove() {
return false;
}

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestArrayIterator2.java,v 1.4 2003/08/31 17:28:40 scolebourne Exp $
* $Revision: 1.4 $
* $Date: 2003/08/31 17:28:40 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestArrayIterator2.java,v 1.5 2003/10/01 21:54:54 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -65,14 +62,16 @@ import java.util.NoSuchElementException;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Tests the ArrayIterator with primitive type arrays
* Tests the ArrayIterator with primitive type arrays.
*
* @version $Revision: 1.5 $ $Date: 2003/10/01 21:54:54 $
*
* @author Morgan Delagrange
* @author James Strachan
* @version $Id: TestArrayIterator2.java,v 1.4 2003/08/31 17:28:40 scolebourne Exp $
*/
public class TestArrayIterator2 extends TestIterator {
public class TestArrayIterator2 extends AbstractTestIterator {
protected int[] testArray = { 2, 4, 6, 8 };
@ -92,13 +91,6 @@ public class TestArrayIterator2 extends TestIterator {
return new ArrayIterator(testArray);
}
/**
* Return a new, empty {@link Object} to used for testing.
*/
public Object makeObject() {
return makeFullIterator();
}
/*
* We use these <code>makeArrayIterator</code> factory methods instead of
* directly calling the constructor so as to allow subclasses

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestArrayListIterator.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
* $Revision: 1.2 $
* $Date: 2003/08/31 17:28:40 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestArrayListIterator.java,v 1.3 2003/10/01 21:54:54 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -67,10 +64,12 @@ import java.util.NoSuchElementException;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Test the ArrayListIterator class.
*
* @author Neil O'Toole - <a href="mailto:neilotoole@users.sourceforge.net">neilotoole@users.sourceforge.net</a>
* @version $Id: TestArrayListIterator.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:54 $
* @author Neil O'Toole
*/
public class TestArrayListIterator extends TestArrayIterator {

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestArrayListIterator2.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
* $Revision: 1.2 $
* $Date: 2003/08/31 17:28:40 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestArrayListIterator2.java,v 1.3 2003/10/01 21:54:54 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -58,17 +55,18 @@
* <http://www.apache.org/>.
*
*/
package org.apache.commons.collections.iterators;
import java.util.Iterator;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* @author <a href="mailto:neilotoole@users.sourceforge.net">Neil O'Toole</a>
* @see org.apache.commons.collections.iterators.TestArrayIterator2
* @version $Id: TestArrayListIterator2.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
* Test the ArrayListIterator class with primitives.
*
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:54 $
* @author Neil O'Toole
*/
public class TestArrayListIterator2 extends TestArrayIterator2 {

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestCollatingIterator.java,v 1.3 2003/08/31 17:28:40 scolebourne Exp $
* $Revision: 1.3 $
* $Date: 2003/08/31 17:28:40 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestCollatingIterator.java,v 1.4 2003/10/01 21:54:54 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -58,7 +55,6 @@
* <http://www.apache.org/>.
*
*/
package org.apache.commons.collections.iterators;
import java.util.ArrayList;
@ -72,10 +68,11 @@ import org.apache.commons.collections.comparators.ComparableComparator;
/**
* Unit test suite for {@link CollatingIterator}.
* @version $Revision: 1.3 $ $Date: 2003/08/31 17:28:40 $
*
* @version $Revision: 1.4 $ $Date: 2003/10/01 21:54:54 $
* @author Rodney Waldhoff
*/
public class TestCollatingIterator extends TestIterator {
public class TestCollatingIterator extends AbstractTestIterator {
//------------------------------------------------------------ Conventional
@ -131,14 +128,6 @@ public class TestCollatingIterator extends TestIterator {
return iter;
}
public Object makeObject() {
return makeFullIterator();
}
public boolean supportsEmptyIterator() {
return true;
}
//------------------------------------------------------------------- Tests
public void testGetSetComparator() {

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestFilterIterator.java,v 1.6 2003/08/31 17:28:40 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestFilterIterator.java,v 1.7 2003/10/01 21:54:54 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -71,11 +71,12 @@ import org.apache.commons.collections.Predicate;
/**
* Test the filter iterator.
*
* @version $Revision: 1.7 $ $Date: 2003/10/01 21:54:54 $
*
* @author Jan Sorensen
* @author Ralph Wagner
* @version $Revision: 1.6 $ $Date: 2003/08/31 17:28:40 $
*/
public class TestFilterIterator extends TestIterator {
public class TestFilterIterator extends AbstractTestIterator {
/** Creates new TestFilterIterator */
public TestFilterIterator(String name) {
@ -129,10 +130,6 @@ public class TestFilterIterator extends TestIterator {
return makePassThroughFilter(list.iterator());
}
public Object makeObject() {
return makeFullIterator();
}
public void testRepeatedHasNext() {
for (int i = 0; i <= array.length; i++) {
assertTrue(iterator.hasNext());

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestFilterListIterator.java,v 1.6 2003/08/31 17:28:40 scolebourne Exp $
* $Revision: 1.6 $
* $Date: 2003/08/31 17:28:40 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestFilterListIterator.java,v 1.7 2003/10/01 21:54:54 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -72,7 +69,10 @@ import junit.framework.TestSuite;
import org.apache.commons.collections.Predicate;
/**
* @version $Revision: 1.6 $ $Date: 2003/08/31 17:28:40 $
* Tests the FilterListIterator class.
*
* @version $Revision: 1.7 $ $Date: 2003/10/01 21:54:54 $
*
* @author Rodney Waldhoff
*/
public class TestFilterListIterator extends TestCase {

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestIteratorChain.java,v 1.5 2003/08/31 17:28:40 scolebourne Exp $
* $Revision: 1.5 $
* $Date: 2003/08/31 17:28:40 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestIteratorChain.java,v 1.6 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -58,7 +55,6 @@
* <http://www.apache.org/>.
*
*/
package org.apache.commons.collections.iterators;
import java.util.ArrayList;
@ -70,16 +66,15 @@ import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Tests the ArrayIterator to ensure that the next() method will actually
* perform the iteration rather than the hasNext() method.
* The code of this test was supplied by Mauricio S. Moura
* Tests the IteratorChain class.
*
* @version $Revision: 1.6 $ $Date: 2003/10/01 21:54:55 $
*
* @author James Strachan
* @author Mauricio S. Moura
* @author Morgan Delagrange
* @version $Id: TestIteratorChain.java,v 1.5 2003/08/31 17:28:40 scolebourne Exp $
*/
public class TestIteratorChain extends TestIterator {
public class TestIteratorChain extends AbstractTestIterator {
protected String[] testArray = {
"One", "Two", "Three", "Four", "Five", "Six"
@ -123,13 +118,6 @@ public class TestIteratorChain extends TestIterator {
return chain;
}
/**
* Return a new, empty {@link Object} to used for testing.
*/
public Object makeObject() {
return makeFullIterator();
}
public void testIterator() {
Iterator iter = (Iterator) makeFullIterator();
for ( int i = 0; i < testArray.length; i++ ) {

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper.java,v 1.3 2003/08/31 17:28:40 scolebourne Exp $
* $Revision: 1.3 $
* $Date: 2003/08/31 17:28:40 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestListIteratorWrapper.java,v 1.4 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -58,7 +55,6 @@
* <http://www.apache.org/>.
*
*/
package org.apache.commons.collections.iterators;
import java.util.ArrayList;
@ -74,10 +70,11 @@ import junit.framework.TestSuite;
* Tests the ListIteratorWrapper to insure that it simulates
* a ListIterator correctly.
*
* @version $Revision: 1.4 $ $Date: 2003/10/01 21:54:55 $
*
* @author Morgan Delagrange
* @version $Id: TestListIteratorWrapper.java,v 1.3 2003/08/31 17:28:40 scolebourne Exp $
*/
public class TestListIteratorWrapper extends TestIterator {
public class TestListIteratorWrapper extends AbstractTestIterator {
protected String[] testArray = {
"One", "Two", "Three", "Four", "Five", "Six"
@ -114,13 +111,6 @@ public class TestListIteratorWrapper extends TestIterator {
return new ListIteratorWrapper(i);
}
/**
* Return a new, empty {@link Object} to used for testing.
*/
public Object makeObject() {
return makeFullIterator();
}
public void testIterator() {
ListIterator iter = (ListIterator) makeFullIterator();
for ( int i = 0; i < testArray.length; i++ ) {

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestLoopingIterator.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
* $Revision: 1.2 $
* $Date: 2003/08/31 17:28:40 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestLoopingIterator.java,v 1.3 2003/10/01 21:54:54 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -68,10 +65,13 @@ import java.util.NoSuchElementException;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Tests the LoopingIterator class using jUnit.
* Tests the LoopingIterator class.
*
* @author <a href="mailto:joncrlsn@users.sf.net">Jonathan Carlson</a>
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:54 $
*
* @author Jonathan Carlson
* @author Stephen Colebourne
*/
public class TestLoopingIterator extends TestCase {

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestObjectArrayIterator.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
* $Revision: 1.2 $
* $Date: 2003/08/31 17:28:40 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestObjectArrayIterator.java,v 1.3 2003/10/01 21:54:54 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -65,16 +62,18 @@ import java.util.NoSuchElementException;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Tests the ObjectArrayIterator.
*
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:54 $
*
* @author James Strachan
* @author Mauricio S. Moura
* @author Morgan Delagrange
* @author Stephen Colebourne
* @version $Id: TestObjectArrayIterator.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
*/
public class TestObjectArrayIterator extends TestIterator {
public class TestObjectArrayIterator extends AbstractTestIterator {
protected String[] testArray = { "One", "Two", "Three" };
@ -114,13 +113,6 @@ public class TestObjectArrayIterator extends TestIterator {
return false;
}
/**
* Return a new, empty {@link Object} to used for testing.
*/
public Object makeObject() {
return makeFullIterator();
}
public void testIterator() {
Iterator iter = (Iterator) makeFullIterator();
for (int i = 0; i < testArray.length; i++) {

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestObjectArrayListIterator.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
* $Revision: 1.2 $
* $Date: 2003/08/31 17:28:40 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestObjectArrayListIterator.java,v 1.3 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -67,10 +64,13 @@ import java.util.NoSuchElementException;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Tests the ObjectArrayListIterator class.
*
* @author <a href="mailto:neilotoole@users.sourceforge.net">Neil O'Toole</a>
* @version $Id: TestObjectArrayListIterator.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:55 $
*
* @author Neil O'Toole
*/
public class TestObjectArrayListIterator extends TestObjectArrayIterator {

View File

@ -1,13 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/Attic/TestListIterator.java,v 1.3 2003/08/31 17:28:40 scolebourne Exp $
* $Revision: 1.3 $
* $Date: 2003/08/31 17:28:40 $
*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestObjectArrayListIterator2.java,v 1.1 2003/10/01 21:54:54 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -36,7 +33,7 @@
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@ -60,54 +57,48 @@
*/
package org.apache.commons.collections.iterators;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.ListIterator;
/**
* @version $Revision: 1.3 $ $Date: 2003/08/31 17:28:40 $
* @author Rodney Waldhoff
*/
public abstract class TestListIterator extends TestIterator {
import junit.framework.Test;
import junit.framework.TestSuite;
public TestListIterator(String testName) {
/**
* Tests the ObjectArrayListIterator class.
*
* @version $Revision: 1.1 $ $Date: 2003/10/01 21:54:54 $
*
* @author Stephen Colebourne
*/
public class TestObjectArrayListIterator2 extends AbstractTestListIterator {
protected String[] testArray = { "One", "Two", "Three" };
public TestObjectArrayListIterator2(String testName) {
super(testName);
}
public abstract ListIterator makeEmptyListIterator();
public abstract ListIterator makeFullListIterator();
public Iterator makeEmptyIterator() {
return makeEmptyListIterator();
public static Test suite() {
return new TestSuite(TestObjectArrayListIterator2.class);
}
public Iterator makeFullIterator() {
return makeFullListIterator();
public ListIterator makeEmptyListIterator() {
return new ObjectArrayListIterator(new Object[0]);
}
// tests
public ListIterator makeFullListIterator() {
return new ObjectArrayListIterator(testArray);
}
public void testEmptyListIteratorIsIndeedEmpty() {
ListIterator iter = makeEmptyListIterator();
assertTrue(!iter.hasNext());
assertTrue(!iter.hasPrevious());
public ListIterator makeArrayListIterator(Object[] array) {
return new ObjectArrayListIterator(array);
}
public boolean supportsAdd() {
return false;
}
public void testWalkForwardAndBack() {
ArrayList list = new ArrayList();
ListIterator iter = makeFullListIterator();
while(iter.hasNext()) {
list.add(iter.next());
}
for(int i = list.size()-1;i>=0;i--) {
Object obj = list.get(i);
if(null == obj) {
assertNull(iter.previous());
} else {
assertEquals(obj,iter.previous());
}
}
assertTrue(!iter.hasPrevious());
public boolean supportsRemove() {
return false;
}
}

View File

@ -1,10 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.java,v 1.5 2003/08/31 17:28:40 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.java,v 1.6 2003/10/01 21:54:54 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -67,10 +67,11 @@ import junit.framework.TestSuite;
* Tests the SingletonIterator to ensure that the next() method will actually
* perform the iteration rather than the hasNext() method.
*
* @version $Revision: 1.6 $ $Date: 2003/10/01 21:54:54 $
*
* @author James Strachan
* @version $Id: TestSingletonIterator.java,v 1.5 2003/08/31 17:28:40 scolebourne Exp $
*/
public class TestSingletonIterator extends TestIterator {
public class TestSingletonIterator extends AbstractTestIterator {
private static final Object testValue = "foo";
@ -96,13 +97,6 @@ public class TestSingletonIterator extends TestIterator {
return new SingletonIterator( testValue );
}
/**
* Return a new, empty {@link Object} to used for testing.
*/
public Object makeObject() {
return makeFullIterator();
}
public boolean supportsRemove() {
return false;
}

View File

@ -1,10 +1,10 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java,v 1.5 2003/08/31 17:28:40 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java,v 1.6 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -57,7 +57,6 @@
*/
package org.apache.commons.collections.iterators;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.NoSuchElementException;
@ -67,10 +66,11 @@ import junit.framework.TestSuite;
/**
* Tests the SingletonListIterator.
*
* @version $Revision: 1.6 $ $Date: 2003/10/01 21:54:55 $
*
* @author Stephen Colebourne
* @version $Id: TestSingletonListIterator.java,v 1.5 2003/08/31 17:28:40 scolebourne Exp $
*/
public class TestSingletonListIterator extends TestIterator {
public class TestSingletonListIterator extends AbstractTestListIterator {
private static final Object testValue = "foo";
@ -88,21 +88,18 @@ public class TestSingletonListIterator extends TestIterator {
*
* @return null
*/
public Iterator makeEmptyIterator() {
public ListIterator makeEmptyListIterator() {
return null;
}
public Iterator makeFullIterator() {
public ListIterator makeFullListIterator() {
return new SingletonListIterator( testValue );
}
/**
* Return a new, empty {@link Object} to used for testing.
*/
public Object makeObject() {
return makeFullIterator();
public boolean supportsAdd() {
return false;
}
public boolean supportsRemove() {
return false;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestUniqueFilterIterator.java,v 1.4 2003/08/31 17:28:40 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/TestUniqueFilterIterator.java,v 1.5 2003/10/01 21:54:54 scolebourne Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -66,17 +66,16 @@ import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Tests the ArrayIterator to ensure that the next() method will actually
* perform the iteration rather than the hasNext() method.
* The code of this test was supplied by Mauricio S. Moura
* Tests the UniqueFilterIterator class.
*
* @version $Revision: 1.5 $ $Date: 2003/10/01 21:54:54 $
*
* @author James Strachan
* @author Mauricio S. Moura
* @author Morgan Delagrange
* @author Stephen Colebourne
* @version $Revision: 1.4 $ $Date: 2003/08/31 17:28:40 $
*/
public class TestUniqueFilterIterator extends TestIterator {
public class TestUniqueFilterIterator extends AbstractTestIterator {
protected String[] testArray = {
"One", "Two", "Three", "Four", "Five", "Six"
@ -117,13 +116,6 @@ public class TestUniqueFilterIterator extends TestIterator {
return new UniqueFilterIterator(i);
}
/**
* Return a new, empty {@link Object} to used for testing.
*/
public Object makeObject() {
return makeFullIterator();
}
public void testIterator() {
Iterator iter = (Iterator) makeFullIterator();
for ( int i = 0; i < testArray.length; i++ ) {

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestByteIterator.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestByteIterator.java,v 1.3 2003/10/01 21:54:56 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -60,14 +60,14 @@ package org.apache.commons.collections.primitives;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.commons.collections.iterators.TestIterator;
import org.apache.commons.collections.iterators.AbstractTestIterator;
import org.apache.commons.collections.primitives.adapters.ByteIteratorIterator;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:40 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:56 $
* @author Rodney Waldhoff
*/
public abstract class TestByteIterator extends TestIterator {
public abstract class TestByteIterator extends AbstractTestIterator {
// conventional
// ------------------------------------------------------------------------
@ -79,10 +79,6 @@ public abstract class TestByteIterator extends TestIterator {
// collections testing framework
// ------------------------------------------------------------------------
protected Object makeObject() {
return makeFullIterator();
}
public Iterator makeEmptyIterator() {
return ByteIteratorIterator.wrap(makeEmptyByteIterator());
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestCharIterator.java,v 1.2 2003/08/31 17:28:41 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestCharIterator.java,v 1.3 2003/10/01 21:54:56 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -60,14 +60,14 @@ package org.apache.commons.collections.primitives;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.commons.collections.iterators.TestIterator;
import org.apache.commons.collections.iterators.AbstractTestIterator;
import org.apache.commons.collections.primitives.adapters.CharIteratorIterator;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:41 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:56 $
* @author Rodney Waldhoff
*/
public abstract class TestCharIterator extends TestIterator {
public abstract class TestCharIterator extends AbstractTestIterator {
// conventional
// ------------------------------------------------------------------------
@ -79,10 +79,6 @@ public abstract class TestCharIterator extends TestIterator {
// collections testing framework
// ------------------------------------------------------------------------
protected Object makeObject() {
return makeFullIterator();
}
public Iterator makeEmptyIterator() {
return CharIteratorIterator.wrap(makeEmptyCharIterator());
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestDoubleIterator.java,v 1.2 2003/08/31 17:28:40 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestDoubleIterator.java,v 1.3 2003/10/01 21:54:56 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -60,14 +60,14 @@ package org.apache.commons.collections.primitives;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.commons.collections.iterators.TestIterator;
import org.apache.commons.collections.iterators.AbstractTestIterator;
import org.apache.commons.collections.primitives.adapters.DoubleIteratorIterator;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:40 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:56 $
* @author Rodney Waldhoff
*/
public abstract class TestDoubleIterator extends TestIterator {
public abstract class TestDoubleIterator extends AbstractTestIterator {
// conventional
// ------------------------------------------------------------------------
@ -79,10 +79,6 @@ public abstract class TestDoubleIterator extends TestIterator {
// collections testing framework
// ------------------------------------------------------------------------
protected Object makeObject() {
return makeFullIterator();
}
public Iterator makeEmptyIterator() {
return DoubleIteratorIterator.wrap(makeEmptyDoubleIterator());
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestFloatIterator.java,v 1.2 2003/08/31 17:28:41 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestFloatIterator.java,v 1.3 2003/10/01 21:54:56 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -60,14 +60,14 @@ package org.apache.commons.collections.primitives;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.commons.collections.iterators.TestIterator;
import org.apache.commons.collections.iterators.AbstractTestIterator;
import org.apache.commons.collections.primitives.adapters.FloatIteratorIterator;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:41 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:56 $
* @author Rodney Waldhoff
*/
public abstract class TestFloatIterator extends TestIterator {
public abstract class TestFloatIterator extends AbstractTestIterator {
// conventional
// ------------------------------------------------------------------------
@ -79,10 +79,6 @@ public abstract class TestFloatIterator extends TestIterator {
// collections testing framework
// ------------------------------------------------------------------------
protected Object makeObject() {
return makeFullIterator();
}
public Iterator makeEmptyIterator() {
return FloatIteratorIterator.wrap(makeEmptyFloatIterator());
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestIntIterator.java,v 1.2 2003/08/31 17:28:41 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestIntIterator.java,v 1.3 2003/10/01 21:54:56 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -60,14 +60,14 @@ package org.apache.commons.collections.primitives;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.commons.collections.iterators.TestIterator;
import org.apache.commons.collections.iterators.AbstractTestIterator;
import org.apache.commons.collections.primitives.adapters.IntIteratorIterator;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:41 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:56 $
* @author Rodney Waldhoff
*/
public abstract class TestIntIterator extends TestIterator {
public abstract class TestIntIterator extends AbstractTestIterator {
// conventional
// ------------------------------------------------------------------------
@ -79,10 +79,6 @@ public abstract class TestIntIterator extends TestIterator {
// collections testing framework
// ------------------------------------------------------------------------
protected Object makeObject() {
return makeFullIterator();
}
public Iterator makeEmptyIterator() {
return IntIteratorIterator.wrap(makeEmptyIntIterator());
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestLongIterator.java,v 1.2 2003/08/31 17:28:41 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestLongIterator.java,v 1.3 2003/10/01 21:54:56 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -60,14 +60,14 @@ package org.apache.commons.collections.primitives;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.commons.collections.iterators.TestIterator;
import org.apache.commons.collections.iterators.AbstractTestIterator;
import org.apache.commons.collections.primitives.adapters.LongIteratorIterator;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:41 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:56 $
* @author Rodney Waldhoff
*/
public abstract class TestLongIterator extends TestIterator {
public abstract class TestLongIterator extends AbstractTestIterator {
// conventional
// ------------------------------------------------------------------------
@ -79,10 +79,6 @@ public abstract class TestLongIterator extends TestIterator {
// collections testing framework
// ------------------------------------------------------------------------
protected Object makeObject() {
return makeFullIterator();
}
public Iterator makeEmptyIterator() {
return LongIteratorIterator.wrap(makeEmptyLongIterator());
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestShortIterator.java,v 1.2 2003/08/31 17:28:41 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestShortIterator.java,v 1.3 2003/10/01 21:54:56 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -60,14 +60,14 @@ package org.apache.commons.collections.primitives;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.commons.collections.iterators.TestIterator;
import org.apache.commons.collections.iterators.AbstractTestIterator;
import org.apache.commons.collections.primitives.adapters.ShortIteratorIterator;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:41 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:56 $
* @author Rodney Waldhoff
*/
public abstract class TestShortIterator extends TestIterator {
public abstract class TestShortIterator extends AbstractTestIterator {
// conventional
// ------------------------------------------------------------------------
@ -79,10 +79,6 @@ public abstract class TestShortIterator extends TestIterator {
// collections testing framework
// ------------------------------------------------------------------------
protected Object makeObject() {
return makeFullIterator();
}
public Iterator makeEmptyIterator() {
return ShortIteratorIterator.wrap(makeEmptyShortIterator());
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestByteIteratorIterator.java,v 1.2 2003/08/31 17:28:38 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestByteIteratorIterator.java,v 1.3 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -62,15 +62,15 @@ import java.util.Iterator;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.collections.iterators.TestIterator;
import org.apache.commons.collections.iterators.AbstractTestIterator;
import org.apache.commons.collections.primitives.ArrayByteList;
import org.apache.commons.collections.primitives.ByteList;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:38 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:55 $
* @author Rodney Waldhoff
*/
public class TestByteIteratorIterator extends TestIterator {
public class TestByteIteratorIterator extends AbstractTestIterator {
// conventional
// ------------------------------------------------------------------------
@ -86,10 +86,6 @@ public class TestByteIteratorIterator extends TestIterator {
// collections testing framework
// ------------------------------------------------------------------------
public Object makeObject() {
return makeFullIterator();
}
public Iterator makeEmptyIterator() {
return ByteIteratorIterator.wrap(makeEmptyByteList().iterator());
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestByteListIteratorListIterator.java,v 1.2 2003/08/31 17:28:38 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestByteListIteratorListIterator.java,v 1.3 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -64,15 +64,15 @@ import java.util.NoSuchElementException;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.collections.iterators.TestListIterator;
import org.apache.commons.collections.iterators.AbstractTestListIterator;
import org.apache.commons.collections.primitives.ArrayByteList;
import org.apache.commons.collections.primitives.ByteList;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:38 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:55 $
* @author Rodney Waldhoff
*/
public class TestByteListIteratorListIterator extends TestListIterator {
public class TestByteListIteratorListIterator extends AbstractTestListIterator {
// conventional
// ------------------------------------------------------------------------
@ -88,10 +88,6 @@ public class TestByteListIteratorListIterator extends TestListIterator {
// collections testing framework
// ------------------------------------------------------------------------
public Object makeObject() {
return makeFullIterator();
}
public ListIterator makeEmptyListIterator() {
return ByteListIteratorListIterator.wrap(makeEmptyByteList().listIterator());
}
@ -117,6 +113,10 @@ public class TestByteListIteratorListIterator extends TestListIterator {
return new byte[] { (byte)0, (byte)1, (byte)2, (byte)3, (byte)4, (byte)5, (byte)6, (byte)7, (byte)8, (byte)9 };
}
protected Object addSetValue() {
return new Byte((byte)1);
}
// tests
// ------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestCharIteratorIterator.java,v 1.2 2003/08/31 17:28:38 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestCharIteratorIterator.java,v 1.3 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -62,15 +62,15 @@ import java.util.Iterator;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.collections.iterators.TestIterator;
import org.apache.commons.collections.iterators.AbstractTestIterator;
import org.apache.commons.collections.primitives.ArrayCharList;
import org.apache.commons.collections.primitives.CharList;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:38 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:55 $
* @author Rodney Waldhoff
*/
public class TestCharIteratorIterator extends TestIterator {
public class TestCharIteratorIterator extends AbstractTestIterator {
// conventional
// ------------------------------------------------------------------------
@ -86,10 +86,6 @@ public class TestCharIteratorIterator extends TestIterator {
// collections testing framework
// ------------------------------------------------------------------------
public Object makeObject() {
return makeFullIterator();
}
public Iterator makeEmptyIterator() {
return CharIteratorIterator.wrap(makeEmptyCharList().iterator());
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestCharListIteratorListIterator.java,v 1.2 2003/08/31 17:28:38 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestCharListIteratorListIterator.java,v 1.3 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -64,15 +64,15 @@ import java.util.NoSuchElementException;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.collections.iterators.TestListIterator;
import org.apache.commons.collections.iterators.AbstractTestListIterator;
import org.apache.commons.collections.primitives.ArrayCharList;
import org.apache.commons.collections.primitives.CharList;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:38 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:55 $
* @author Rodney Waldhoff
*/
public class TestCharListIteratorListIterator extends TestListIterator {
public class TestCharListIteratorListIterator extends AbstractTestListIterator {
// conventional
// ------------------------------------------------------------------------
@ -88,10 +88,6 @@ public class TestCharListIteratorListIterator extends TestListIterator {
// collections testing framework
// ------------------------------------------------------------------------
public Object makeObject() {
return makeFullIterator();
}
public ListIterator makeEmptyListIterator() {
return CharListIteratorListIterator.wrap(makeEmptyCharList().listIterator());
}
@ -117,6 +113,10 @@ public class TestCharListIteratorListIterator extends TestListIterator {
return new char[] { (char)0, (char)1, (char)2, (char)3, (char)4, (char)5, (char)6, (char)7, (char)8, (char)9 };
}
protected Object addSetValue() {
return new Character((char)1);
}
// tests
// ------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestDoubleIteratorIterator.java,v 1.2 2003/08/31 17:28:38 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestDoubleIteratorIterator.java,v 1.3 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -62,15 +62,15 @@ import java.util.Iterator;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.collections.iterators.TestIterator;
import org.apache.commons.collections.iterators.AbstractTestIterator;
import org.apache.commons.collections.primitives.ArrayDoubleList;
import org.apache.commons.collections.primitives.DoubleList;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:38 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:55 $
* @author Rodney Waldhoff
*/
public class TestDoubleIteratorIterator extends TestIterator {
public class TestDoubleIteratorIterator extends AbstractTestIterator {
// conventional
// ------------------------------------------------------------------------
@ -86,10 +86,6 @@ public class TestDoubleIteratorIterator extends TestIterator {
// collections testing framework
// ------------------------------------------------------------------------
public Object makeObject() {
return makeFullIterator();
}
public Iterator makeEmptyIterator() {
return DoubleIteratorIterator.wrap(makeEmptyDoubleList().iterator());
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestDoubleListIteratorListIterator.java,v 1.2 2003/08/31 17:28:38 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestDoubleListIteratorListIterator.java,v 1.3 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -64,15 +64,15 @@ import java.util.NoSuchElementException;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.collections.iterators.TestListIterator;
import org.apache.commons.collections.iterators.AbstractTestListIterator;
import org.apache.commons.collections.primitives.ArrayDoubleList;
import org.apache.commons.collections.primitives.DoubleList;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:38 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:55 $
* @author Rodney Waldhoff
*/
public class TestDoubleListIteratorListIterator extends TestListIterator {
public class TestDoubleListIteratorListIterator extends AbstractTestListIterator {
// conventional
// ------------------------------------------------------------------------
@ -88,10 +88,6 @@ public class TestDoubleListIteratorListIterator extends TestListIterator {
// collections testing framework
// ------------------------------------------------------------------------
public Object makeObject() {
return makeFullIterator();
}
public ListIterator makeEmptyListIterator() {
return DoubleListIteratorListIterator.wrap(makeEmptyDoubleList().listIterator());
}
@ -117,6 +113,10 @@ public class TestDoubleListIteratorListIterator extends TestListIterator {
return new double[] { (double)0, (double)1, (double)2, (double)3, (double)4, (double)5, (double)6, (double)7, (double)8, (double)9 };
}
protected Object addSetValue() {
return new Double((double)1);
}
// tests
// ------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestFloatIteratorIterator.java,v 1.2 2003/08/31 17:28:38 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestFloatIteratorIterator.java,v 1.3 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -62,15 +62,15 @@ import java.util.Iterator;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.collections.iterators.TestIterator;
import org.apache.commons.collections.iterators.AbstractTestIterator;
import org.apache.commons.collections.primitives.ArrayFloatList;
import org.apache.commons.collections.primitives.FloatList;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:38 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:55 $
* @author Rodney Waldhoff
*/
public class TestFloatIteratorIterator extends TestIterator {
public class TestFloatIteratorIterator extends AbstractTestIterator {
// conventional
// ------------------------------------------------------------------------
@ -86,10 +86,6 @@ public class TestFloatIteratorIterator extends TestIterator {
// collections testing framework
// ------------------------------------------------------------------------
public Object makeObject() {
return makeFullIterator();
}
public Iterator makeEmptyIterator() {
return FloatIteratorIterator.wrap(makeEmptyFloatList().iterator());
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestFloatListIteratorListIterator.java,v 1.3 2003/08/31 17:28:38 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestFloatListIteratorListIterator.java,v 1.4 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -64,15 +64,15 @@ import java.util.NoSuchElementException;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.collections.iterators.TestListIterator;
import org.apache.commons.collections.iterators.AbstractTestListIterator;
import org.apache.commons.collections.primitives.ArrayFloatList;
import org.apache.commons.collections.primitives.FloatList;
/**
* @version $Revision: 1.3 $ $Date: 2003/08/31 17:28:38 $
* @version $Revision: 1.4 $ $Date: 2003/10/01 21:54:55 $
* @author Rodney Waldhoff
*/
public class TestFloatListIteratorListIterator extends TestListIterator {
public class TestFloatListIteratorListIterator extends AbstractTestListIterator {
// conventional
// ------------------------------------------------------------------------
@ -88,10 +88,6 @@ public class TestFloatListIteratorListIterator extends TestListIterator {
// collections testing framework
// ------------------------------------------------------------------------
public Object makeObject() {
return makeFullIterator();
}
public ListIterator makeEmptyListIterator() {
return FloatListIteratorListIterator.wrap(makeEmptyFloatList().listIterator());
}
@ -117,6 +113,10 @@ public class TestFloatListIteratorListIterator extends TestListIterator {
return new float[] { (float)0, (float)1, (float)2, (float)3, (float)4, (float)5, (float)6, (float)7, (float)8, (float)9 };
}
protected Object addSetValue() {
return new Float((float)1);
}
// tests
// ------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestIntIteratorIterator.java,v 1.2 2003/08/31 17:28:38 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestIntIteratorIterator.java,v 1.3 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -62,15 +62,15 @@ import java.util.Iterator;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.collections.iterators.TestIterator;
import org.apache.commons.collections.iterators.AbstractTestIterator;
import org.apache.commons.collections.primitives.ArrayIntList;
import org.apache.commons.collections.primitives.IntList;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:38 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:55 $
* @author Rodney Waldhoff
*/
public class TestIntIteratorIterator extends TestIterator {
public class TestIntIteratorIterator extends AbstractTestIterator {
// conventional
// ------------------------------------------------------------------------
@ -86,10 +86,6 @@ public class TestIntIteratorIterator extends TestIterator {
// collections testing framework
// ------------------------------------------------------------------------
public Object makeObject() {
return makeFullIterator();
}
public Iterator makeEmptyIterator() {
return IntIteratorIterator.wrap(makeEmptyIntList().iterator());
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestIntListIteratorListIterator.java,v 1.5 2003/08/31 17:28:38 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestIntListIteratorListIterator.java,v 1.6 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -64,15 +64,15 @@ import java.util.NoSuchElementException;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.collections.iterators.TestListIterator;
import org.apache.commons.collections.iterators.AbstractTestListIterator;
import org.apache.commons.collections.primitives.ArrayIntList;
import org.apache.commons.collections.primitives.IntList;
/**
* @version $Revision: 1.5 $ $Date: 2003/08/31 17:28:38 $
* @version $Revision: 1.6 $ $Date: 2003/10/01 21:54:55 $
* @author Rodney Waldhoff
*/
public class TestIntListIteratorListIterator extends TestListIterator {
public class TestIntListIteratorListIterator extends AbstractTestListIterator {
// conventional
// ------------------------------------------------------------------------
@ -88,10 +88,6 @@ public class TestIntListIteratorListIterator extends TestListIterator {
// collections testing framework
// ------------------------------------------------------------------------
public Object makeObject() {
return makeFullIterator();
}
public ListIterator makeEmptyListIterator() {
return IntListIteratorListIterator.wrap(makeEmptyIntList().listIterator());
}
@ -117,6 +113,10 @@ public class TestIntListIteratorListIterator extends TestListIterator {
return new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
}
protected Object addSetValue() {
return new Integer(1);
}
// tests
// ------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestLongIteratorIterator.java,v 1.2 2003/08/31 17:28:38 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestLongIteratorIterator.java,v 1.3 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -62,15 +62,15 @@ import java.util.Iterator;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.collections.iterators.TestIterator;
import org.apache.commons.collections.iterators.AbstractTestIterator;
import org.apache.commons.collections.primitives.ArrayLongList;
import org.apache.commons.collections.primitives.LongList;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:38 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:55 $
* @author Rodney Waldhoff
*/
public class TestLongIteratorIterator extends TestIterator {
public class TestLongIteratorIterator extends AbstractTestIterator {
// conventional
// ------------------------------------------------------------------------
@ -86,10 +86,6 @@ public class TestLongIteratorIterator extends TestIterator {
// collections testing framework
// ------------------------------------------------------------------------
public Object makeObject() {
return makeFullIterator();
}
public Iterator makeEmptyIterator() {
return LongIteratorIterator.wrap(makeEmptyLongList().iterator());
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestLongListIteratorListIterator.java,v 1.3 2003/08/31 17:28:38 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestLongListIteratorListIterator.java,v 1.4 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -64,15 +64,15 @@ import java.util.NoSuchElementException;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.collections.iterators.TestListIterator;
import org.apache.commons.collections.iterators.AbstractTestListIterator;
import org.apache.commons.collections.primitives.ArrayLongList;
import org.apache.commons.collections.primitives.LongList;
/**
* @version $Revision: 1.3 $ $Date: 2003/08/31 17:28:38 $
* @version $Revision: 1.4 $ $Date: 2003/10/01 21:54:55 $
* @author Rodney Waldhoff
*/
public class TestLongListIteratorListIterator extends TestListIterator {
public class TestLongListIteratorListIterator extends AbstractTestListIterator {
// conventional
// ------------------------------------------------------------------------
@ -88,10 +88,6 @@ public class TestLongListIteratorListIterator extends TestListIterator {
// collections testing framework
// ------------------------------------------------------------------------
public Object makeObject() {
return makeFullIterator();
}
public ListIterator makeEmptyListIterator() {
return LongListIteratorListIterator.wrap(makeEmptyLongList().listIterator());
}
@ -117,6 +113,10 @@ public class TestLongListIteratorListIterator extends TestListIterator {
return new long[] { (long)0, (long)1, (long)2, (long)3, (long)4, (long)5, (long)6, (long)7, (long)8, (long)9 };
}
protected Object addSetValue() {
return new Long((long)1);
}
// tests
// ------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestShortIteratorIterator.java,v 1.2 2003/08/31 17:28:38 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestShortIteratorIterator.java,v 1.3 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -62,15 +62,15 @@ import java.util.Iterator;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.collections.iterators.TestIterator;
import org.apache.commons.collections.iterators.AbstractTestIterator;
import org.apache.commons.collections.primitives.ArrayShortList;
import org.apache.commons.collections.primitives.ShortList;
/**
* @version $Revision: 1.2 $ $Date: 2003/08/31 17:28:38 $
* @version $Revision: 1.3 $ $Date: 2003/10/01 21:54:55 $
* @author Rodney Waldhoff
*/
public class TestShortIteratorIterator extends TestIterator {
public class TestShortIteratorIterator extends AbstractTestIterator {
// conventional
// ------------------------------------------------------------------------
@ -86,10 +86,6 @@ public class TestShortIteratorIterator extends TestIterator {
// collections testing framework
// ------------------------------------------------------------------------
public Object makeObject() {
return makeFullIterator();
}
public Iterator makeEmptyIterator() {
return ShortIteratorIterator.wrap(makeEmptyShortList().iterator());
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestShortListIteratorListIterator.java,v 1.3 2003/08/31 17:28:38 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/adapters/Attic/TestShortListIteratorListIterator.java,v 1.4 2003/10/01 21:54:55 scolebourne Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -64,15 +64,15 @@ import java.util.NoSuchElementException;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.collections.iterators.TestListIterator;
import org.apache.commons.collections.iterators.AbstractTestListIterator;
import org.apache.commons.collections.primitives.ArrayShortList;
import org.apache.commons.collections.primitives.ShortList;
/**
* @version $Revision: 1.3 $ $Date: 2003/08/31 17:28:38 $
* @version $Revision: 1.4 $ $Date: 2003/10/01 21:54:55 $
* @author Rodney Waldhoff
*/
public class TestShortListIteratorListIterator extends TestListIterator {
public class TestShortListIteratorListIterator extends AbstractTestListIterator {
// conventional
// ------------------------------------------------------------------------
@ -88,10 +88,6 @@ public class TestShortListIteratorListIterator extends TestListIterator {
// collections testing framework
// ------------------------------------------------------------------------
public Object makeObject() {
return makeFullIterator();
}
public ListIterator makeEmptyListIterator() {
return ShortListIteratorListIterator.wrap(makeEmptyShortList().listIterator());
}
@ -117,6 +113,10 @@ public class TestShortListIteratorListIterator extends TestListIterator {
return new short[] { (short)0, (short)1, (short)2, (short)3, (short)4, (short)5, (short)6, (short)7, (short)8, (short)9 };
}
protected Object addSetValue() {
return new Short((short)1);
}
// tests
// ------------------------------------------------------------------------