Class NodeTest

java.lang.Object
org.custommonkey.xmlunit.NodeTest

public class NodeTest extends Object
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:
  • Field Details

    • documentTraversal

      private final DocumentTraversal documentTraversal
    • rootNode

      private final Node rootNode
  • Constructor Details

  • Method Details

    • getDocumentTraversal

      private static DocumentTraversal getDocumentTraversal(Document document)
      Try to cast a Document into a DocumentTraversal
      Parameters:
      document -
      Returns:
      DocumentTraversal interface if the DOM implementation supports it
    • performTest

      public void performTest(NodeTester tester, short singleNodeType) throws NodeTestException
      Does this NodeTest pass using the specified NodeTester instance?
      Parameters:
      tester -
      singleNodeType - note Node.ATTRIBUTE_NODE is 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 from Node.ELEMENT_NODE nodes
      Throws:
      NodeTestException - if test fails
    • performTest

      public void performTest(NodeTester tester, short[] nodeTypes) throws NodeTestException
      Does this NodeTest pass using the specified NodeTester instance?
      Parameters:
      tester -
      nodeTypes - note Node.ATTRIBUTE_NODE is 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 from Node.ELEMENT_NODE nodes instead
      Throws:
      NodeTestException - if test fails