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 TestSingletonListIterator.java TestSingletonIterator.java
Date Wed, 15 Jan 2003 21:54:12 GMT
scolebourne    2003/01/15 13:54:12

  Modified:    collections/src/test/org/apache/commons/collections/iterators
                        TestSingletonListIterator.java
                        TestSingletonIterator.java
  Log:
  Update licence
  Test reset() on Singleton iterators
  
  Revision  Changes    Path
  1.3       +31 -11    jakarta-commons/collections/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java
  
  Index: TestSingletonListIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestSingletonListIterator.java	13 Dec 2002 12:03:05 -0000	1.2
  +++ TestSingletonListIterator.java	15 Jan 2003 21:54:12 -0000	1.3
  @@ -1,13 +1,10 @@
   /*
    * $Header$
  - * $Revision$
  - * $Date$
  - *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -23,11 +20,11 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:
  + *    any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowlegement may appear in the software itself,
  - *    if and wherever such third-party acknowlegements normally appear.
  + *    Alternately, this acknowledgment may appear in the software itself,
  + *    if and wherever such third-party acknowledgments normally appear.
    *
    * 4. The names "The Jakarta Project", "Commons", and "Apache Software
    *    Foundation" must not be used to endorse or promote products derived
  @@ -36,7 +33,7 @@
    *
    * 5. Products derived from this software may not be called "Apache"
    *    nor may "Apache" appear in their names without prior written
  - *    permission of the Apache Group.
  + *    permission of the Apache Software Foundation.
    *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  @@ -58,7 +55,6 @@
    * <http://www.apache.org/>.
    *
    */
  -
   package org.apache.commons.collections.iterators;
   
   import junit.framework.*;
  @@ -164,5 +160,29 @@
                e.getClass().equals((new NoSuchElementException()).getClass()));
           }
       }
  +    
  +    public void testReset() {
  +        ResetableListIterator it = (ResetableListIterator) makeObject();
  +        
  +        assertEquals(true, it.hasNext());
  +        assertEquals(false, it.hasPrevious());
  +        assertEquals(testValue, it.next());
  +        assertEquals(false, it.hasNext());
  +        assertEquals(true, it.hasPrevious());
  +
  +        it.reset();
  +        
  +        assertEquals(true, it.hasNext());
  +        assertEquals(false, it.hasPrevious());
  +        assertEquals(testValue, it.next());
  +        assertEquals(false, it.hasNext());
  +        assertEquals(true, it.hasPrevious());
  +        
  +        it.reset();
  +        it.reset();
  +        
  +        assertEquals(true, it.hasNext());
  +    }
  +    
   }
   
  
  
  
  1.3       +38 -23    jakarta-commons/collections/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.java
  
  Index: TestSingletonIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/iterators/TestSingletonIterator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestSingletonIterator.java	13 Dec 2002 12:03:05 -0000	1.2
  +++ TestSingletonIterator.java	15 Jan 2003 21:54:12 -0000	1.3
  @@ -1,13 +1,10 @@
   /*
    * $Header$
  - * $Revision$
  - * $Date$
  - *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -23,11 +20,11 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:
  + *    any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowlegement may appear in the software itself,
  - *    if and wherever such third-party acknowlegements normally appear.
  + *    Alternately, this acknowledgment may appear in the software itself,
  + *    if and wherever such third-party acknowledgments normally appear.
    *
    * 4. The names "The Jakarta Project", "Commons", and "Apache Software
    *    Foundation" must not be used to endorse or promote products derived
  @@ -36,7 +33,7 @@
    *
    * 5. Products derived from this software may not be called "Apache"
    *    nor may "Apache" appear in their names without prior written
  - *    permission of the Apache Group.
  + *    permission of the Apache Software Foundation.
    *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  @@ -58,7 +55,6 @@
    * <http://www.apache.org/>.
    *
    */
  -
   package org.apache.commons.collections.iterators;
   
   import junit.framework.*;
  @@ -122,20 +118,39 @@
   
       public void testIterator() {
           Iterator iter = (Iterator) makeObject();
  -        assertTrue( "Iterator has a first item", iter.hasNext() );
  -        
  +        assertTrue("Iterator has a first item", iter.hasNext());
  +
           Object iterValue = iter.next();
  -        assertEquals( "Iteration value is correct", testValue, iterValue );
  +        assertEquals("Iteration value is correct", testValue, iterValue);
  +
  +        assertTrue("Iterator should now be empty", !iter.hasNext());
  +
  +        try {
  +            Object testValue = iter.next();
  +        } catch (Exception e) {
  +            assertTrue(
  +                "NoSuchElementException must be thrown",
  +                e.getClass().equals((new NoSuchElementException()).getClass()));
  +        }
  +    }
  +    
  +    public void testReset() {
  +        ResetableIterator it = (ResetableIterator) makeObject();
           
  -        assertTrue("Iterator should now be empty", ! iter.hasNext() );
  +        assertEquals(true, it.hasNext());
  +        assertEquals(testValue, it.next());
  +        assertEquals(false, it.hasNext());
   
  -	try {
  -	    Object testValue = iter.next();
  -	} 
  -        catch (Exception e) {
  -	  assertTrue("NoSuchElementException must be thrown", 
  -		 e.getClass().equals((new NoSuchElementException()).getClass()));
  -	}
  +        it.reset();
  +        
  +        assertEquals(true, it.hasNext());
  +        assertEquals(testValue, it.next());
  +        assertEquals(false, it.hasNext());
  +        
  +        it.reset();
  +        it.reset();
  +        
  +        assertEquals(true, it.hasNext());
       }
  +    
   }
  -
  
  
  

--
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