Author: oheger Date: Sat Mar 8 12:39:59 2008 New Revision: 635076 URL: http://svn.apache.org/viewvc?rev=635076&view=rev Log: Change isDefined() method: the children of a node are no longer taken into account because this is done automatically during the visit process.
Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/expr/ConfigurationNodeHandler.java commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/expr/TestConfigurationNodeHandler.java Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/expr/ConfigurationNodeHandler.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/expr/ConfigurationNodeHandler.java?rev=635076&r1=635075&r2=635076&view=diff ============================================================================== --- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/expr/ConfigurationNodeHandler.java (original) +++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/expr/ConfigurationNodeHandler.java Sat Mar 8 12:39:59 2008 @@ -223,14 +223,13 @@ /** * Tests whether the passed in node is defined. This implementation checks - * whether the node has a value, any attributes or any children. + * whether the node has a value or any attributes. * * @param node the node to test * @return a flag whether this node is defined */ public boolean isDefined(ConfigurationNode node) { - return node.getValue() != null || !node.getAttributes().isEmpty() - || !node.getChildren().isEmpty(); + return node.getValue() != null || !node.getAttributes().isEmpty(); } } Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/expr/TestConfigurationNodeHandler.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/expr/TestConfigurationNodeHandler.java?rev=635076&r1=635075&r2=635076&view=diff ============================================================================== --- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/expr/TestConfigurationNodeHandler.java (original) +++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/expr/TestConfigurationNodeHandler.java Sat Mar 8 12:39:59 2008 @@ -298,16 +298,6 @@ } /** - * Tests the isDefined() method when the node in question has children. - */ - public void testIsDefinedChildren() - { - ConfigurationNode node = new DefaultConfigurationNode(NAME); - node.addChild(new DefaultConfigurationNode("child", VALUE)); - assertTrue("Node not defined", handler.isDefined(node)); - } - - /** * Tests the isDefined() method for an undefined node. */ public void testIsDefinedEmpty() @@ -316,7 +306,6 @@ EasyMock.expect(node.getValue()).andReturn(null); List<ConfigurationNode> emptyList = new ArrayList<ConfigurationNode>(); EasyMock.expect(node.getAttributes()).andReturn(emptyList); - EasyMock.expect(node.getChildren()).andReturn(emptyList); EasyMock.replay(node); assertFalse("Node is defined", handler.isDefined(node)); EasyMock.verify(node);