You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2003/09/20 19:00:32 UTC
cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections TestList.java
scolebourne 2003/09/20 10:00:32
Modified: collections/src/test/org/apache/commons/collections
TestList.java
Log:
Strengthen test
Revision Changes Path
1.20 +12 -4 jakarta-commons/collections/src/test/org/apache/commons/collections/TestList.java
Index: TestList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestList.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- TestList.java 31 Aug 2003 17:28:43 -0000 1.19
+++ TestList.java 20 Sep 2003 17:00:32 -0000 1.20
@@ -227,10 +227,11 @@
public void testListAddByIndexBoundsChecking() {
if (!isAddSupported()) return;
- List list = makeEmptyList();
+ List list;
Object element = getOtherElements()[0];
try {
+ list = makeEmptyList();
list.add(Integer.MIN_VALUE, element);
fail("List.add should throw IndexOutOfBoundsException " +
"[Integer.MIN_VALUE]");
@@ -239,6 +240,7 @@
}
try {
+ list = makeEmptyList();
list.add(-1, element);
fail("List.add should throw IndexOutOfBoundsException [-1]");
} catch(IndexOutOfBoundsException e) {
@@ -246,6 +248,7 @@
}
try {
+ list = makeEmptyList();
list.add(1, element);
fail("List.add should throw IndexOutOfBoundsException [1]");
} catch(IndexOutOfBoundsException e) {
@@ -253,6 +256,7 @@
}
try {
+ list = makeEmptyList();
list.add(Integer.MAX_VALUE, element);
fail("List.add should throw IndexOutOfBoundsException " +
"[Integer.MAX_VALUE]");
@@ -269,10 +273,11 @@
public void testListAddByIndexBoundsChecking2() {
if (!isAddSupported()) return;
- List list = makeFullList();
+ List list;
Object element = getOtherElements()[0];
try {
+ list = makeFullList();
list.add(Integer.MIN_VALUE, element);
fail("List.add should throw IndexOutOfBoundsException " +
"[Integer.MIN_VALUE]");
@@ -281,6 +286,7 @@
}
try {
+ list = makeFullList();
list.add(-1, element);
fail("List.add should throw IndexOutOfBoundsException [-1]");
} catch(IndexOutOfBoundsException e) {
@@ -288,6 +294,7 @@
}
try {
+ list = makeFullList();
list.add(list.size() + 1, element);
fail("List.add should throw IndexOutOfBoundsException [size + 1]");
} catch(IndexOutOfBoundsException e) {
@@ -295,6 +302,7 @@
}
try {
+ list = makeFullList();
list.add(Integer.MAX_VALUE, element);
fail("List.add should throw IndexOutOfBoundsException " +
"[Integer.MAX_VALUE]");
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org