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 TestIteratorUtils.java
Date Sat, 22 May 2004 09:46:39 GMT
scolebourne    2004/05/22 02:46:39

  Modified:    collections/src/java/org/apache/commons/collections
                        IteratorUtils.java
               collections RELEASE-NOTES.html
               collections/src/test/org/apache/commons/collections
                        TestIteratorUtils.java
  Added:       collections/src/java/org/apache/commons/collections/iterators
                        EmptyMapIterator.java AbstractEmptyIterator.java
                        EmptyOrderedMapIterator.java EmptyIterator.java
                        EmptyListIterator.java
  Log:
  Convert EmptyIterator classes in IteratorUtils to public in iterator package
  
  Revision  Changes    Path
  1.26      +23 -132   jakarta-commons/collections/src/java/org/apache/commons/collections/IteratorUtils.java
  
  Index: IteratorUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/IteratorUtils.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- IteratorUtils.java	21 May 2004 22:43:10 -0000	1.25
  +++ IteratorUtils.java	22 May 2004 09:46:39 -0000	1.26
  @@ -26,11 +26,14 @@
   import java.util.List;
   import java.util.ListIterator;
   import java.util.Map;
  -import java.util.NoSuchElementException;
   
   import org.apache.commons.collections.iterators.ArrayIterator;
   import org.apache.commons.collections.iterators.ArrayListIterator;
   import org.apache.commons.collections.iterators.CollatingIterator;
  +import org.apache.commons.collections.iterators.EmptyIterator;
  +import org.apache.commons.collections.iterators.EmptyListIterator;
  +import org.apache.commons.collections.iterators.EmptyMapIterator;
  +import org.apache.commons.collections.iterators.EmptyOrderedMapIterator;
   import org.apache.commons.collections.iterators.EnumerationIterator;
   import org.apache.commons.collections.iterators.FilterIterator;
   import org.apache.commons.collections.iterators.FilterListIterator;
  @@ -51,6 +54,13 @@
   /**
    * Provides static utility methods and decorators for {@link Iterator} 
    * instances. The implementations are provided in the iterators subpackage.
  + * <p>
  + * WARNING: Due to human error certain binary incompatabilities were introduced
  + * between Commons Collections 2.1 and 3.0. The class remained source and test
  + * compatible, so if you can recompile all your classes and dependencies
  + * everything is OK. Those methods which are binary incompatible are marked as
  + * such, together with alternate solutions that are binary compatible
  + * against versions 2.1.1 and 3.1.
    *
    * @since Commons Collections 2.1
    * @version $Revision$ $Date$
  @@ -66,26 +76,28 @@
        * An iterator over no elements.
        * <p>
        * WARNING: This constant is binary incompatible with Commons Collections 2.1.
  -     */    
  -    public static final ResettableIterator EMPTY_ITERATOR = new EmptyIterator();
  +     * Use <code>EmptyIterator.INSTANCE</code> for compatability with Commons
Collections 2.1.1.
  +     */
  +    public static final ResettableIterator EMPTY_ITERATOR = EmptyIterator.RESETTABLE_INSTANCE;
       /**
        * A list iterator over no elements.
        * <p>
        * WARNING: This constant is binary incompatible with Commons Collections 2.1.
  -     */    
  -    public static final ResettableListIterator EMPTY_LIST_ITERATOR = new EmptyListIterator();
  +     * Use <code>EmptyListIterator.INSTANCE</code> for compatability with Commons
Collections 2.1.1.
  +     */
  +    public static final ResettableListIterator EMPTY_LIST_ITERATOR = EmptyListIterator.RESETTABLE_INSTANCE;
       /**
        * An ordered iterator over no elements.
        */    
  -    public static final OrderedIterator EMPTY_ORDERED_ITERATOR = new EmptyOrderedIterator();
  +    public static final OrderedIterator EMPTY_ORDERED_ITERATOR = EmptyListIterator.ORDERED_INSTANCE;
       /**
        * A map iterator over no elements.
        */    
  -    public static final MapIterator EMPTY_MAP_ITERATOR = new EmptyMapIterator();
  +    public static final MapIterator EMPTY_MAP_ITERATOR = EmptyMapIterator.INSTANCE;
       /**
        * An ordered map iterator over no elements.
        */    
  -    public static final OrderedMapIterator EMPTY_ORDERED_MAP_ITERATOR = new EmptyOrderedMapIterator();
  +    public static final OrderedMapIterator EMPTY_ORDERED_MAP_ITERATOR = EmptyOrderedMapIterator.INSTANCE;
   
       /**
        * IteratorUtils is not normally instantiated.
  @@ -102,6 +114,7 @@
        * nothing.
        * <p>
        * WARNING: This method is binary incompatible with Commons Collections 2.1.
  +     * Use <code>EmptyIterator.INSTANCE</code> for compatability with Commons
Collections 2.1.1.
        *
        * @return  an iterator over nothing
        */
  @@ -116,6 +129,7 @@
        * over nothing.
        * <p>
        * WARNING: This method is binary incompatible with Commons Collections 2.1.
  +     * Use <code>EmptyListIterator.INSTANCE</code> for compatability with Commons
Collections 2.1.1.
        *
        * @return  a list iterator over nothing
        */
  @@ -873,129 +887,6 @@
                   // ignore
               }
               return singletonIterator(obj);
  -        }
  -    }
  -    
  -    //-----------------------------------------------------------------------
  -    /**
  -     * EmptyIterator class
  -     */
  -    static class EmptyIterator implements ResettableIterator {
  -        
  -        EmptyIterator() {
  -            super();
  -        }
  -
  -        public boolean hasNext() {
  -            return false;
  -        }
  -
  -        public Object next() {
  -            throw new NoSuchElementException("Iterator contains no elements");
  -        }
  -
  -        public void remove() {
  -            throw new IllegalStateException("Iterator contains no elements");
  -        }
  -        
  -        public void reset() {
  -            // do nothing
  -        }
  -    }
  -    
  -    //-----------------------------------------------------------------------    
  -    /**
  -     * EmptyListIterator class
  -     */
  -    static class EmptyListIterator extends EmptyIterator implements ResettableListIterator
{
  -        
  -        EmptyListIterator() {
  -            super();
  -        }
  -
  -        public boolean hasPrevious() {
  -            return false;
  -        }
  -
  -        public Object previous() {
  -            throw new NoSuchElementException("Iterator contains no elements");
  -        }
  -
  -        public int nextIndex() {
  -            return 0;
  -        }
  -
  -        public int previousIndex() {
  -            return -1;
  -        }
  -
  -        public void add(Object o) {
  -            throw new UnsupportedOperationException("add() not supported for empty Iterator");
  -        }
  -
  -        public void set(Object o) {
  -            throw new IllegalStateException("Iterator contains no elements");
  -        }
  -    }
  -
  -    //-----------------------------------------------------------------------    
  -    /**
  -     * EmptyOrderedIterator class
  -     */
  -    static class EmptyOrderedIterator extends EmptyIterator implements OrderedIterator,
ResettableIterator {
  -        
  -        EmptyOrderedIterator() {
  -            super();
  -        }
  -        
  -        public boolean hasPrevious() {
  -            return false;
  -        }
  -        
  -        public Object previous() {
  -            throw new NoSuchElementException("Iterator contains no elements");
  -        }
  -    }
  -
  -    //-----------------------------------------------------------------------    
  -    /**
  -     * EmptyMapIterator class
  -     */
  -    static class EmptyMapIterator extends EmptyIterator implements MapIterator, ResettableIterator
{
  -        
  -        EmptyMapIterator() {
  -            super();
  -        }
  -        
  -        public Object getKey() {
  -            throw new IllegalStateException("Iterator contains no elements");
  -        }
  -
  -        public Object getValue() {
  -            throw new IllegalStateException("Iterator contains no elements");
  -        }
  -
  -        public Object setValue(Object value) {
  -            throw new IllegalStateException("Iterator contains no elements");
  -        }
  -    }
  -
  -    //-----------------------------------------------------------------------    
  -    /**
  -     * EmptyOrderedMapIterator class
  -     */
  -    static class EmptyOrderedMapIterator extends EmptyMapIterator implements OrderedMapIterator,
ResettableIterator {
  -        
  -        EmptyOrderedMapIterator() {
  -            super();
  -        }
  -        
  -        public boolean hasPrevious() {
  -            return false;
  -        }
  -        
  -        public Object previous() {
  -            throw new NoSuchElementException("Iterator contains no elements");
           }
       }
   
  
  
  
  1.52      +2 -1      jakarta-commons/collections/RELEASE-NOTES.html
  
  Index: RELEASE-NOTES.html
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/RELEASE-NOTES.html,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- RELEASE-NOTES.html	21 May 2004 22:02:43 -0000	1.51
  +++ RELEASE-NOTES.html	22 May 2004 09:46:39 -0000	1.52
  @@ -39,6 +39,7 @@
   <li>MapBackedSet - Set created by decorating a map</li>
   <li>ReferenceIdentityMap - Similar to ReferenceMap, but matching keys and values
by identity [26503]</li>
   <li>AbstractReferenceMap - New base class for reference maps [26503]</li>
  +<li>Empty*Iterator - Iterators over empty collections</li>
   </ul>
   
   <center><h3>ENHANCEMENTS</h3></center>
  @@ -98,5 +99,5 @@
   <li>BoundedCollection/UnmodifiableBoundedCollection - reword to avoid misunderstandings</li>
   <li>Closure/Predicate/Transformer/Factory - Additional javadoc with links</li>
   <li>ClosureUtils/PredicateUtils/TransformerUtils/FactoryUtils - Additional links
to implementations</li>
  -<li>PredicatedXxx - Additional usage explanation [29018]</li>
  +<li>Predicated* - Additional usage explanation [29018]</li>
   </ul>
  
  
  
  1.1                  jakarta-commons/collections/src/java/org/apache/commons/collections/iterators/EmptyMapIterator.java
  
  Index: EmptyMapIterator.java
  ===================================================================
  /*
   *  Copyright 2004 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  package org.apache.commons.collections.iterators;
  
  import org.apache.commons.collections.MapIterator;
  import org.apache.commons.collections.ResettableIterator;
  
  /** 
   * Provides an implementation of an empty map iterator.
   *
   * @since Commons Collections 3.1
   * @version $Revision: 1.1 $ $Date: 2004/05/22 09:46:39 $
   * 
   * @author Stephen Colebourne
   */
  public class EmptyMapIterator extends AbstractEmptyIterator implements MapIterator, ResettableIterator
{
  
      /**
       * Singleton instance of the iterator.
       * @since Commons Collections 3.1
       */
      public static final MapIterator INSTANCE = new EmptyMapIterator();
  
      /**
       * Constructor.
       */
      protected EmptyMapIterator() {
          super();
      }
  
  }
  
  
  
  1.1                  jakarta-commons/collections/src/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java
  
  Index: AbstractEmptyIterator.java
  ===================================================================
  /*
   *  Copyright 2004 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  package org.apache.commons.collections.iterators;
  
  import java.util.NoSuchElementException;
  
  /** 
   * Provides an implementation of an empty iterator.
   *
   * @since Commons Collections 3.1
   * @version $Revision: 1.1 $ $Date: 2004/05/22 09:46:39 $
   * 
   * @author Stephen Colebourne
   */
  public abstract class AbstractEmptyIterator {
   
      /**
       * Constructor.
       */
      protected AbstractEmptyIterator() {
          super();
      }
  
      public boolean hasNext() {
          return false;
      }
  
      public Object next() {
          throw new NoSuchElementException("Iterator contains no elements");
      }
  
      public boolean hasPrevious() {
          return false;
      }
  
      public Object previous() {
          throw new NoSuchElementException("Iterator contains no elements");
      }
  
      public int nextIndex() {
          return 0;
      }
  
      public int previousIndex() {
          return -1;
      }
  
      public void add(Object obj) {
          throw new UnsupportedOperationException("add() not supported for empty Iterator");
      }
  
      public void set(Object obj) {
          throw new IllegalStateException("Iterator contains no elements");
      }
  
      public void remove() {
          throw new IllegalStateException("Iterator contains no elements");
      }
  
      public Object getKey() {
          throw new IllegalStateException("Iterator contains no elements");
      }
  
      public Object getValue() {
          throw new IllegalStateException("Iterator contains no elements");
      }
  
      public Object setValue(Object value) {
          throw new IllegalStateException("Iterator contains no elements");
      }
  
      public void reset() {
          // do nothing
      }
  
  }
  
  
  
  1.1                  jakarta-commons/collections/src/java/org/apache/commons/collections/iterators/EmptyOrderedMapIterator.java
  
  Index: EmptyOrderedMapIterator.java
  ===================================================================
  /*
   *  Copyright 2004 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  package org.apache.commons.collections.iterators;
  
  import org.apache.commons.collections.OrderedMapIterator;
  import org.apache.commons.collections.ResettableIterator;
  
  /** 
   * Provides an implementation of an empty ordered map iterator.
   *
   * @since Commons Collections 3.1
   * @version $Revision: 1.1 $ $Date: 2004/05/22 09:46:39 $
   * 
   * @author Stephen Colebourne
   */
  public class EmptyOrderedMapIterator extends AbstractEmptyIterator implements OrderedMapIterator,
ResettableIterator {
  
      /**
       * Singleton instance of the iterator.
       * @since Commons Collections 3.1
       */
      public static final OrderedMapIterator INSTANCE = new EmptyOrderedMapIterator();
  
      /**
       * Constructor.
       */
      protected EmptyOrderedMapIterator() {
          super();
      }
  
  }
  
  
  
  1.1                  jakarta-commons/collections/src/java/org/apache/commons/collections/iterators/EmptyIterator.java
  
  Index: EmptyIterator.java
  ===================================================================
  /*
   *  Copyright 2004 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  package org.apache.commons.collections.iterators;
  
  import java.util.Iterator;
  
  import org.apache.commons.collections.ResettableIterator;
  
  /** 
   * Provides an implementation of an empty iterator.
   * <p>
   * This class provides an implementation of an empty iterator.
   * This class provides for binary compatability between Commons Collections
   * 2.1.1 and 3.1 due to issues with <code>IteratorUtils</code>.
   *
   * @since Commons Collections 2.1.1 and 3.1
   * @version $Revision: 1.1 $ $Date: 2004/05/22 09:46:39 $
   * 
   * @author Stephen Colebourne
   */
  public class EmptyIterator extends AbstractEmptyIterator implements ResettableIterator {
  
      /**
       * Singleton instance of the iterator.
       * @since Commons Collections 3.1
       */
      public static final ResettableIterator RESETTABLE_INSTANCE = new EmptyIterator();
      /**
       * Singleton instance of the iterator.
       * @since Commons Collections 2.1.1 and 3.1
       */
      public static final Iterator INSTANCE = RESETTABLE_INSTANCE;
  
      /**
       * Constructor.
       */
      protected EmptyIterator() {
          super();
      }
  
  }
  
  
  
  1.1                  jakarta-commons/collections/src/java/org/apache/commons/collections/iterators/EmptyListIterator.java
  
  Index: EmptyListIterator.java
  ===================================================================
  /*
   *  Copyright 2004 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  package org.apache.commons.collections.iterators;
  
  import java.util.ListIterator;
  
  import org.apache.commons.collections.OrderedIterator;
  import org.apache.commons.collections.ResettableListIterator;
  
  /** 
   * Provides an implementation of an empty list iterator.
   * <p>
   * This class provides an implementation of an empty list iterator.
   * This class provides for binary compatability between Commons Collections
   * 2.1.1 and 3.1 due to issues with <code>IteratorUtils</code>.
   *
   * @since Commons Collections 2.1.1 and 3.1
   * @version $Revision: 1.1 $ $Date: 2004/05/22 09:46:39 $
   * 
   * @author Stephen Colebourne
   */
  public class EmptyListIterator extends AbstractEmptyIterator implements ResettableListIterator,
OrderedIterator {
  
      /**
       * Singleton instance of the iterator.
       * @since Commons Collections 3.1
       */
      public static final ResettableListIterator RESETTABLE_INSTANCE = new EmptyListIterator();
      /**
       * Singleton instance of the iterator.
       * @since Commons Collections 2.1.1 and 3.1
       */
      public static final ListIterator INSTANCE = RESETTABLE_INSTANCE;
      /**
       * Singleton instance of the iterator.
       * @since Commons Collections 3.1
       */
      public static final OrderedIterator ORDERED_INSTANCE = (OrderedIterator) RESETTABLE_INSTANCE;
  
      /**
       * Constructor.
       */
      protected EmptyListIterator() {
          super();
      }
  
  }
  
  
  
  1.15      +37 -17    jakarta-commons/collections/src/test/org/apache/commons/collections/TestIteratorUtils.java
  
  Index: TestIteratorUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestIteratorUtils.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TestIteratorUtils.java	18 Feb 2004 01:20:35 -0000	1.14
  +++ TestIteratorUtils.java	22 May 2004 09:46:39 -0000	1.15
  @@ -24,6 +24,10 @@
   
   import junit.framework.Test;
   
  +import org.apache.commons.collections.iterators.EmptyIterator;
  +import org.apache.commons.collections.iterators.EmptyListIterator;
  +import org.apache.commons.collections.iterators.EmptyMapIterator;
  +import org.apache.commons.collections.iterators.EmptyOrderedMapIterator;
   
   /**
    * Tests for IteratorUtils.
  @@ -385,8 +389,13 @@
        * Test empty iterator
        */
       public void testEmptyIterator() {
  -        assertTrue(IteratorUtils.EMPTY_ITERATOR instanceof Iterator);
  -        assertTrue(IteratorUtils.EMPTY_ITERATOR instanceof ResettableIterator);
  +        assertSame(EmptyIterator.INSTANCE, IteratorUtils.EMPTY_ITERATOR);
  +        assertSame(EmptyIterator.RESETTABLE_INSTANCE, IteratorUtils.EMPTY_ITERATOR);
  +        assertEquals(true, IteratorUtils.EMPTY_ITERATOR instanceof Iterator);
  +        assertEquals(true, IteratorUtils.EMPTY_ITERATOR instanceof ResettableIterator);
  +        assertEquals(false, IteratorUtils.EMPTY_ITERATOR instanceof OrderedIterator);
  +        assertEquals(false, IteratorUtils.EMPTY_ITERATOR instanceof ListIterator);
  +        assertEquals(false, IteratorUtils.EMPTY_ITERATOR instanceof MapIterator);
           assertEquals(false, IteratorUtils.EMPTY_ITERATOR.hasNext());
           IteratorUtils.EMPTY_ITERATOR.reset();
           assertSame(IteratorUtils.EMPTY_ITERATOR, IteratorUtils.EMPTY_ITERATOR);
  @@ -406,10 +415,13 @@
        * Test empty list iterator
        */
       public void testEmptyListIterator() {
  -        assertTrue(IteratorUtils.EMPTY_LIST_ITERATOR instanceof Iterator);
  -        assertTrue(IteratorUtils.EMPTY_LIST_ITERATOR instanceof ListIterator);
  -        assertTrue(IteratorUtils.EMPTY_LIST_ITERATOR instanceof ResettableIterator);
  -        assertTrue(IteratorUtils.EMPTY_LIST_ITERATOR instanceof ResettableListIterator);
  +        assertSame(EmptyListIterator.INSTANCE, IteratorUtils.EMPTY_LIST_ITERATOR);
  +        assertSame(EmptyListIterator.RESETTABLE_INSTANCE, IteratorUtils.EMPTY_LIST_ITERATOR);
  +        assertEquals(true, IteratorUtils.EMPTY_LIST_ITERATOR instanceof Iterator);
  +        assertEquals(true, IteratorUtils.EMPTY_LIST_ITERATOR instanceof ListIterator);
  +        assertEquals(true, IteratorUtils.EMPTY_LIST_ITERATOR instanceof ResettableIterator);
  +        assertEquals(true, IteratorUtils.EMPTY_LIST_ITERATOR instanceof ResettableListIterator);
  +        assertEquals(false, IteratorUtils.EMPTY_LIST_ITERATOR instanceof MapIterator);
           assertEquals(false, IteratorUtils.EMPTY_LIST_ITERATOR.hasNext());
           assertEquals(0, IteratorUtils.EMPTY_LIST_ITERATOR.nextIndex());
           assertEquals(-1, IteratorUtils.EMPTY_LIST_ITERATOR.previousIndex());
  @@ -443,9 +455,13 @@
        * Test empty map iterator
        */
       public void testEmptyMapIterator() {
  -        assertTrue(IteratorUtils.EMPTY_MAP_ITERATOR instanceof Iterator);
  -        assertTrue(IteratorUtils.EMPTY_MAP_ITERATOR instanceof MapIterator);
  -        assertTrue(IteratorUtils.EMPTY_MAP_ITERATOR instanceof ResettableIterator);
  +        assertSame(EmptyMapIterator.INSTANCE, IteratorUtils.EMPTY_MAP_ITERATOR);
  +        assertEquals(true, IteratorUtils.EMPTY_MAP_ITERATOR instanceof Iterator);
  +        assertEquals(true, IteratorUtils.EMPTY_MAP_ITERATOR instanceof MapIterator);
  +        assertEquals(true, IteratorUtils.EMPTY_MAP_ITERATOR instanceof ResettableIterator);
  +        assertEquals(false, IteratorUtils.EMPTY_MAP_ITERATOR instanceof ListIterator);
  +        assertEquals(false, IteratorUtils.EMPTY_MAP_ITERATOR instanceof OrderedIterator);
  +        assertEquals(false, IteratorUtils.EMPTY_MAP_ITERATOR instanceof OrderedMapIterator);
           assertEquals(false, IteratorUtils.EMPTY_MAP_ITERATOR.hasNext());
           ((ResettableIterator) IteratorUtils.EMPTY_MAP_ITERATOR).reset();
           assertSame(IteratorUtils.EMPTY_MAP_ITERATOR, IteratorUtils.EMPTY_MAP_ITERATOR);
  @@ -477,9 +493,11 @@
        * Test empty map iterator
        */
       public void testEmptyOrderedIterator() {
  -        assertTrue(IteratorUtils.EMPTY_ORDERED_ITERATOR instanceof Iterator);
  -        assertTrue(IteratorUtils.EMPTY_ORDERED_ITERATOR instanceof OrderedIterator);
  -        assertTrue(IteratorUtils.EMPTY_ORDERED_ITERATOR instanceof ResettableIterator);
  +        assertSame(EmptyListIterator.ORDERED_INSTANCE, IteratorUtils.EMPTY_ORDERED_ITERATOR);
  +        assertEquals(true, IteratorUtils.EMPTY_ORDERED_ITERATOR instanceof Iterator);
  +        assertEquals(true, IteratorUtils.EMPTY_ORDERED_ITERATOR instanceof OrderedIterator);
  +        assertEquals(true, IteratorUtils.EMPTY_ORDERED_ITERATOR instanceof ResettableIterator);
  +        assertEquals(false, IteratorUtils.EMPTY_ORDERED_ITERATOR instanceof MapIterator);
           assertEquals(false, IteratorUtils.EMPTY_ORDERED_ITERATOR.hasNext());
           assertEquals(false, IteratorUtils.EMPTY_ORDERED_ITERATOR.hasPrevious());
           ((ResettableIterator) IteratorUtils.EMPTY_ORDERED_ITERATOR).reset();
  @@ -504,10 +522,12 @@
        * Test empty map iterator
        */
       public void testEmptyOrderedMapIterator() {
  -        assertTrue(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof Iterator);
  -        assertTrue(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof MapIterator);
  -        assertTrue(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof OrderedMapIterator);
  -        assertTrue(IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof ResettableIterator);
  +        assertSame(EmptyOrderedMapIterator.INSTANCE, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR);
  +        assertEquals(true, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof Iterator);
  +        assertEquals(true, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof MapIterator);
  +        assertEquals(true, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof OrderedMapIterator);
  +        assertEquals(true, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof ResettableIterator);
  +        assertEquals(false, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR instanceof ListIterator);
           assertEquals(false, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR.hasNext());
           assertEquals(false, IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR.hasPrevious());
           ((ResettableIterator) IteratorUtils.EMPTY_ORDERED_MAP_ITERATOR).reset();
  
  
  

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