added base class for testing iterators, fixed odd line feeds in TestArrayIterator2
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130575 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d3bc97b77e
commit
f9c4fd7f26
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestArrayIterator.java,v 1.5 2002/02/25 22:43:04 morgand Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestArrayIterator.java,v 1.6 2002/02/25 22:48:52 morgand Exp $
|
||||||
* $Revision: 1.5 $
|
* $Revision: 1.6 $
|
||||||
* $Date: 2002/02/25 22:43:04 $
|
* $Date: 2002/02/25 22:48:52 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
|
@ -72,7 +72,8 @@ import java.util.NoSuchElementException;
|
||||||
*
|
*
|
||||||
* @author James Strachan
|
* @author James Strachan
|
||||||
* @author Mauricio S. Moura
|
* @author Mauricio S. Moura
|
||||||
* @version $Id: TestArrayIterator.java,v 1.5 2002/02/25 22:43:04 morgand Exp $
|
* @author Morgan Delagrange
|
||||||
|
* @version $Id: TestArrayIterator.java,v 1.6 2002/02/25 22:48:52 morgand Exp $
|
||||||
*/
|
*/
|
||||||
public class TestArrayIterator extends TestIterator {
|
public class TestArrayIterator extends TestIterator {
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestArrayIterator2.java,v 1.1 2001/08/23 12:04:40 jstrachan Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestArrayIterator2.java,v 1.2 2002/02/25 22:48:52 morgand Exp $
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
* $Date: 2001/08/23 12:04:40 $
|
* $Date: 2002/02/25 22:48:52 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
|
@ -68,10 +68,11 @@ import java.util.NoSuchElementException;
|
||||||
/**
|
/**
|
||||||
* Tests the ArrayIterator with primitive type arrays
|
* Tests the ArrayIterator with primitive type arrays
|
||||||
*
|
*
|
||||||
|
* @author Morgan Delagrange
|
||||||
* @author James Strachan
|
* @author James Strachan
|
||||||
* @version $Id: TestArrayIterator2.java,v 1.1 2001/08/23 12:04:40 jstrachan Exp $
|
* @version $Id: TestArrayIterator2.java,v 1.2 2002/02/25 22:48:52 morgand Exp $
|
||||||
*/
|
*/
|
||||||
public class TestArrayIterator2 extends TestObject {
|
public class TestArrayIterator2 extends TestIterator {
|
||||||
|
|
||||||
protected int[] testArray = {
|
protected int[] testArray = {
|
||||||
2, 4, 6, 8
|
2, 4, 6, 8
|
||||||
|
@ -85,15 +86,23 @@ public class TestArrayIterator2 extends TestObject {
|
||||||
super(testName);
|
super(testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Iterator makeEmptyIterator() {
|
||||||
|
return new ArrayIterator(new int[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Iterator makeFullIterator() {
|
||||||
|
return new ArrayIterator(testArray);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a new, empty {@link Object} to used for testing.
|
* Return a new, empty {@link Object} to used for testing.
|
||||||
*/
|
*/
|
||||||
public Object makeObject() {
|
public Object makeObject() {
|
||||||
return new ArrayIterator( testArray );
|
return makeFullIterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIterator() {
|
public void testIterator() {
|
||||||
Iterator iter = (Iterator) makeObject();
|
Iterator iter = (Iterator) makeFullIterator();
|
||||||
for ( int i = 0; i < testArray.length; i++ ) {
|
for ( int i = 0; i < testArray.length; i++ ) {
|
||||||
Integer testValue = new Integer( testArray[i] );
|
Integer testValue = new Integer( testArray[i] );
|
||||||
Number iterValue = (Number) iter.next();
|
Number iterValue = (Number) iter.next();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestIterator.java,v 1.1 2002/02/25 22:43:04 morgand Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/Attic/TestIterator.java,v 1.2 2002/02/25 22:48:52 morgand Exp $
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
* $Date: 2002/02/25 22:43:04 $
|
* $Date: 2002/02/25 22:48:52 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
|
@ -64,6 +64,11 @@ package org.apache.commons.collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for tetsing Iterator interface
|
||||||
|
*
|
||||||
|
* @author Morgan Delagrange
|
||||||
|
*/
|
||||||
public abstract class TestIterator extends TestObject {
|
public abstract class TestIterator extends TestObject {
|
||||||
|
|
||||||
public TestIterator(String testName) {
|
public TestIterator(String testName) {
|
||||||
|
|
Loading…
Reference in New Issue