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("[EMAIL PROTECTED]", conf.getBoolean("[EMAIL PROTECTED]")); } + /** + * Tests setting an attribute on the root element. + */ + public void testSetRootAttribute() throws ConfigurationException + { + conf.setProperty("[EMAIL PROTECTED]", "true"); + assertEquals("Root attribute not set", "true", conf + .getString("[EMAIL PROTECTED]")); + conf.save(testSaveConf); + XMLConfiguration checkConf = new XMLConfiguration(); + checkConf.setFile(testSaveConf); + checkSavedConfig(checkConf); + assertTrue("Attribute not found after save", checkConf + .containsKey("[EMAIL PROTECTED]")); + } + public void testAddList() { conf.addProperty("test.array", "value1");