commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r577034 - /commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
Date Tue, 18 Sep 2007 19:58:28 GMT
Author: oheger
Date: Tue Sep 18 12:58:28 2007
New Revision: 577034

URL: http://svn.apache.org/viewvc?rev=577034&view=rev
Log:
Added an additional test case for setting an attribute for the root element of a XMLConfiguration
after a question on the user list

Modified:
    commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java

Modified: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java?rev=577034&r1=577033&r2=577034&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
Tue Sep 18 12:58:28 2007
@@ -287,6 +287,22 @@
         assertTrue("test.boolean[@value]", conf.getBoolean("test.boolean[@value]"));
     }
 
+    /**
+     * Tests setting an attribute on the root element.
+     */
+    public void testSetRootAttribute() throws ConfigurationException
+    {
+        conf.setProperty("[@test]", "true");
+        assertEquals("Root attribute not set", "true", conf
+                .getString("[@test]"));
+        conf.save(testSaveConf);
+        XMLConfiguration checkConf = new XMLConfiguration();
+        checkConf.setFile(testSaveConf);
+        checkSavedConfig(checkConf);
+        assertTrue("Attribute not found after save", checkConf
+                .containsKey("[@test]"));
+    }
+
     public void testAddList()
     {
         conf.addProperty("test.array", "value1");



Mime
View raw message