commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections/iterators AbstractTestListIterator.java
Date Wed, 24 Dec 2003 01:12:55 GMT
scolebourne    2003/12/23 17:12:55

  Modified:    collections/src/test/org/apache/commons/collections/iterators
                        AbstractTestListIterator.java
  Log:
  Improve list iterator tests
  
  Revision  Changes    Path
  1.5       +18 -6     jakarta-commons/collections/src/test/org/apache/commons/collections/iterators/AbstractTestListIterator.java
  
  Index: AbstractTestListIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/iterators/AbstractTestListIterator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractTestListIterator.java	18 Nov 2003 22:37:13 -0000	1.4
  +++ AbstractTestListIterator.java	24 Dec 2003 01:12:55 -0000	1.5
  @@ -223,21 +223,33 @@
       public void testAdd() {
           ListIterator it = makeFullListIterator();
           
  +        Object addValue = addSetValue();
           if (supportsAdd() == false) {
               // check for UnsupportedOperationException if not supported
               try {
  -                it.add(addSetValue());
  +                it.add(addValue);
               } catch (UnsupportedOperationException ex) {}
               return;
           }
           
  -        // add at start should be OK
  -        it.add(addSetValue());
  +        // add at start should be OK, added should be previous
  +        it = makeFullListIterator();
  +        it.add(addValue);
  +        assertSame(addValue, it.previous());
  +
  +        // add at start should be OK, added should not be next
  +        it = makeFullListIterator();
  +        it.add(addValue);
  +        assertTrue(addValue != it.next());
   
           // add in middle and at end should be OK
  +        it = makeFullListIterator();
           while (it.hasNext()) {
               it.next();
  -            it.add(addSetValue());
  +            it.add(addValue);
  +            // check add OK
  +            assertSame(addValue, it.previous());
  +            it.next();
           }        
       }
       
  
  
  

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


Mime
View raw message