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 project.xml
Date Mon, 21 Jun 2004 22:30:05 GMT
scolebourne    2004/06/21 15:30:05

  Modified:    collections/src/test/org/apache/commons/collections/bidimap
                        TestDualTreeBidiMap2.java
               collections project.xml
  Log:
  Add test case for DualTreeBidiMap sort order
  bug 29519, from Jonas Van Poucke
  
  Revision  Changes    Path
  1.2       +25 -1     jakarta-commons/collections/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java
  
  Index: TestDualTreeBidiMap2.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/bidimap/TestDualTreeBidiMap2.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestDualTreeBidiMap2.java	11 Jun 2004 23:29:07 -0000	1.1
  +++ TestDualTreeBidiMap2.java	21 Jun 2004 22:30:05 -0000	1.2
  @@ -20,6 +20,10 @@
   import java.io.ObjectInputStream;
   import java.io.ObjectOutputStream;
   import java.io.Serializable;
  +import java.util.Arrays;
  +import java.util.Collections;
  +import java.util.Iterator;
  +import java.util.List;
   import java.util.Map;
   import java.util.TreeMap;
   
  @@ -39,6 +43,7 @@
    * 
    * @author Matthew Hawthorne
    * @author Stephen Colebourne
  + * @author Jonas Van Poucke
    */
   public class TestDualTreeBidiMap2 extends AbstractTestSortedBidiMap {
   
  @@ -85,6 +90,25 @@
               assertNotNull(obj.comparator());
               assertNotNull(bidi.comparator());
               assertTrue(bidi.comparator() instanceof ReverseComparator);
  +        }
  +    }
  +
  +    public void testSortOrder() throws Exception {
  +        SortedBidiMap sm = (SortedBidiMap) makeFullMap();
  +
  +        // Sort by the comparator used in the makeEmptyBidiMap() method
  +        List newSortedKeys = Arrays.asList(getSampleKeys());
  +        Collections.sort(newSortedKeys, new ReverseComparator(ComparableComparator.getInstance()));
  +        newSortedKeys = Collections.unmodifiableList(newSortedKeys);
  +
  +        Iterator mapIter = sm.keySet().iterator();
  +        Iterator expectedIter = newSortedKeys.iterator();
  +        while (expectedIter.hasNext()) {
  +            Object expectedKey = expectedIter.next();
  +            Object mapKey = mapIter.next();
  +            assertNotNull("key in sorted list may not be null", expectedKey);
  +            assertNotNull("key in map may not be null", mapKey);
  +            assertEquals("key from sorted list and map must be equal", expectedKey, mapKey);
           }
       }
   
  
  
  
  1.41      +3 -0      jakarta-commons/collections/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/project.xml,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- project.xml	9 Jun 2004 20:47:59 -0000	1.40
  +++ project.xml	21 Jun 2004 22:30:05 -0000	1.41
  @@ -240,6 +240,9 @@
         <name>Ilkka Priha</name>
       </contributor>
       <contributor>
  +      <name>Jonas Van Poucke</name>
  +    </contributor>
  +    <contributor>
         <name>Herve Quiroz</name>
       </contributor>
       <contributor>
  
  
  

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