commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From morg...@apache.org
Subject cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections TestIterator.java
Date Mon, 25 Feb 2002 23:37:38 GMT
morgand     02/02/25 15:37:38

  Modified:    collections/src/test/org/apache/commons/collections
                        TestIterator.java
  Log:
  added methods to allow for iterators that can't be full, or that can't be empty
  
  Revision  Changes    Path
  1.4       +30 -3     jakarta-commons/collections/src/test/org/apache/commons/collections/TestIterator.java
  
  Index: TestIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestIterator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestIterator.java	25 Feb 2002 23:26:25 -0000	1.3
  +++ TestIterator.java	25 Feb 2002 23:37:38 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestIterator.java,v
1.3 2002/02/25 23:26:25 morgand Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/02/25 23:26:25 $
  + * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestIterator.java,v
1.4 2002/02/25 23:37:38 morgand Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/02/25 23:37:38 $
    *
    * ====================================================================
    *
  @@ -79,11 +79,34 @@
   
       public abstract Iterator makeFullIterator();
   
  +    /**
  +     * Whether or not we are testing an iterator that can be
  +     * empty.  Default is true.
  +     * 
  +     * @return true if Iterators can be empty
  +     */
  +    public boolean supportsEmptyIterator() {
  +        return true;
  +    }
  +
  +    /**
  +     * Whether or not we are testing an iterator that can contain
  +     * elements.  Default is true.
  +     * 
  +     * @return true if Iterators can be empty
  +     */
  +    public boolean supportsFullIterator() {
  +        return true;
  +    }
   
       /**
        * Should throw a NoSuchElementException.
        */
       public void testEmptyIterator() {
  +        if (supportsEmptyIterator() == false) {
  +            return;
  +        }
  +
           Iterator iter = makeEmptyIterator();
           assertTrue("hasNext() should return false for empty iterators",iter.hasNext() ==
false);
           try {
  @@ -100,6 +123,10 @@
        * hasNext() returns false
        */
       public void testFullIterator() {
  +        if (supportsFullIterator() == false) {
  +            return;
  +        }
  +
           Iterator iter = makeFullIterator();
   
           assertTrue("hasNext() should return true for at least one element",iter.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