cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections TestList.java

2003-09-20 Thread scolebourne
scolebourne2003/09/20 10:00:32

  Modified:collections/src/test/org/apache/commons/collections
TestList.java
  Log:
  Strengthen test
  
  Revision  ChangesPath
  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 -  1.19
  +++ TestList.java 20 Sep 2003 17:00:32 -  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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections TestList.java

2002-11-07 Thread bayard
bayard  2002/11/07 13:32:36

  Modified:collections/src/test/org/apache/commons/collections
TestList.java
  Log:
  Removed unused local variable max.
  
  Revision  ChangesPath
  1.14  +4 -5  
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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TestList.java 13 Oct 2002 13:55:35 -  1.13
  +++ TestList.java 7 Nov 2002 21:32:36 -   1.14
   -767,7 +767,6 
*/
   private void backwardTest(ListIterator iter, int i) {
   List list = getList();
  -int max = getFullElements().length;
   
   while (i  0) {
   assertTrue(Iterator should have next, iter.hasPrevious());
  
  
  

--
To unsubscribe, e-mail:   mailto:commons-dev-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:commons-dev-help;jakarta.apache.org




cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections TestList.java

2002-02-26 Thread morgand

morgand 02/02/26 10:45:46

  Modified:collections/src/test/org/apache/commons/collections
TestList.java
  Log:
  added compatibility tests
  
  Revision  ChangesPath
  1.8   +42 -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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestList.java 26 Feb 2002 17:32:20 -  1.7
  +++ TestList.java 26 Feb 2002 18:45:46 -  1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestList.java,v
 1.7 2002/02/26 17:32:20 morgand Exp $
  - * $Revision: 1.7 $
  - * $Date: 2002/02/26 17:32:20 $
  + * $Header: 
/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestList.java,v
 1.8 2002/02/26 18:45:46 morgand Exp $
  + * $Revision: 1.8 $
  + * $Date: 2002/02/26 18:45:46 $
*
* 
*
  @@ -82,7 +82,7 @@
* test case (method) your {@link List} fails.
*
* @author Rodney Waldhoff
  - * @version $Id: TestList.java,v 1.7 2002/02/26 17:32:20 morgand Exp $
  + * @version $Id: TestList.java,v 1.8 2002/02/26 18:45:46 morgand Exp $
*/
   public abstract class TestList extends TestCollection {
   public TestList(String testName) {
  @@ -822,6 +822,44 @@
   
   assertEquals(Both lists are same size,list.size(), 4);
   assertEquals(Both lists are same size,list2.size(),4);
  +}
  +
  +/**
  + * Compare the current serialized form of the List
  + * against the canonical version in CVS.
  + */
  +public void testEmptyListCompatibility() throws IOException, 
ClassNotFoundException {
  +/**
  + * Create canonical objects with this code
  +List list = makeEmptyList();
  +if (!(list instanceof Serializable)) return;
  +
  +writeExternalFormToDisk((Serializable) list, 
getCanonicalEmptyCollectionName(list));
  +*/
  +
  +// test to make sure the canonical form has been preserved
  +if (!(makeEmptyList() instanceof Serializable)) return;
  +List list = (List) 
readExternalFormFromDisk(getCanonicalEmptyCollectionName(makeEmptyList()));
  +assertTrue(List is empty,list.size()  == 0);
  +}
  +
  +/**
  + * Compare the current serialized form of the List
  + * against the canonical version in CVS.
  + */
  +public void testFullListCompatibility() throws IOException, 
ClassNotFoundException {
  +/**
  + * Create canonical objects with this code
  +List list = makeFullList();
  +if (!(list instanceof Serializable)) return;
  +
  +writeExternalFormToDisk((Serializable) list, 
getCanonicalFullCollectionName(list));
  +*/
  +
  +// test to make sure the canonical form has been preserved
  +if (!(makeFullList() instanceof Serializable)) return;
  +List list = (List) 
readExternalFormFromDisk(getCanonicalFullCollectionName(makeFullList()));
  +assertEquals(List is the right size,list.size(), 4);
   }
   
   }
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]