Class CountingNodeTester
- java.lang.Object
-
- org.custommonkey.xmlunit.examples.CountingNodeTester
-
- All Implemented Interfaces:
NodeTester
public class CountingNodeTester extends Object implements NodeTester
Counts the number of nodes in a document to allow assertions to be made using a NodeTest.- See Also:
NodeTest
-
-
Constructor Summary
Constructors Constructor Description CountingNodeTester(int expectedNumNodes)Creates a new NodeTester
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidnoMoreNodes(NodeTest forTest)Called by NodeTest when all nodes have been iterated over: time to see if all the nodes that were expected were found.voidresetCounter()Reset the counter so that an instance can be reused for anotherNodeTestvoidtestNode(Node aNode, NodeTest forTest)A single Node is always valid
-
-
-
Method Detail
-
testNode
public void testNode(Node aNode, NodeTest forTest)
A single Node is always valid- Specified by:
testNodein interfaceNodeTester- Parameters:
aNode- the node to testforTest- the test to perform
-
noMoreNodes
public void noMoreNodes(NodeTest forTest) throws NodeTestException
Called by NodeTest when all nodes have been iterated over: time to see if all the nodes that were expected were found. Note that this method also invokesresetCounterso that the instance can be reused.- Specified by:
noMoreNodesin interfaceNodeTester- Parameters:
forTest- the test to perform- Throws:
NodeTestException- if expected num nodes == actual num nodes
-
resetCounter
public void resetCounter()
Reset the counter so that an instance can be reused for anotherNodeTest
-
-