commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwaldh...@apache.org
Subject cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections TestFilterListIterator.java
Date Mon, 13 May 2002 16:10:37 GMT
rwaldhoff    02/05/13 09:10:37

  Modified:    collections/src/java/org/apache/commons/collections
                        FilterListIterator.java
               collections/src/test/org/apache/commons/collections
                        TestFilterListIterator.java
  Log:
  fix a bug in FilterListIterator and add a test for it
  
  Revision  Changes    Path
  1.3       +8 -4      jakarta-commons/collections/src/java/org/apache/commons/collections/FilterListIterator.java
  
  Index: FilterListIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/FilterListIterator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FilterListIterator.java	26 Feb 2002 17:28:55 -0000	1.2
  +++ FilterListIterator.java	13 May 2002 16:10:37 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/FilterListIterator.java,v
1.2 2002/02/26 17:28:55 rwaldhoff Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/02/26 17:28:55 $
  + * $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/FilterListIterator.java,v
1.3 2002/05/13 16:10:37 rwaldhoff Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/05/13 16:10:37 $
    *
    * ====================================================================
    *
  @@ -71,7 +71,7 @@
     * <code>Predicate</code> evaluates to <code>true</code> are
     * returned by the iterator.
     * 
  -  * @version $Revision: 1.2 $ $Date: 2002/02/26 17:28:55 $
  +  * @version $Revision: 1.3 $ $Date: 2002/05/13 16:10:37 $
     * @author Rodney Waldhoff
     */
   public class FilterListIterator extends ProxyListIterator {
  @@ -199,6 +199,8 @@
               clearPreviousObject();
               if(!setNextObject()) {
                   return false;
  +            } else {
  +                clearNextObject();
               }
           }
   
  @@ -230,6 +232,8 @@
               clearNextObject();
               if(!setPreviousObject()) {
                   return false;
  +            } else {
  +                clearPreviousObject();
               }
           }
   
  
  
  
  1.3       +16 -4     jakarta-commons/collections/src/test/org/apache/commons/collections/TestFilterListIterator.java
  
  Index: TestFilterListIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestFilterListIterator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestFilterListIterator.java	26 Feb 2002 17:28:55 -0000	1.2
  +++ TestFilterListIterator.java	13 May 2002 16:10:37 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestFilterListIterator.java,v
1.2 2002/02/26 17:28:55 rwaldhoff Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/02/26 17:28:55 $
  + * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestFilterListIterator.java,v
1.3 2002/05/13 16:10:37 rwaldhoff Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/05/13 16:10:37 $
    *
    * ====================================================================
    *
  @@ -70,7 +70,7 @@
   import java.util.Random;
   
   /**
  - * @version $Revision: 1.2 $ $Date: 2002/02/26 17:28:55 $
  + * @version $Revision: 1.3 $ $Date: 2002/05/13 16:10:37 $
    * @author Rodney Waldhoff
    */
   public class TestFilterListIterator extends TestCase {
  @@ -314,6 +314,18 @@
               walkForward(expected,filtered);
               previousPreviousNext(expected,filtered);
           }
  +    }
  +
  +    public void testFailingHasNextBug() {
  +        FilterListIterator filtered = new FilterListIterator(list.listIterator(),fourPred);
  +        ListIterator expected = fours.listIterator();
  +        while(expected.hasNext()) {
  +            expected.next();
  +            filtered.next();
  +        }
  +        assertTrue(filtered.hasPrevious());
  +        assertTrue(!filtered.hasNext());
  +        assertEquals(expected.previous(),filtered.previous());
       }
   
       // Utilities
  
  
  

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


Mime
View raw message