extract methods testRemoveThenSet and testAddThenSet, so we don't assume the full iterator contains more than one element

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@131258 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rodney Waldhoff 2003-10-09 10:33:45 +00:00
parent 287d11999f
commit 4a1340c1d9
1 changed files with 12 additions and 6 deletions

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/AbstractTestListIterator.java,v 1.1 2003/10/01 21:54:54 scolebourne Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/iterators/AbstractTestListIterator.java,v 1.2 2003/10/09 10:33:45 rwaldhoff Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
@ -71,7 +71,7 @@ import java.util.NoSuchElementException;
* overriding the supportsXxx() methods if necessary.
*
* @since Commons Collections 3.0
* @version $Revision: 1.1 $ $Date: 2003/10/01 21:54:54 $
* @version $Revision: 1.2 $ $Date: 2003/10/09 10:33:45 $
*
* @author Rodney Waldhoff
* @author Stephen Colebourne
@ -268,8 +268,11 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
// repeated set calls should be fine
it.set(addSetValue());
// remove then set
if (supportsRemove()) {
}
public void testRemoveThenSet() {
ListIterator it = makeFullListIterator();
if (supportsRemove() && supportsSet()) {
it.next();
it.remove();
try {
@ -278,9 +281,12 @@ public abstract class AbstractTestListIterator extends AbstractTestIterator {
} catch (IllegalStateException e) {
}
}
}
public void testAddThenSet() {
ListIterator it = makeFullListIterator();
// add then set
if (supportsAdd()) {
if (supportsAdd() && supportsSet()) {
it.next();
it.add(addSetValue());
try {