Package org.custommonkey.xmlunit
Class NodeTest
java.lang.Object
org.custommonkey.xmlunit.NodeTest
Encapsulation of the Node-by-Node testing of a DOM Document
Uses a nodetype-specific
NodeFilter to pass the DOM Nodes
to a NodeTester instance that performs the acual Node validation.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a NodeTest for the DOM built using the Reader and JAXPConstruct a NodeTest for the DOM built using the String and JAXPConstruct a NodeTest for the specified DocumentConstruct a NodeTest using the specified DocumentTraversal, starting at the specified root nodeNodeTest(InputSource src) Construct a NodeTest for the DOM built using the InputSource. -
Method Summary
Modifier and TypeMethodDescriptionvoidperformTest(NodeTester tester, short singleNodeType) Does this NodeTest pass using the specified NodeTester instance?voidperformTest(NodeTester tester, short[] nodeTypes) Does this NodeTest pass using the specified NodeTester instance?
-
Constructor Details
-
NodeTest
Construct a NodeTest for the DOM built using the String and JAXP- Parameters:
xmlString- the XML to test- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
NodeTest
Construct a NodeTest for the DOM built using the Reader and JAXP- Parameters:
reader- the XML to test- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
NodeTest
Construct a NodeTest for the DOM built using the InputSource.- Parameters:
src- the XML to test- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
NodeTest
Construct a NodeTest for the specified Document- Parameters:
document- the XML to test- Throws:
IllegalArgumentException- if the Document does not support the DOM DocumentTraversal interface (most DOM implementations should provide this support)
-
NodeTest
Construct a NodeTest using the specified DocumentTraversal, starting at the specified root node- Parameters:
documentTraversal- traversalrootNode- starting node for test
-
-
Method Details
-
performTest
Does this NodeTest pass using the specified NodeTester instance?- Parameters:
tester- actually performs the testssingleNodeType- noteNode.ATTRIBUTE_NODEis not exposed by the DocumentTraversal node iterator unless the root node is itself an attribute - so a NodeTester that needs to test attributes should obtain those attributes fromNode.ELEMENT_NODEnodes- Throws:
NodeTestException- if test fails
-
performTest
Does this NodeTest pass using the specified NodeTester instance?- Parameters:
tester- actually performs the testsnodeTypes- noteNode.ATTRIBUTE_NODEis not exposed by the DocumentTraversal node iterator unless the root node is itself an attribute - so a NodeTester that needs to test attributes should obtain those attributes fromNode.ELEMENT_NODEnodes instead- Throws:
NodeTestException- if test fails
-