Author: oheger
Date: Thu Jan 19 07:23:04 2012
New Revision: 1233218
URL: http://svn.apache.org/viewvc?rev=1233218&view=rev
Log:
[CONFIGURATION-472] Added a unit test.
Modified:
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java
Modified:
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java?rev=1233218&r1=1233217&r2=1233218&view=diff
==============================================================================
---
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java
(original)
+++
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java
Thu Jan 19 07:23:04 2012
@@ -1834,6 +1834,24 @@ public class TestXMLConfiguration
}
/**
+ * Tests whether it is possible to add nodes to a XMLConfiguration through
a
+ * SubnodeConfiguration and whether these nodes have the correct type. This
+ * test is related to CONFIGURATION-472.
+ */
+ @Test
+ public void testAddNodesToSubnodeConfiguration()
+ throws ConfigurationException
+ {
+ SubnodeConfiguration sub = conf.configurationAt("element2");
+ sub.addProperty("newKey", "newvalue");
+ ConfigurationNode root = conf.getRootNode();
+ ConfigurationNode elem = root.getChildren("element2").get(0);
+ ConfigurationNode newNode = elem.getChildren("newKey").get(0);
+ assertTrue("Wrong node type: " + newNode,
+ newNode instanceof XMLConfiguration.XMLNode);
+ }
+
+ /**
* Prepares a configuration object for testing a reload operation.
*
* @return the initialized configuration