From 2794a98e3cecec8a9231eb6a4b5b5d8465bf06e8 Mon Sep 17 00:00:00 2001 From: Stephen Colebourne Date: Wed, 24 Dec 2003 01:13:13 +0000 Subject: [PATCH] Make use of proper list iterator tests git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131445 13f79535-47bb-0310-9956-ffa450edef68 --- .../collections/list/AbstractTestList.java | 42 ++++++++++++++++++- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/test/org/apache/commons/collections/list/AbstractTestList.java b/src/test/org/apache/commons/collections/list/AbstractTestList.java index b374af4f6..c065ec6d4 100644 --- a/src/test/org/apache/commons/collections/list/AbstractTestList.java +++ b/src/test/org/apache/commons/collections/list/AbstractTestList.java @@ -1,5 +1,5 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/list/AbstractTestList.java,v 1.3 2003/12/11 00:16:02 scolebourne Exp $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/list/AbstractTestList.java,v 1.4 2003/12/24 01:13:13 scolebourne Exp $ * ==================================================================== * * The Apache Software License, Version 1.1 @@ -74,6 +74,7 @@ import java.util.NoSuchElementException; import org.apache.commons.collections.BulkTest; import org.apache.commons.collections.collection.AbstractTestCollection; +import org.apache.commons.collections.iterators.AbstractTestListIterator; /** * Abstract test class for {@link java.util.List} methods and contracts. @@ -86,7 +87,7 @@ import org.apache.commons.collections.collection.AbstractTestCollection; * test case (method) your {@link List} fails or override one of the * protected methods from AbstractTestCollection. * - * @version $Revision: 1.3 $ $Date: 2003/12/11 00:16:02 $ + * @version $Revision: 1.4 $ $Date: 2003/12/24 01:13:13 $ * * @author Rodney Waldhoff * @author Paul Jack @@ -1225,4 +1226,41 @@ public abstract class AbstractTestList extends AbstractTestCollection { } } + //----------------------------------------------------------------------- + public BulkTest bulkTestListIterator() { + return new TestListIterator(); + } + + public class TestListIterator extends AbstractTestListIterator { + public TestListIterator() { + super("TestListIterator"); + } + + public Object addSetValue() { + return AbstractTestList.this.getOtherElements()[0]; + } + + public boolean supportsRemove() { + return AbstractTestList.this.isRemoveSupported(); + } + + public boolean supportsAdd() { + return AbstractTestList.this.isAddSupported(); + } + + public boolean supportsSet() { + return AbstractTestList.this.isSetSupported(); + } + + public ListIterator makeEmptyListIterator() { + resetEmpty(); + return ((List) AbstractTestList.this.collection).listIterator(); + } + + public ListIterator makeFullListIterator() { + resetFull(); + return ((List) AbstractTestList.this.collection).listIterator(); + } + } + }