You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2007/09/18 21:58:28 UTC
svn commit: r577034 -
/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
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");