commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject cvs commit: jakarta-commons/configuration/src/test/org/apache/commons/configuration TestConfigurationConverter.java
Date Mon, 18 Oct 2004 12:32:07 GMT
ebourg      2004/10/18 05:32:06

  Modified:    configuration/src/test/org/apache/commons/configuration
                        TestConfigurationConverter.java
  Log:
  Added a test for getMap
  Fixed the parameters order on the assertions
  
  Revision  Changes    Path
  1.7       +24 -12    jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestConfigurationConverter.java
  
  Index: TestConfigurationConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestConfigurationConverter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestConfigurationConverter.java	16 Aug 2004 22:16:31 -0000	1.6
  +++ TestConfigurationConverter.java	18 Oct 2004 12:32:06 -0000	1.7
  @@ -19,6 +19,7 @@
   import java.util.List;
   import java.util.Properties;
   import java.util.Vector;
  +import java.util.Map;
   
   import junit.framework.TestCase;
   import org.apache.commons.collections.ExtendedProperties;
  @@ -42,14 +43,14 @@
   
           Configuration config = ConfigurationConverter.getConfiguration(eprops);
   
  -        assertEquals("This returns 'teststring'", config.getString("string"), "teststring");
  +        assertEquals("This returns 'teststring'", "teststring", config.getString("string"));
           List item1 = config.getList("list");
  -        assertEquals("This returns 'item 1'", (String) item1.get(0), "item 1");
  +        assertEquals("This returns 'item 1'", "item 1", (String) item1.get(0));
   
           Vector item2 = config.getVector("list");
  -        assertEquals("This returns 'item 1'", (String) item2.get(0), "item 1");
  +        assertEquals("This returns 'item 1'", "item 1", (String) item2.get(0));
   
  -        assertEquals("This returns 123", config.getInt("int"), 123);
  +        assertEquals("This returns 123", 123, config.getInt("int"));
       }
   
       public void testPropertiesToConfiguration()
  @@ -61,14 +62,14 @@
   
           Configuration config = ConfigurationConverter.getConfiguration(props);
   
  -        assertEquals("This returns 'teststring'", config.getString("string"), "teststring");
  +        assertEquals("This returns 'teststring'", "teststring", config.getString("string"));
           List item1 = config.getList("list");
  -        assertEquals("This returns 'item 1'", (String) item1.get(0), "item 1");
  +        assertEquals("This returns 'item 1'", "item 1", (String) item1.get(0));
   
           Vector item2 = config.getVector("list");
  -        assertEquals("This returns 'item 1'", (String) item2.get(0), "item 1");
  +        assertEquals("This returns 'item 1'", "item 1", (String) item2.get(0));
   
  -        assertEquals("This returns 123", config.getInt("int"), 123);
  +        assertEquals("This returns 123", 123, config.getInt("int"));
       }
   
       public void testConfigurationToExtendedProperties()
  @@ -81,10 +82,10 @@
   
           ExtendedProperties eprops = ConfigurationConverter.getExtendedProperties(config);
   
  -        assertEquals("This returns 'teststring'", eprops.getString("string"), "teststring");
  +        assertEquals("This returns 'teststring'", "teststring", eprops.getString("string"));
           List list = eprops.getVector("list");
  -        assertEquals("This returns 'item 1'", (String) list.get(0), "item 1");
  -        assertEquals("This returns 123", eprops.getInt("int"), 123);
  +        assertEquals("This returns 'item 1'", "item 1", (String) list.get(0));
  +        assertEquals("This returns 123", 123, eprops.getInt("int"));
       }
   
       public void testConfigurationToProperties()
  @@ -99,6 +100,17 @@
           assertNotNull("null properties", props);
           assertEquals("'string' property", "teststring", props.getProperty("string"));
           assertEquals("'array' property", "item 1, item 2", props.getProperty("array"));
  +    }
  +
  +    public void testConfigurationToMap()
  +    {
  +        Configuration config = new BaseConfiguration();
  +        config.addProperty("string", "teststring");
  +
  +        Map map = ConfigurationConverter.getMap(config);
  +
  +        assertNotNull("null map", map);
  +        assertEquals("'string' property", "teststring", map.get("string"));
       }
   
   }
  
  
  

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