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/map TestLazySortedMap.java
Date Fri, 09 Apr 2004 09:39:47 GMT
scolebourne    2004/04/09 02:39:47

  Modified:    collections/src/test/org/apache/commons/collections/map
                        TestLazySortedMap.java
  Log:
  Change to extend AbstractTestSortedMap
  
  Revision  Changes    Path
  1.6       +37 -10    jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestLazySortedMap.java
  
  Index: TestLazySortedMap.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/map/TestLazySortedMap.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestLazySortedMap.java	7 Apr 2004 23:05:37 -0000	1.5
  +++ TestLazySortedMap.java	9 Apr 2004 09:39:47 -0000	1.6
  @@ -24,6 +24,7 @@
   import junit.framework.TestSuite;
   
   import org.apache.commons.collections.Factory;
  +import org.apache.commons.collections.FactoryUtils;
   import org.apache.commons.collections.Transformer;
   import org.apache.commons.collections.TransformerUtils;
   
  @@ -36,7 +37,10 @@
    * 
    * @author Phil Steitz
    */
  -public class TestLazySortedMap extends TestLazyMap {
  +public class TestLazySortedMap extends AbstractTestSortedMap {
  +    
  +    protected static final Factory oneFactory = FactoryUtils.constantFactory("One");
  +    protected static final Factory nullFactory = FactoryUtils.nullFactory();
       
       public TestLazySortedMap(String testName) {
           super(testName);
  @@ -50,9 +54,8 @@
           String[] testCaseName = { TestLazySortedMap.class.getName()};
           junit.textui.TestRunner.main(testCaseName);
       }
  -    
  - //-------------------------------------------------------------------
  -    
  +
  +    //-----------------------------------------------------------------------    
       protected SortedMap decorateMap(SortedMap map, Factory factory) {
           return LazySortedMap.decorate(map, factory);
       }
  @@ -61,16 +64,40 @@
           return decorateMap(new TreeMap(), nullFactory);
       }
       
  +    protected SortedMap makeTestSortedMap(Factory factory) {
  +        return decorateMap(new TreeMap(), factory);
  +    }
  +    
  +    public boolean isSubMapViewsSerializable() {
  +        // TreeMap sub map views have a bug in deserialization.
  +        return false;
  +    }
  +
       public boolean isAllowNullKey() {
           return false;
       }
  -    
  -//--------------------------------------------------------------------   
  -    
  -    protected SortedMap makeTestSortedMap(Factory factory) {
  -        return decorateMap(new TreeMap(), factory);
  +
  +    // from TestLazyMap
  +    //-----------------------------------------------------------------------
  +    public void testMapGet() {
  +        Map map = makeTestSortedMap(oneFactory);
  +        assertEquals(0, map.size());
  +        String s1 = (String) map.get("Five");
  +        assertEquals("One", s1);
  +        assertEquals(1, map.size());
  +        String s2 = (String) map.get(new String(new char[] {'F','i','v','e'}));
  +        assertEquals("One", s2);
  +        assertEquals(1, map.size());
  +        assertSame(s1, s2);
  +        
  +        map = makeTestSortedMap(nullFactory);
  +        Object o = map.get("Five");
  +        assertEquals(null,o);
  +        assertEquals(1, map.size());
  +        
       }
       
  +    //-----------------------------------------------------------------------
       public void testSortOrder() {
           SortedMap map = makeTestSortedMap(oneFactory);
           map.put("A",  "a");
  
  
  

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