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 TestConfigurationUtils.java
Date Mon, 12 Jul 2004 14:12:22 GMT
ebourg      2004/07/12 07:12:22

  Modified:    configuration/src/java/org/apache/commons/configuration
                        ConfigurationUtils.java
               configuration/src/test/org/apache/commons/configuration
                        TestConfigurationUtils.java
  Log:
  Improved test coverage for ConfigurationUtils
  
  Revision  Changes    Path
  1.6       +4 -14     jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationUtils.java
  
  Index: ConfigurationUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationUtils.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ConfigurationUtils.java	12 Jul 2004 12:14:38 -0000	1.5
  +++ ConfigurationUtils.java	12 Jul 2004 14:12:22 -0000	1.6
  @@ -51,19 +51,7 @@
        */
       public static void dump(Configuration configuration, PrintStream out)
       {
  -        Iterator keys = configuration.getKeys();
  -        while (keys.hasNext())
  -        {
  -            String key = (String) keys.next();
  -            Object value = configuration.getProperty(key);
  -            out.print(key);
  -            out.print("=");
  -            out.print(value);
  -            if (keys.hasNext())
  -            {
  -                out.println();
  -            }
  -        }
  +        dump(configuration, new PrintWriter(out));
       }
   
       /**
  @@ -88,6 +76,8 @@
                   out.println();
               }
           }
  +
  +        out.flush();
       }
   
       /**
  
  
  
  1.4       +12 -18    jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestConfigurationUtils.java
  
  Index: TestConfigurationUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestConfigurationUtils.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestConfigurationUtils.java	27 Feb 2004 17:41:34 -0000	1.3
  +++ TestConfigurationUtils.java	12 Jul 2004 14:12:22 -0000	1.4
  @@ -17,6 +17,7 @@
    */
   
   import java.io.File;
  +import java.io.PrintStream;
   import java.net.URL;
   
   import junit.framework.TestCase;
  @@ -27,30 +28,23 @@
    */
   public class TestConfigurationUtils extends TestCase
   {
  -    protected Configuration configuration = new BaseConfiguration();
  +    protected Configuration config = new BaseConfiguration();
   
  -    public void testCompare()
  +    public void testToString()
       {
  -        assertEquals(
  -            "Get string representation of an empty configuration",
  -            "",
  -            ConfigurationUtils.toString(configuration));
  +        assertEquals("String representation of an empty configuration", "", ConfigurationUtils.toString(config));
   
  -        configuration.setProperty("one", "1");
  -        assertEquals(
  -            "Get string representation of a configuration",
  -            "one=1",
  -            ConfigurationUtils.toString(configuration));
  +        config.setProperty("one", "1");
  +        assertEquals("String representation of a configuration", "one=1", ConfigurationUtils.toString(config));
   
  -        configuration.setProperty("two", "2");
  -        /*        assertEquals("Get string representation of a configuration", "one=1\ntwo=2"
, ConfigurationUtils.toString(configuration));
  +        config.setProperty("two", "2");
  +        assertEquals("String representation of a configuration", "one=1\ntwo=2" , ConfigurationUtils.toString(config));
           
  -                configuration.clearProperty("one");
  -                assertEquals("Get string representation of a configuration", "two=2" ,
ConfigurationUtils.toString(configuration));
  +        config.clearProperty("one");
  +        assertEquals("String representation of a configuration", "two=2" , ConfigurationUtils.toString(config));
                   
  -                configuration.setProperty("one","1");
  -                assertEquals("Get string representation of a configuration", "two=2\none=1"
, ConfigurationUtils.toString(configuration));
  -        */
  +        config.setProperty("one","1");
  +        assertEquals("String representation of a configuration", "two=2\none=1" , ConfigurationUtils.toString(config));
       }
   
       public void testGetURL() throws Exception
  
  
  

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