org.custommonkey.xmlunit

Class CountingNodeTester

public class CountingNodeTester extends Object implements NodeTester

Counts the number of nodes in a document to allow assertions to be made using a NodeTest.
Examples and more at xmlunit.sourceforge.net

See Also: NodeTest

Constructor Summary
CountingNodeTester(int expectedNumNodes)
Method Summary
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 another NodeTest
voidtestNode(Node aNode, NodeTest forTest)
A single Node is always valid

Constructor Detail

CountingNodeTester

public CountingNodeTester(int expectedNumNodes)

Method Detail

noMoreNodes

public void noMoreNodes(NodeTest forTest)
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 invokes {@link #resetCounter resetCounter} so that the instance can be reused.

Throws: true if expected num nodes == actual num nodes, false otherwise

resetCounter

public void resetCounter()
Reset the counter so that an instance can be reused for another NodeTest

testNode

public void testNode(Node aNode, NodeTest forTest)
A single Node is always valid

Parameters: aNode forTest