commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1226104 - /commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/
Date Sat, 31 Dec 2011 15:37:16 GMT
Author: oheger
Date: Sat Dec 31 15:37:16 2011
New Revision: 1226104

URL: http://svn.apache.org/viewvc?rev=1226104&view=rev
Log:
Converted tests to JUnit 4, fixed warnings.

Modified:
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/AbstractXPathTest.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationIteratorAttributes.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodeIteratorChildren.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointer.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointerFactory.java

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/AbstractXPathTest.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/AbstractXPathTest.java?rev=1226104&r1=1226103&r2=1226104&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/AbstractXPathTest.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/AbstractXPathTest.java
Sat Dec 31 15:37:16 2011
@@ -22,18 +22,20 @@ import java.util.List;
 import org.apache.commons.configuration.tree.ConfigurationNode;
 import org.apache.commons.configuration.tree.DefaultConfigurationNode;
 import org.apache.commons.jxpath.ri.model.NodeIterator;
-
-import junit.framework.TestCase;
+import org.junit.After;
+import org.junit.Before;
 
 /**
  * A base class for testing classes of the XPath package. This base class
  * creates a hierarchy of nodes in its setUp() method that can be used for test
  * cases.
  *
- * @author Oliver Heger
+ * @author <a
+ * href="http://commons.apache.org/configuration/team-list.html">Commons
+ * Configuration team</a>
  * @version $Id$
  */
-public abstract class AbstractXPathTest extends TestCase
+public abstract class AbstractXPathTest
 {
     /** Constant for the name of the counter attribute. */
     protected static final String ATTR_NAME = "counter";
@@ -53,24 +55,25 @@ public abstract class AbstractXPathTest 
     /** Stores the root node of the hierarchy. */
     protected ConfigurationNode root;
 
-    protected void setUp() throws Exception
+    @Before
+    public void setUp() throws Exception
     {
-        super.setUp();
         root = constructHierarchy(LEVEL_COUNT);
     }
 
     /**
      * Clears the test environment.
      */
-    protected void tearDown() throws Exception
+    @After
+    public void tearDown() throws Exception
     {
         root = null;
     }
 
     /**
-     * Builds up a hierarchy of nodes. Each node has <code>CHILD_COUNT</code>
-     * child nodes having the names <code>CHILD_NAME1</code> or
-     * <code>CHILD_NAME2</code>. Their values are named like their parent
+     * Builds up a hierarchy of nodes. Each node has {@code CHILD_COUNT}
+     * child nodes having the names {@code CHILD_NAME1} or
+     * {@code CHILD_NAME2}. Their values are named like their parent
      * node with an additional index. Each node has an attribute with a counter
      * value.
      *
@@ -115,12 +118,12 @@ public abstract class AbstractXPathTest 
      * @param iterator the iterator
      * @return a list with configuration nodes obtained from the iterator
      */
-    protected List iterationElements(NodeIterator iterator)
+    protected List<ConfigurationNode> iterationElements(NodeIterator iterator)
     {
-        List result = new ArrayList();
+        List<ConfigurationNode> result = new ArrayList<ConfigurationNode>();
         for (int pos = 1; iterator.setPosition(pos); pos++)
         {
-            result.add(iterator.getNodePointer().getNode());
+            result.add((ConfigurationNode) iterator.getNodePointer().getNode());
         }
         return result;
     }

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationIteratorAttributes.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationIteratorAttributes.java?rev=1226104&r1=1226103&r2=1226104&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationIteratorAttributes.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationIteratorAttributes.java
Sat Dec 31 15:37:16 2011
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.configuration.tree.xpath;
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.List;
 import java.util.Locale;
 
@@ -23,25 +25,31 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.tree.DefaultConfigurationNode;
 import org.apache.commons.jxpath.ri.QName;
 import org.apache.commons.jxpath.ri.model.NodePointer;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Test class for ConfigurationIteratorAttributes.
- * 
- * @author Oliver Heger
+ *
+ * @author <a
+ * href="http://commons.apache.org/configuration/team-list.html">Commons
+ * Configuration team</a>
  * @version $Id$
  */
 public class TestConfigurationIteratorAttributes extends AbstractXPathTest
 {
     /** Constant for the name of another test attribute.*/
     private static final String TEST_ATTR = "test";
-    
+
     /** Stores the node pointer of the test node.*/
     NodePointer pointer;
-    
-    protected void setUp() throws Exception
+
+    @Override
+    @Before
+    public void setUp() throws Exception
     {
         super.setUp();
-        
+
         // Adds further attributes to the test node
         ConfigurationNode testNode = root.getChild(1);
         testNode.addAttribute(new DefaultConfigurationNode(TEST_ATTR, "yes"));
@@ -51,38 +59,42 @@ public class TestConfigurationIteratorAt
     /**
      * Tests to iterate over all attributes.
      */
+    @Test
     public void testIterateAllAttributes()
     {
         ConfigurationNodeIteratorAttribute it = new ConfigurationNodeIteratorAttribute(pointer,
new QName(null, "*"));
         assertEquals("Wrong number of attributes", 2, iteratorSize(it));
-        List attrs = iterationElements(it);
-        assertEquals("Wrong first attribute", ATTR_NAME, ((ConfigurationNode) attrs.get(0)).getName());
-        assertEquals("Wrong first attribute", TEST_ATTR, ((ConfigurationNode) attrs.get(1)).getName());
+        List<ConfigurationNode> attrs = iterationElements(it);
+        assertEquals("Wrong first attribute", ATTR_NAME, attrs.get(0).getName());
+        assertEquals("Wrong first attribute", TEST_ATTR, attrs.get(1).getName());
     }
-    
+
     /**
      * Tests to iterate over attributes with a specific name.
      */
+    @Test
     public void testIterateSpecificAttribute()
     {
         ConfigurationNodeIteratorAttribute it = new ConfigurationNodeIteratorAttribute(pointer,
new QName(null, TEST_ATTR));
         assertEquals("Wrong number of attributes", 1, iteratorSize(it));
-        assertEquals("Wrong attribute", TEST_ATTR, ((ConfigurationNode) iterationElements(it).get(0)).getName());
+        assertEquals("Wrong attribute", TEST_ATTR, iterationElements(it).get(0).getName());
     }
-    
+
     /**
      * Tests to iterate over non existing attributes.
      */
+    @Test
     public void testIterateUnknownAttribute()
     {
         ConfigurationNodeIteratorAttribute it = new ConfigurationNodeIteratorAttribute(pointer,
new QName(null, "unknown"));
         assertEquals("Found attributes", 0, iteratorSize(it));
     }
-    
+
     /**
      * Tests iteration when a namespace is specified. This is not supported, so
      * the iteration should be empty.
      */
+    @Test
     public void testIterateNamespace()
     {
         ConfigurationNodeIteratorAttribute it = new ConfigurationNodeIteratorAttribute(pointer,
new QName("test", "*"));

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodeIteratorChildren.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodeIteratorChildren.java?rev=1226104&r1=1226103&r2=1226104&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodeIteratorChildren.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodeIteratorChildren.java
Sat Dec 31 15:37:16 2011
@@ -16,6 +16,10 @@
  */
 package org.apache.commons.configuration.tree.xpath;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
@@ -30,11 +34,15 @@ import org.apache.commons.jxpath.ri.comp
 import org.apache.commons.jxpath.ri.compiler.ProcessingInstructionTest;
 import org.apache.commons.jxpath.ri.model.NodeIterator;
 import org.apache.commons.jxpath.ri.model.NodePointer;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Test class for ConfigurationNodeIteratorChildren.
  *
- * @author Oliver Heger
+ * @author <a
+ * href="http://commons.apache.org/configuration/team-list.html">Commons
+ * Configuration team</a>
  * @version $Id$
  */
 public class TestConfigurationNodeIteratorChildren extends AbstractXPathTest
@@ -42,7 +50,9 @@ public class TestConfigurationNodeIterat
     /** Stores the node pointer to the root node. */
     NodePointer rootPointer;
 
-    protected void setUp() throws Exception
+    @Override
+    @Before
+    public void setUp() throws Exception
     {
         super.setUp();
         rootPointer = new ConfigurationNodePointer(root, Locale.getDefault());
@@ -51,6 +61,7 @@ public class TestConfigurationNodeIterat
     /**
      * Tests to iterate over all children of the root node.
      */
+    @Test
     public void testIterateAllChildren()
     {
         ConfigurationNodeIteratorChildren it = new ConfigurationNodeIteratorChildren(
@@ -63,6 +74,7 @@ public class TestConfigurationNodeIterat
     /**
      * Tests a reverse iteration.
      */
+    @Test
     public void testIterateReverse()
     {
         ConfigurationNodeIteratorChildren it = new ConfigurationNodeIteratorChildren(
@@ -75,6 +87,7 @@ public class TestConfigurationNodeIterat
     /**
      * Tests using a node test with a wildcard name.
      */
+    @Test
     public void testIterateWithWildcardTest()
     {
         NodeNameTest test = new NodeNameTest(new QName(null, "*"));
@@ -87,6 +100,7 @@ public class TestConfigurationNodeIterat
      * Tests using a node test that defines a namespace prefix. Because
      * namespaces are not supported, no elements should be in the iteration.
      */
+    @Test
     public void testIterateWithPrefixTest()
     {
         NodeNameTest test = new NodeNameTest(new QName("prefix", "*"));
@@ -99,17 +113,16 @@ public class TestConfigurationNodeIterat
     /**
      * Tests using a node test that selects a certain sub node name.
      */
+    @Test
     public void testIterateWithNameTest()
     {
         NodeNameTest test = new NodeNameTest(new QName(null, CHILD_NAME2));
         ConfigurationNodeIteratorChildren it = new ConfigurationNodeIteratorChildren(
                 rootPointer, test, false, null);
         assertTrue("No children found", iteratorSize(it) > 0);
-        for (Iterator elemIt = iterationElements(it).iterator(); elemIt
-                .hasNext();)
+        for (ConfigurationNode nd : iterationElements(it))
         {
-            assertEquals("Wrong child element", CHILD_NAME2,
-                    ((ConfigurationNode) elemIt.next()).getName());
+            assertEquals("Wrong child element", CHILD_NAME2, nd.getName());
         }
     }
 
@@ -117,6 +130,7 @@ public class TestConfigurationNodeIterat
      * Tests using a not supported test class. This should yield an empty
      * iteration.
      */
+    @Test
     public void testIterateWithUnknownTest()
     {
         NodeTest test = new ProcessingInstructionTest("test");
@@ -128,6 +142,7 @@ public class TestConfigurationNodeIterat
     /**
      * Tests using a type test for nodes. This should return all nodes.
      */
+    @Test
     public void testIterateWithNodeType()
     {
         NodeTypeTest test = new NodeTypeTest(Compiler.NODE_TYPE_NODE);
@@ -140,6 +155,7 @@ public class TestConfigurationNodeIterat
      * Tests using a type test for a non supported type. This should return an
      * empty iteration.
      */
+    @Test
     public void testIterateWithUnknownType()
     {
         NodeTypeTest test = new NodeTypeTest(Compiler.NODE_TYPE_COMMENT);
@@ -151,6 +167,7 @@ public class TestConfigurationNodeIterat
     /**
      * Tests defining a start node for the iteration.
      */
+    @Test
     public void testIterateStartsWith()
     {
         NodePointer childPointer = new ConfigurationNodePointer(rootPointer,
@@ -158,12 +175,12 @@ public class TestConfigurationNodeIterat
         ConfigurationNodeIteratorChildren it = new ConfigurationNodeIteratorChildren(
                 rootPointer, null, false, childPointer);
         assertEquals("Wrong start position", 0, it.getPosition());
-        List nodes = iterationElements(it);
+        List<ConfigurationNode> nodes = iterationElements(it);
         assertEquals("Wrong size of iteration", CHILD_COUNT - 3, nodes.size());
         int index = 4;
-        for (Iterator it2 = nodes.iterator(); it2.hasNext(); index++)
+        for (Iterator<ConfigurationNode> it2 = nodes.iterator(); it2.hasNext(); index++)
         {
-            ConfigurationNode node = (ConfigurationNode) it2.next();
+            ConfigurationNode node = it2.next();
             assertEquals("Wrong node value", String.valueOf(index), node
                     .getValue());
         }
@@ -172,6 +189,7 @@ public class TestConfigurationNodeIterat
     /**
      * Tests defining a start node for a reverse iteration.
      */
+    @Test
     public void testIterateStartsWithReverse()
     {
         NodePointer childPointer = new ConfigurationNodePointer(rootPointer,
@@ -193,6 +211,7 @@ public class TestConfigurationNodeIterat
      * Tests iteration with an invalid start node. This should cause the
      * iteration to start at the first position.
      */
+    @Test
     public void testIterateStartsWithInvalid()
     {
         NodePointer childPointer = new ConfigurationNodePointer(rootPointer,
@@ -217,10 +236,10 @@ public class TestConfigurationNodeIterat
      */
     private void checkValues(NodeIterator iterator, int[] expectedIndices)
     {
-        List nodes = iterationElements(iterator);
+        List<ConfigurationNode> nodes = iterationElements(iterator);
         for (int i = 0; i < expectedIndices.length; i++)
         {
-            ConfigurationNode child = (ConfigurationNode) nodes.get(i);
+            ConfigurationNode child = nodes.get(i);
             assertTrue("Wrong index value for child " + i, child.getValue()
                     .toString().endsWith(String.valueOf(expectedIndices[i])));
         }

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointer.java?rev=1226104&r1=1226103&r2=1226104&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointer.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointer.java
Sat Dec 31 15:37:16 2011
@@ -16,6 +16,10 @@
  */
 package org.apache.commons.configuration.tree.xpath;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import java.util.Locale;
 
 import org.apache.commons.configuration.tree.ConfigurationNode;
@@ -23,11 +27,15 @@ import org.apache.commons.configuration.
 import org.apache.commons.jxpath.ri.QName;
 import org.apache.commons.jxpath.ri.model.NodeIterator;
 import org.apache.commons.jxpath.ri.model.NodePointer;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Test class for ConfigurationNodePointer.
  *
- * @author Oliver Heger
+ * @author <a
+ * href="http://commons.apache.org/configuration/team-list.html">Commons
+ * Configuration team</a>
  * @version $Id$
  */
 public class TestConfigurationNodePointer extends AbstractXPathTest
@@ -35,7 +43,9 @@ public class TestConfigurationNodePointe
     /** Stores the node pointer to be tested. */
     NodePointer pointer;
 
-    protected void setUp() throws Exception
+    @Override
+    @Before
+    public void setUp() throws Exception
     {
         super.setUp();
         pointer = new ConfigurationNodePointer(root, Locale.getDefault());
@@ -44,6 +54,7 @@ public class TestConfigurationNodePointe
     /**
      * Tests comparing child node pointers for child nodes.
      */
+    @Test
     public void testCompareChildNodePointersChildren()
     {
         NodePointer p1 = new ConfigurationNodePointer(pointer, root.getChild(1));
@@ -57,6 +68,7 @@ public class TestConfigurationNodePointe
     /**
      * Tests comparing child node pointers for attribute nodes.
      */
+    @Test
     public void testCompareChildNodePointersAttributes()
     {
         root.addAttribute(new DefaultConfigurationNode("attr1", "test1"));
@@ -74,6 +86,7 @@ public class TestConfigurationNodePointe
     /**
      * tests comparing child node pointers for both child and attribute nodes.
      */
+    @Test
     public void testCompareChildNodePointersChildAndAttribute()
     {
         root.addAttribute(new DefaultConfigurationNode("attr1", "test1"));
@@ -90,6 +103,7 @@ public class TestConfigurationNodePointe
      * Tests comparing child node pointers for child nodes that do not belong to
      * the parent node.
      */
+    @Test
     public void testCompareChildNodePointersInvalidChildren()
     {
         ConfigurationNode node = root.getChild(1);
@@ -104,6 +118,7 @@ public class TestConfigurationNodePointe
     /**
      * Tests the attribute flag.
      */
+    @Test
     public void testIsAttribute()
     {
         ConfigurationNode node = new DefaultConfigurationNode("test", "testval");
@@ -116,6 +131,7 @@ public class TestConfigurationNodePointe
     /**
      * Tests if leaves in the tree are correctly detected.
      */
+    @Test
     public void testIsLeave()
     {
         assertFalse("Root node is leaf", pointer.isLeaf());
@@ -134,6 +150,7 @@ public class TestConfigurationNodePointe
     /**
      * Tests the iterators returned by the node pointer.
      */
+    @Test
     public void testIterators()
     {
         checkIterators(pointer);

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointerFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointerFactory.java?rev=1226104&r1=1226103&r2=1226104&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointerFactory.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/tree/xpath/TestConfigurationNodePointerFactory.java
Sat Dec 31 15:37:16 2011
@@ -16,6 +16,9 @@
  */
 package org.apache.commons.configuration.tree.xpath;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.util.Iterator;
 import java.util.List;
 
@@ -23,13 +26,17 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.tree.DefaultConfigurationNode;
 import org.apache.commons.jxpath.JXPathContext;
 import org.apache.commons.jxpath.ri.JXPathContextReferenceImpl;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Test class for ConfigurationNodePointerFactory. This class does not directly
  * call the factory's methods, but rather checks if it can be installed in a
- * <code>JXPathContext</code> and if XPath expressions can be evaluated.
+ * {@code JXPathContext} and if XPath expressions can be evaluated.
  *
- * @author Oliver Heger
+ * @author <a
+ * href="http://commons.apache.org/configuration/team-list.html">Commons
+ * Configuration team</a>
  * @version $Id$
  */
 public class TestConfigurationNodePointerFactory extends AbstractXPathTest
@@ -37,7 +44,9 @@ public class TestConfigurationNodePointe
     /** Stores the JXPathContext used for testing. */
     JXPathContext context;
 
-    protected void setUp() throws Exception
+    @Override
+    @Before
+    public void setUp() throws Exception
     {
         super.setUp();
         JXPathContextReferenceImpl
@@ -49,11 +58,12 @@ public class TestConfigurationNodePointe
     /**
      * Tests simple XPath expressions.
      */
+    @Test
     public void testSimpleXPath()
     {
-        List nodes = context.selectNodes(CHILD_NAME1);
+        List<?> nodes = context.selectNodes(CHILD_NAME1);
         assertEquals("Incorrect number of results", 2, nodes.size());
-        for (Iterator it = nodes.iterator(); it.hasNext();)
+        for (Iterator<?> it = nodes.iterator(); it.hasNext();)
         {
             ConfigurationNode node = (ConfigurationNode) it.next();
             assertEquals("Incorrect node name", CHILD_NAME1, node.getName());
@@ -71,6 +81,7 @@ public class TestConfigurationNodePointe
     /**
      * Tests using indices to specify elements.
      */
+    @Test
     public void testIndices()
     {
         assertEquals("Incorrect value", "1.2.3", context.getValue("/"
@@ -80,10 +91,10 @@ public class TestConfigurationNodePointe
                 .valueOf(CHILD_COUNT), context.getValue(CHILD_NAME2
                 + "[last()]"));
 
-        List nodes = context.selectNodes("/" + CHILD_NAME1 + "[1]/*");
+        List<?> nodes = context.selectNodes("/" + CHILD_NAME1 + "[1]/*");
         assertEquals("Wrong number of children", CHILD_COUNT, nodes.size());
         int index = 1;
-        for (Iterator it = nodes.iterator(); it.hasNext(); index++)
+        for (Iterator<?> it = nodes.iterator(); it.hasNext(); index++)
         {
             ConfigurationNode node = (ConfigurationNode) it.next();
             assertEquals("Wrong node value for child " + index, "2." + index,
@@ -94,6 +105,7 @@ public class TestConfigurationNodePointe
     /**
      * Tests accessing attributes.
      */
+    @Test
     public void testAttributes()
     {
         root.addAttribute(new DefaultConfigurationNode("testAttr", "true"));
@@ -104,10 +116,10 @@ public class TestConfigurationNodePointe
 
         assertTrue("Found elements with name attribute", context.selectNodes(
                 "//" + CHILD_NAME2 + "[@name]").isEmpty());
-        ConfigurationNode node = (ConfigurationNode) root.getChild(2).getChild(
+        ConfigurationNode node = root.getChild(2).getChild(
                 1).getChildren(CHILD_NAME2).get(1);
         node.addAttribute(new DefaultConfigurationNode("name", "testValue"));
-        List nodes = context.selectNodes("//" + CHILD_NAME2 + "[@name]");
+        List<?> nodes = context.selectNodes("//" + CHILD_NAME2 + "[@name]");
         assertEquals("Name attribute not found", 1, nodes.size());
         assertEquals("Wrong node returned", node, nodes.get(0));
     }
@@ -115,9 +127,10 @@ public class TestConfigurationNodePointe
     /**
      * Tests accessing a node's text.
      */
+    @Test
     public void testText()
     {
-        List nodes = context.selectNodes("//" + CHILD_NAME2
+        List<?> nodes = context.selectNodes("//" + CHILD_NAME2
                 + "[text()='1.1.1']");
         assertEquals("Incorrect number of result nodes", 1, nodes.size());
     }
@@ -125,18 +138,20 @@ public class TestConfigurationNodePointe
     /**
      * Tests accessing the parent axis.
      */
+    @Test
     public void testParentAxis()
     {
-        List nodes = context.selectNodes("/" + CHILD_NAME2 + "/parent::*");
+        List<?> nodes = context.selectNodes("/" + CHILD_NAME2 + "/parent::*");
         assertEquals("Wrong number of parent nodes", 1, nodes.size());
     }
 
     /**
      * Tests accessing the following sibling axis.
      */
+    @Test
     public void testFollowingSiblingAxis()
     {
-        List nodes = context.selectNodes("/" + CHILD_NAME1
+        List<?> nodes = context.selectNodes("/" + CHILD_NAME1
                 + "[2]/following-sibling::*");
         assertEquals("Wrong number of following siblings", 1, nodes.size());
         ConfigurationNode node = (ConfigurationNode) nodes.get(0);
@@ -148,9 +163,10 @@ public class TestConfigurationNodePointe
     /**
      * Tests accessing the preceding sibling axis.
      */
+    @Test
     public void testPrecedingSiblingAxis()
     {
-        List nodes = context.selectNodes("/" + CHILD_NAME1
+        List<?> nodes = context.selectNodes("/" + CHILD_NAME1
                 + "[2]/preceding-sibling::*");
         assertEquals("Wrong number of preceding siblings", 3, nodes.size());
         for (int index = 0, value = 3; index < nodes.size(); index++, value--)



Mime
View raw message