Class XMLAssert

  • All Implemented Interfaces:
    XMLConstants, XSLTConstants

    public class XMLAssert
    extends junit.framework.Assert
    implements XSLTConstants
    Collection of static methods so that XML assertion facilities are available in any class, not just test suites. Thanks to Andrew McCormick and others for suggesting this refactoring.
    Available assertion methods are:
    • assertXMLEqual
      assert that two pieces of XML markup are similar
    • assertXMLNotEqual
      assert that two pieces of XML markup are different
    • assertXMLIdentical
      assert that two pieces of XML markup are identical. In most cases this assertion is too strong and assertXMLEqual is sufficient
    • assertXpathExists
      assert that an XPath expression matches at least one node
    • assertXpathNotExists
      assert that an XPath expression does not match any nodes
    • assertXpathsEqual
      assert that the nodes obtained by executing two Xpaths are similar
    • assertXpathsNotEqual
      assert that the nodes obtained by executing two Xpaths are different
    • assertXpathValuesEqual
      assert that the flattened String obtained by executing two Xpaths are similar
    • assertXpathValuesNotEqual
      assert that the flattened String obtained by executing two Xpaths are different
    • assertXpathEvaluatesTo
      assert that the flattened String obtained by executing an Xpath is a particular value
    • assertXMLValid
      assert that a piece of XML markup is valid with respect to a DTD: either by using the markup's own DTD or a different DTD
    • assertNodeTestPasses
      assert that a piece of XML markup passes a NodeTest
    All underlying similarity and difference testing is done using Diff instances which can be instantiated and evaluated independently of this class.
    See Also:
    Diff.similar(), Diff.identical()
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected XMLAssert()
      Empty constructor.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void assertNodeTestPasses​(java.lang.String xmlString, NodeTester tester, short nodeType)
      Execute a NodeTest for a single node type and assert that it passes
      static void assertNodeTestPasses​(NodeTest test, NodeTester tester, short[] nodeTypes, boolean assertion)
      Execute a NodeTest for multiple node types and make an assertion about it whether it is expected to pass
      static void assertNodeTestPasses​(org.xml.sax.InputSource xml, NodeTester tester, short nodeType)
      Execute a NodeTest for a single node type and assert that it passes
      static void assertXMLEqual​(java.io.Reader control, java.io.Reader test)
      Assert that two XML documents are similar
      static void assertXMLEqual​(java.lang.String err, java.io.Reader control, java.io.Reader test)
      Assert that two XML documents are similar
      static void assertXMLEqual​(java.lang.String control, java.lang.String test)
      Assert that two XML documents are similar
      static void assertXMLEqual​(java.lang.String err, java.lang.String control, java.lang.String test)
      Assert that two XML documents are similar
      static void assertXMLEqual​(java.lang.String msg, Diff diff, boolean assertion)
      Assert that the result of an XML comparison is or is not similar.
      static void assertXMLEqual​(java.lang.String err, org.w3c.dom.Document control, org.w3c.dom.Document test)
      Assert that two XML documents are similar
      static void assertXMLEqual​(java.lang.String err, org.xml.sax.InputSource control, org.xml.sax.InputSource test)
      Assert that two XML documents are similar
      static void assertXMLEqual​(Diff diff, boolean assertion)
      Assert that the result of an XML comparison is or is not similar.
      static void assertXMLEqual​(org.w3c.dom.Document control, org.w3c.dom.Document test)
      Assert that two XML documents are similar
      static void assertXMLEqual​(org.xml.sax.InputSource control, org.xml.sax.InputSource test)
      Assert that two XML documents are similar
      static void assertXMLIdentical​(java.lang.String msg, Diff diff, boolean assertion)
      Assert that the result of an XML comparison is or is not identical
      static void assertXMLIdentical​(Diff diff, boolean assertion)
      Assert that the result of an XML comparison is or is not identical
      static void assertXMLNotEqual​(java.io.Reader control, java.io.Reader test)
      Assert that two XML documents are NOT similar
      static void assertXMLNotEqual​(java.lang.String err, java.io.Reader control, java.io.Reader test)
      Assert that two XML documents are NOT similar
      static void assertXMLNotEqual​(java.lang.String control, java.lang.String test)
      Assert that two XML documents are NOT similar
      static void assertXMLNotEqual​(java.lang.String err, java.lang.String control, java.lang.String test)
      Assert that two XML documents are NOT similar
      static void assertXMLNotEqual​(java.lang.String err, org.w3c.dom.Document control, org.w3c.dom.Document test)
      Assert that two XML documents are NOT similar
      static void assertXMLNotEqual​(java.lang.String err, org.xml.sax.InputSource control, org.xml.sax.InputSource test)
      Assert that two XML documents are NOT similar
      static void assertXMLNotEqual​(org.w3c.dom.Document control, org.w3c.dom.Document test)
      Assert that two XML documents are NOT similar
      static void assertXMLNotEqual​(org.xml.sax.InputSource control, org.xml.sax.InputSource test)
      Assert that two XML documents are NOT similar
      static void assertXMLValid​(java.lang.String xmlString)
      Assert that a String containing XML contains valid XML: the String must contain a DOCTYPE declaration to be validated
      static void assertXMLValid​(java.lang.String xmlString, java.lang.String systemId)
      Assert that a String containing XML contains valid XML: the String must contain a DOCTYPE to be validated, but the validation will use the systemId to obtain the DTD
      static void assertXMLValid​(java.lang.String xmlString, java.lang.String systemId, java.lang.String doctype)
      Assert that a String containing XML contains valid XML: the String will be given a DOCTYPE to be validated with the name and systemId specified regardless of whether it already contains a doctype declaration.
      static void assertXMLValid​(Validator validator)
      Assert that a Validator instance returns isValid() == true
      static void assertXMLValid​(org.xml.sax.InputSource xml)
      Assert that an InputSource containing XML contains valid XML: the document must contain a DOCTYPE declaration to be validated
      static void assertXMLValid​(org.xml.sax.InputSource xml, java.lang.String systemId)
      Assert that an InputSource containing XML contains valid XML: the document must contain a DOCTYPE to be validated, but the validation will use the systemId to obtain the DTD
      static void assertXMLValid​(org.xml.sax.InputSource xml, java.lang.String systemId, java.lang.String doctype)
      Assert that a piece of XML contains valid XML: the document will be given a DOCTYPE to be validated with the name and systemId specified regardless of whether it already contains a doctype declaration.
      private static void assertXpathEquality​(java.lang.String controlXpath, org.w3c.dom.Document controlDocument, java.lang.String testXpath, org.w3c.dom.Document testDocument, boolean equal)
      Assert that the node lists of two Xpaths in two documents are equal or not.
      static void assertXpathEvaluatesTo​(java.lang.String expectedValue, java.lang.String xpathExpression, java.lang.String inXMLString)
      Assert the value of an Xpath expression in an XML String
      static void assertXpathEvaluatesTo​(java.lang.String expectedValue, java.lang.String xpathExpression, org.w3c.dom.Document inDocument)
      Assert the value of an Xpath expression in an DOM Document
      static void assertXpathEvaluatesTo​(java.lang.String expectedValue, java.lang.String xpathExpression, org.xml.sax.InputSource control)
      Assert the value of an Xpath expression in an XML document.
      static void assertXpathEvaluatesTo​(QualifiedName expectedValue, java.lang.String xpathExpression, java.lang.String inXMLString)
      Assert the value of an Xpath expression in an XML String
      static void assertXpathEvaluatesTo​(QualifiedName expectedValue, java.lang.String xpathExpression, org.w3c.dom.Document inDocument)
      Assert the value of an Xpath expression in an DOM Document
      static void assertXpathEvaluatesTo​(QualifiedName expectedValue, java.lang.String xpathExpression, org.xml.sax.InputSource control)
      Assert the value of an Xpath expression in an XML document.
      static void assertXpathExists​(java.lang.String xPathExpression, java.lang.String inXMLString)
      Assert that a specific XPath exists in some given XML
      static void assertXpathExists​(java.lang.String xPathExpression, org.w3c.dom.Document inDocument)
      Assert that a specific XPath exists in some given XML
      static void assertXpathExists​(java.lang.String xPathExpression, org.xml.sax.InputSource control)
      Assert that a specific XPath exists in some given XML
      static void assertXpathNotExists​(java.lang.String xPathExpression, java.lang.String inXMLString)
      Assert that a specific XPath does NOT exist in some given XML
      static void assertXpathNotExists​(java.lang.String xPathExpression, org.w3c.dom.Document inDocument)
      Assert that a specific XPath does NOT exist in some given XML
      static void assertXpathNotExists​(java.lang.String xPathExpression, org.xml.sax.InputSource control)
      Assert that a specific XPath does NOT exist in some given XML
      static void assertXpathsEqual​(java.lang.String controlXpath, java.lang.String testXpath, java.lang.String inXMLString)
      Assert that the node lists of two Xpaths in the same XML string are equal
      static void assertXpathsEqual​(java.lang.String controlXpath, java.lang.String inControlXMLString, java.lang.String testXpath, java.lang.String inTestXMLString)
      Assert that the node lists of two Xpaths in two XML strings are equal
      static void assertXpathsEqual​(java.lang.String controlXpath, java.lang.String testXpath, org.w3c.dom.Document document)
      Assert that the node lists of two Xpaths in the same document are equal
      static void assertXpathsEqual​(java.lang.String controlXpath, java.lang.String testXpath, org.xml.sax.InputSource document)
      Assert that the node lists of two Xpaths in the same document are equal
      static void assertXpathsEqual​(java.lang.String controlXpath, org.w3c.dom.Document controlDocument, java.lang.String testXpath, org.w3c.dom.Document testDocument)
      Assert that the node lists of two Xpaths in two documents are equal
      static void assertXpathsEqual​(java.lang.String controlXpath, org.xml.sax.InputSource controlDocument, java.lang.String testXpath, org.xml.sax.InputSource testDocument)
      Assert that the node lists of two Xpaths in two documents are equal
      static void assertXpathsNotEqual​(java.lang.String controlXpath, java.lang.String testXpath, java.lang.String inXMLString)
      Assert that the node lists of two Xpaths in the same XML string are NOT equal
      static void assertXpathsNotEqual​(java.lang.String controlXpath, java.lang.String inControlXMLString, java.lang.String testXpath, java.lang.String inTestXMLString)
      Assert that the node lists of two Xpaths in two XML strings are NOT equal
      static void assertXpathsNotEqual​(java.lang.String controlXpath, java.lang.String testXpath, org.w3c.dom.Document document)
      Assert that the node lists of two Xpaths in the same document are NOT equal
      static void assertXpathsNotEqual​(java.lang.String controlXpath, java.lang.String testXpath, org.xml.sax.InputSource document)
      Assert that the node lists of two Xpaths in the same document are NOT equal
      static void assertXpathsNotEqual​(java.lang.String controlXpath, org.w3c.dom.Document controlDocument, java.lang.String testXpath, org.w3c.dom.Document testDocument)
      Assert that the node lists of two Xpaths in two documents are NOT equal
      static void assertXpathsNotEqual​(java.lang.String controlXpath, org.xml.sax.InputSource controlDocument, java.lang.String testXpath, org.xml.sax.InputSource testDocument)
      Assert that the node lists of two Xpaths in two XML strings are NOT equal
      static void assertXpathValuesEqual​(java.lang.String controlXpath, java.lang.String testXpath, java.lang.String inXMLString)
      Assert that the evaluation of two Xpaths in the same XML string are equal
      static void assertXpathValuesEqual​(java.lang.String controlXpath, java.lang.String inControlXMLString, java.lang.String testXpath, java.lang.String inTestXMLString)
      Assert that the evaluation of two Xpaths in two XML strings are equal
      static void assertXpathValuesEqual​(java.lang.String controlXpath, java.lang.String testXpath, org.w3c.dom.Document document)
      Assert that the evaluation of two Xpaths in the same document are equal
      static void assertXpathValuesEqual​(java.lang.String controlXpath, java.lang.String testXpath, org.xml.sax.InputSource document)
      Assert that the evaluation of two Xpaths in the same XML string are equal
      static void assertXpathValuesEqual​(java.lang.String controlXpath, org.w3c.dom.Document controlDocument, java.lang.String testXpath, org.w3c.dom.Document testDocument)
      Assert that the evaluation of two Xpaths in two documents are equal
      static void assertXpathValuesEqual​(java.lang.String controlXpath, org.xml.sax.InputSource control, java.lang.String testXpath, org.xml.sax.InputSource test)
      Assert that the evaluation of two Xpaths in two XML strings are equal
      static void assertXpathValuesNotEqual​(java.lang.String controlXpath, java.lang.String testXpath, java.lang.String inXMLString)
      Assert that the evaluation of two Xpaths in the same XML string are NOT equal
      static void assertXpathValuesNotEqual​(java.lang.String controlXpath, java.lang.String inControlXMLString, java.lang.String testXpath, java.lang.String inTestXMLString)
      Assert that the evaluation of two Xpaths in two XML strings are NOT equal
      static void assertXpathValuesNotEqual​(java.lang.String controlXpath, java.lang.String testXpath, org.w3c.dom.Document document)
      Assert that the evaluation of two Xpaths in the same document are NOT equal
      static void assertXpathValuesNotEqual​(java.lang.String controlXpath, java.lang.String testXpath, org.xml.sax.InputSource control)
      Assert that the evaluation of two Xpaths in the same XML string are NOT equal
      static void assertXpathValuesNotEqual​(java.lang.String controlXpath, org.w3c.dom.Document controlDocument, java.lang.String testXpath, org.w3c.dom.Document testDocument)
      Assert that the evaluation of two Xpaths in two documents are NOT equal
      static void assertXpathValuesNotEqual​(java.lang.String controlXpath, org.xml.sax.InputSource control, java.lang.String testXpath, org.xml.sax.InputSource test)
      Assert that the evaluation of two Xpaths in two XML strings are NOT equal
      private static org.w3c.dom.Document asXpathResultDocument​(javax.xml.parsers.DocumentBuilder builder, org.w3c.dom.NodeList nodes)  
      private static java.lang.String getFailMessage​(java.lang.String msg, Diff diff)  
      • Methods inherited from class junit.framework.Assert

        assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XMLAssert

        protected XMLAssert()
        Empty constructor.
    • Method Detail

      • assertXMLEqual

        public static void assertXMLEqual​(Diff diff,
                                          boolean assertion)
        Assert that the result of an XML comparison is or is not similar.
        Parameters:
        diff - the result of an XML comparison
        assertion - true if asserting that result is similar
      • assertXMLEqual

        public static void assertXMLEqual​(java.lang.String msg,
                                          Diff diff,
                                          boolean assertion)
        Assert that the result of an XML comparison is or is not similar.
        Parameters:
        msg - additional message to display if assertion fails
        diff - the result of an XML comparison
        assertion - true if asserting that result is similar
      • getFailMessage

        private static java.lang.String getFailMessage​(java.lang.String msg,
                                                       Diff diff)
      • assertXMLIdentical

        public static void assertXMLIdentical​(Diff diff,
                                              boolean assertion)
        Assert that the result of an XML comparison is or is not identical
        Parameters:
        diff - the result of an XML comparison
        assertion - true if asserting that result is identical
      • assertXMLIdentical

        public static void assertXMLIdentical​(java.lang.String msg,
                                              Diff diff,
                                              boolean assertion)
        Assert that the result of an XML comparison is or is not identical
        Parameters:
        msg - Message to display if assertion fails
        diff - the result of an XML comparison
        assertion - true if asserting that result is identical
      • assertXMLEqual

        public static void assertXMLEqual​(org.xml.sax.InputSource control,
                                          org.xml.sax.InputSource test)
                                   throws org.xml.sax.SAXException,
                                          java.io.IOException
        Assert that two XML documents are similar
        Parameters:
        control - XML to be compared against
        test - XML to be tested
        Throws:
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
      • assertXMLEqual

        public static void assertXMLEqual​(java.lang.String control,
                                          java.lang.String test)
                                   throws org.xml.sax.SAXException,
                                          java.io.IOException
        Assert that two XML documents are similar
        Parameters:
        control - XML to be compared against
        test - XML to be tested
        Throws:
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
      • assertXMLEqual

        public static void assertXMLEqual​(org.w3c.dom.Document control,
                                          org.w3c.dom.Document test)
        Assert that two XML documents are similar
        Parameters:
        control - XML to be compared against
        test - XML to be tested
      • assertXMLEqual

        public static void assertXMLEqual​(java.io.Reader control,
                                          java.io.Reader test)
                                   throws org.xml.sax.SAXException,
                                          java.io.IOException
        Assert that two XML documents are similar
        Parameters:
        control - XML to be compared against
        test - XML to be tested
        Throws:
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
      • assertXMLEqual

        public static void assertXMLEqual​(java.lang.String err,
                                          org.xml.sax.InputSource control,
                                          org.xml.sax.InputSource test)
                                   throws org.xml.sax.SAXException,
                                          java.io.IOException
        Assert that two XML documents are similar
        Parameters:
        err - Message to be displayed on assertion failure
        control - XML to be compared against
        test - XML to be tested
        Throws:
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
      • assertXMLEqual

        public static void assertXMLEqual​(java.lang.String err,
                                          java.lang.String control,
                                          java.lang.String test)
                                   throws org.xml.sax.SAXException,
                                          java.io.IOException
        Assert that two XML documents are similar
        Parameters:
        err - Message to be displayed on assertion failure
        control - XML to be compared against
        test - XML to be tested
        Throws:
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
      • assertXMLEqual

        public static void assertXMLEqual​(java.lang.String err,
                                          org.w3c.dom.Document control,
                                          org.w3c.dom.Document test)
        Assert that two XML documents are similar
        Parameters:
        err - Message to be displayed on assertion failure
        control - XML to be compared against
        test - XML to be tested
      • assertXMLEqual

        public static void assertXMLEqual​(java.lang.String err,
                                          java.io.Reader control,
                                          java.io.Reader test)
                                   throws org.xml.sax.SAXException,
                                          java.io.IOException
        Assert that two XML documents are similar
        Parameters:
        err - Message to be displayed on assertion failure
        control - XML to be compared against
        test - XML to be tested
        Throws:
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
      • assertXMLNotEqual

        public static void assertXMLNotEqual​(org.xml.sax.InputSource control,
                                             org.xml.sax.InputSource test)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
        Assert that two XML documents are NOT similar
        Parameters:
        control - XML to be compared against
        test - XML to be tested
        Throws:
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
      • assertXMLNotEqual

        public static void assertXMLNotEqual​(java.lang.String control,
                                             java.lang.String test)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
        Assert that two XML documents are NOT similar
        Parameters:
        control - XML to be compared against
        test - XML to be tested
        Throws:
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
      • assertXMLNotEqual

        public static void assertXMLNotEqual​(org.w3c.dom.Document control,
                                             org.w3c.dom.Document test)
        Assert that two XML documents are NOT similar
        Parameters:
        control - XML to be compared against
        test - XML to be tested
      • assertXMLNotEqual

        public static void assertXMLNotEqual​(java.io.Reader control,
                                             java.io.Reader test)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
        Assert that two XML documents are NOT similar
        Parameters:
        control - XML to be compared against
        test - XML to be tested
        Throws:
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
      • assertXMLNotEqual

        public static void assertXMLNotEqual​(java.lang.String err,
                                             org.xml.sax.InputSource control,
                                             org.xml.sax.InputSource test)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
        Assert that two XML documents are NOT similar
        Parameters:
        err - Message to be displayed on assertion failure
        control - XML to be compared against
        test - XML to be tested
        Throws:
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
      • assertXMLNotEqual

        public static void assertXMLNotEqual​(java.lang.String err,
                                             java.lang.String control,
                                             java.lang.String test)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
        Assert that two XML documents are NOT similar
        Parameters:
        err - Message to be displayed on assertion failure
        control - XML to be compared against
        test - XML to be tested
        Throws:
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
      • assertXMLNotEqual

        public static void assertXMLNotEqual​(java.lang.String err,
                                             org.w3c.dom.Document control,
                                             org.w3c.dom.Document test)
        Assert that two XML documents are NOT similar
        Parameters:
        err - Message to be displayed on assertion failure
        control - XML to be compared against
        test - XML to be tested
      • assertXMLNotEqual

        public static void assertXMLNotEqual​(java.lang.String err,
                                             java.io.Reader control,
                                             java.io.Reader test)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
        Assert that two XML documents are NOT similar
        Parameters:
        err - Message to be displayed on assertion failure
        control - XML to be compared against
        test - XML to be tested
        Throws:
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
      • assertXpathsEqual

        public static void assertXpathsEqual​(java.lang.String controlXpath,
                                             java.lang.String testXpath,
                                             org.w3c.dom.Document document)
                                      throws XpathException
        Assert that the node lists of two Xpaths in the same document are equal
        Parameters:
        controlXpath - XPath for expected value
        testXpath - XPath for actual value
        document - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        See Also:
        XpathEngine
      • assertXpathsEqual

        public static void assertXpathsEqual​(java.lang.String controlXpath,
                                             java.lang.String testXpath,
                                             org.xml.sax.InputSource document)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException,
                                             XpathException
        Assert that the node lists of two Xpaths in the same document are equal
        Parameters:
        controlXpath - XPath for expected value
        testXpath - XPath for actual value
        document - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathsEqual

        public static void assertXpathsEqual​(java.lang.String controlXpath,
                                             java.lang.String testXpath,
                                             java.lang.String inXMLString)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException,
                                             XpathException
        Assert that the node lists of two Xpaths in the same XML string are equal
        Parameters:
        controlXpath - XPath for expected value
        testXpath - XPath for actual value
        inXMLString - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathsEqual

        public static void assertXpathsEqual​(java.lang.String controlXpath,
                                             org.xml.sax.InputSource controlDocument,
                                             java.lang.String testXpath,
                                             org.xml.sax.InputSource testDocument)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException,
                                             XpathException
        Assert that the node lists of two Xpaths in two documents are equal
        Parameters:
        controlXpath - XPath for expected value
        controlDocument - document for expected value
        testXpath - XPath for actual value
        testDocument - document for actual value
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathsEqual

        public static void assertXpathsEqual​(java.lang.String controlXpath,
                                             java.lang.String inControlXMLString,
                                             java.lang.String testXpath,
                                             java.lang.String inTestXMLString)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException,
                                             XpathException
        Assert that the node lists of two Xpaths in two XML strings are equal
        Parameters:
        controlXpath - XPath for expected value
        inControlXMLString - document for expected value
        testXpath - XPath for actual value
        inTestXMLString - document for actual value
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathsEqual

        public static void assertXpathsEqual​(java.lang.String controlXpath,
                                             org.w3c.dom.Document controlDocument,
                                             java.lang.String testXpath,
                                             org.w3c.dom.Document testDocument)
                                      throws XpathException
        Assert that the node lists of two Xpaths in two documents are equal
        Parameters:
        controlXpath - XPath for expected value
        controlDocument - document for expected value
        testXpath - XPath for actual value
        testDocument - document for actual value
        Throws:
        XpathException - if XPath construction fails
        See Also:
        XpathEngine
      • assertXpathsNotEqual

        public static void assertXpathsNotEqual​(java.lang.String controlXpath,
                                                java.lang.String testXpath,
                                                org.w3c.dom.Document document)
                                         throws XpathException
        Assert that the node lists of two Xpaths in the same document are NOT equal
        Parameters:
        controlXpath - XPath for not-expected value
        testXpath - XPath for actual value
        document - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        See Also:
        XpathEngine
      • assertXpathsNotEqual

        public static void assertXpathsNotEqual​(java.lang.String controlXpath,
                                                java.lang.String testXpath,
                                                org.xml.sax.InputSource document)
                                         throws org.xml.sax.SAXException,
                                                java.io.IOException,
                                                XpathException
        Assert that the node lists of two Xpaths in the same document are NOT equal
        Parameters:
        controlXpath - XPath for not-expected value
        testXpath - XPath for actual value
        document - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathsNotEqual

        public static void assertXpathsNotEqual​(java.lang.String controlXpath,
                                                java.lang.String testXpath,
                                                java.lang.String inXMLString)
                                         throws org.xml.sax.SAXException,
                                                java.io.IOException,
                                                XpathException
        Assert that the node lists of two Xpaths in the same XML string are NOT equal
        Parameters:
        controlXpath - XPath for not-expected value
        testXpath - XPath for actual value
        inXMLString - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathsNotEqual

        public static void assertXpathsNotEqual​(java.lang.String controlXpath,
                                                java.lang.String inControlXMLString,
                                                java.lang.String testXpath,
                                                java.lang.String inTestXMLString)
                                         throws org.xml.sax.SAXException,
                                                java.io.IOException,
                                                XpathException
        Assert that the node lists of two Xpaths in two XML strings are NOT equal
        Parameters:
        controlXpath - XPath for not-expected value
        inControlXMLString - document for not-expected value
        testXpath - XPath for actual value
        inTestXMLString - document for actual value
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathsNotEqual

        public static void assertXpathsNotEqual​(java.lang.String controlXpath,
                                                org.xml.sax.InputSource controlDocument,
                                                java.lang.String testXpath,
                                                org.xml.sax.InputSource testDocument)
                                         throws org.xml.sax.SAXException,
                                                java.io.IOException,
                                                XpathException
        Assert that the node lists of two Xpaths in two XML strings are NOT equal
        Parameters:
        controlXpath - XPath for not-expected value
        controlDocument - document for not-expected value
        testXpath - XPath for actual value
        testDocument - document for actual value
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathsNotEqual

        public static void assertXpathsNotEqual​(java.lang.String controlXpath,
                                                org.w3c.dom.Document controlDocument,
                                                java.lang.String testXpath,
                                                org.w3c.dom.Document testDocument)
                                         throws XpathException
        Assert that the node lists of two Xpaths in two documents are NOT equal
        Parameters:
        controlXpath - XPath for not-expected value
        controlDocument - document for not-expected value
        testXpath - XPath for actual value
        testDocument - document for actual value
        Throws:
        XpathException - if XPath construction fails
        See Also:
        XpathEngine
      • assertXpathEquality

        private static void assertXpathEquality​(java.lang.String controlXpath,
                                                org.w3c.dom.Document controlDocument,
                                                java.lang.String testXpath,
                                                org.w3c.dom.Document testDocument,
                                                boolean equal)
                                         throws XpathException
        Assert that the node lists of two Xpaths in two documents are equal or not.
        Parameters:
        equal - whether the values should be equal.
        Throws:
        XpathException
      • assertXpathValuesEqual

        public static void assertXpathValuesEqual​(java.lang.String controlXpath,
                                                  java.lang.String testXpath,
                                                  org.w3c.dom.Document document)
                                           throws XpathException
        Assert that the evaluation of two Xpaths in the same document are equal
        Parameters:
        controlXpath - XPath for expected value
        testXpath - XPath for actual value
        document - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        See Also:
        XpathEngine
      • assertXpathValuesEqual

        public static void assertXpathValuesEqual​(java.lang.String controlXpath,
                                                  java.lang.String testXpath,
                                                  org.xml.sax.InputSource document)
                                           throws org.xml.sax.SAXException,
                                                  java.io.IOException,
                                                  XpathException
        Assert that the evaluation of two Xpaths in the same XML string are equal
        Parameters:
        controlXpath - XPath for expected value
        testXpath - XPath for actual value
        document - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathValuesEqual

        public static void assertXpathValuesEqual​(java.lang.String controlXpath,
                                                  java.lang.String testXpath,
                                                  java.lang.String inXMLString)
                                           throws org.xml.sax.SAXException,
                                                  java.io.IOException,
                                                  XpathException
        Assert that the evaluation of two Xpaths in the same XML string are equal
        Parameters:
        controlXpath - XPath for expected value
        testXpath - XPath for actual value
        inXMLString - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathValuesEqual

        public static void assertXpathValuesEqual​(java.lang.String controlXpath,
                                                  org.xml.sax.InputSource control,
                                                  java.lang.String testXpath,
                                                  org.xml.sax.InputSource test)
                                           throws org.xml.sax.SAXException,
                                                  java.io.IOException,
                                                  XpathException
        Assert that the evaluation of two Xpaths in two XML strings are equal
        Parameters:
        controlXpath - XPath for expected value
        control - document for expected value
        testXpath - XPath for actual value
        test - document for actual value
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathValuesEqual

        public static void assertXpathValuesEqual​(java.lang.String controlXpath,
                                                  java.lang.String inControlXMLString,
                                                  java.lang.String testXpath,
                                                  java.lang.String inTestXMLString)
                                           throws org.xml.sax.SAXException,
                                                  java.io.IOException,
                                                  XpathException
        Assert that the evaluation of two Xpaths in two XML strings are equal
        Parameters:
        controlXpath - XPath for expected value
        inControlXMLString - document for expected value
        testXpath - XPath for actual value
        inTestXMLString - document for actual value
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathValuesEqual

        public static void assertXpathValuesEqual​(java.lang.String controlXpath,
                                                  org.w3c.dom.Document controlDocument,
                                                  java.lang.String testXpath,
                                                  org.w3c.dom.Document testDocument)
                                           throws XpathException
        Assert that the evaluation of two Xpaths in two documents are equal
        Parameters:
        controlXpath - XPath for expected value
        controlDocument - document for expected value
        testXpath - XPath for actual value
        testDocument - document for actual value
        Throws:
        XpathException - if XPath construction fails
        See Also:
        XpathEngine
      • assertXpathValuesNotEqual

        public static void assertXpathValuesNotEqual​(java.lang.String controlXpath,
                                                     java.lang.String testXpath,
                                                     org.xml.sax.InputSource control)
                                              throws org.xml.sax.SAXException,
                                                     java.io.IOException,
                                                     XpathException
        Assert that the evaluation of two Xpaths in the same XML string are NOT equal
        Parameters:
        controlXpath - XPath for not-expected value
        control - document to apply XPaths to
        testXpath - XPath for actual value
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathValuesNotEqual

        public static void assertXpathValuesNotEqual​(java.lang.String controlXpath,
                                                     java.lang.String testXpath,
                                                     java.lang.String inXMLString)
                                              throws org.xml.sax.SAXException,
                                                     java.io.IOException,
                                                     XpathException
        Assert that the evaluation of two Xpaths in the same XML string are NOT equal
        Parameters:
        controlXpath - XPath for not-expected value
        inXMLString - document to apply XPaths to
        testXpath - XPath for actual value
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathValuesNotEqual

        public static void assertXpathValuesNotEqual​(java.lang.String controlXpath,
                                                     java.lang.String testXpath,
                                                     org.w3c.dom.Document document)
                                              throws XpathException
        Assert that the evaluation of two Xpaths in the same document are NOT equal
        Parameters:
        controlXpath - XPath for not-expected value
        document - document to apply XPaths to
        testXpath - XPath for actual value
        Throws:
        XpathException - if XPath construction fails
        See Also:
        XpathEngine
      • assertXpathValuesNotEqual

        public static void assertXpathValuesNotEqual​(java.lang.String controlXpath,
                                                     org.xml.sax.InputSource control,
                                                     java.lang.String testXpath,
                                                     org.xml.sax.InputSource test)
                                              throws org.xml.sax.SAXException,
                                                     java.io.IOException,
                                                     XpathException
        Assert that the evaluation of two Xpaths in two XML strings are NOT equal
        Parameters:
        controlXpath - XPath for not-expected value
        control - document for not-expected value
        testXpath - XPath for actual value
        test - document for actual value
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathValuesNotEqual

        public static void assertXpathValuesNotEqual​(java.lang.String controlXpath,
                                                     java.lang.String inControlXMLString,
                                                     java.lang.String testXpath,
                                                     java.lang.String inTestXMLString)
                                              throws org.xml.sax.SAXException,
                                                     java.io.IOException,
                                                     XpathException
        Assert that the evaluation of two Xpaths in two XML strings are NOT equal
        Parameters:
        controlXpath - XPath for not-expected value
        inControlXMLString - document for not-expected value
        testXpath - XPath for actual value
        inTestXMLString - document for actual value
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        XpathEngine
      • assertXpathValuesNotEqual

        public static void assertXpathValuesNotEqual​(java.lang.String controlXpath,
                                                     org.w3c.dom.Document controlDocument,
                                                     java.lang.String testXpath,
                                                     org.w3c.dom.Document testDocument)
                                              throws XpathException
        Assert that the evaluation of two Xpaths in two documents are NOT equal
        Parameters:
        controlXpath - XPath for not-expected value
        controlDocument - document for not-expected value
        testXpath - XPath for actual value
        testDocument - document for actual value
        Throws:
        XpathException - if XPath construction fails
        See Also:
        XpathEngine
      • assertXpathEvaluatesTo

        public static void assertXpathEvaluatesTo​(java.lang.String expectedValue,
                                                  java.lang.String xpathExpression,
                                                  org.xml.sax.InputSource control)
                                           throws org.xml.sax.SAXException,
                                                  java.io.IOException,
                                                  XpathException
        Assert the value of an Xpath expression in an XML document.
        Parameters:
        expectedValue - the expected value
        xpathExpression - XPath for actual value
        control - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathEvaluatesTo

        public static void assertXpathEvaluatesTo​(java.lang.String expectedValue,
                                                  java.lang.String xpathExpression,
                                                  java.lang.String inXMLString)
                                           throws org.xml.sax.SAXException,
                                                  java.io.IOException,
                                                  XpathException
        Assert the value of an Xpath expression in an XML String
        Parameters:
        expectedValue - the expected value
        xpathExpression - XPath for actual value
        inXMLString - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathEvaluatesTo

        public static void assertXpathEvaluatesTo​(java.lang.String expectedValue,
                                                  java.lang.String xpathExpression,
                                                  org.w3c.dom.Document inDocument)
                                           throws XpathException
        Assert the value of an Xpath expression in an DOM Document
        Parameters:
        expectedValue - the expected value
        xpathExpression - XPath for actual value
        inDocument - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathEvaluatesTo

        public static void assertXpathEvaluatesTo​(QualifiedName expectedValue,
                                                  java.lang.String xpathExpression,
                                                  org.xml.sax.InputSource control)
                                           throws org.xml.sax.SAXException,
                                                  java.io.IOException,
                                                  XpathException
        Assert the value of an Xpath expression in an XML document.
        Parameters:
        expectedValue - the expected value
        xpathExpression - XPath for actual value
        control - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathEvaluatesTo

        public static void assertXpathEvaluatesTo​(QualifiedName expectedValue,
                                                  java.lang.String xpathExpression,
                                                  java.lang.String inXMLString)
                                           throws org.xml.sax.SAXException,
                                                  java.io.IOException,
                                                  XpathException
        Assert the value of an Xpath expression in an XML String
        Parameters:
        expectedValue - the expected value
        xpathExpression - XPath for actual value
        inXMLString - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathEvaluatesTo

        public static void assertXpathEvaluatesTo​(QualifiedName expectedValue,
                                                  java.lang.String xpathExpression,
                                                  org.w3c.dom.Document inDocument)
                                           throws XpathException
        Assert the value of an Xpath expression in an DOM Document
        Parameters:
        expectedValue - the expected value
        xpathExpression - XPath for actual value
        inDocument - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathExists

        public static void assertXpathExists​(java.lang.String xPathExpression,
                                             org.xml.sax.InputSource control)
                                      throws java.io.IOException,
                                             org.xml.sax.SAXException,
                                             XpathException
        Assert that a specific XPath exists in some given XML
        Parameters:
        xPathExpression - XPath for actual value
        control - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathExists

        public static void assertXpathExists​(java.lang.String xPathExpression,
                                             java.lang.String inXMLString)
                                      throws java.io.IOException,
                                             org.xml.sax.SAXException,
                                             XpathException
        Assert that a specific XPath exists in some given XML
        Parameters:
        xPathExpression - XPath for actual value
        inXMLString - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathExists

        public static void assertXpathExists​(java.lang.String xPathExpression,
                                             org.w3c.dom.Document inDocument)
                                      throws XpathException
        Assert that a specific XPath exists in some given XML
        Parameters:
        xPathExpression - XPath for actual value
        inDocument - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathNotExists

        public static void assertXpathNotExists​(java.lang.String xPathExpression,
                                                org.xml.sax.InputSource control)
                                         throws java.io.IOException,
                                                org.xml.sax.SAXException,
                                                XpathException
        Assert that a specific XPath does NOT exist in some given XML
        Parameters:
        xPathExpression - XPath for actual value
        control - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathNotExists

        public static void assertXpathNotExists​(java.lang.String xPathExpression,
                                                java.lang.String inXMLString)
                                         throws java.io.IOException,
                                                org.xml.sax.SAXException,
                                                XpathException
        Assert that a specific XPath does NOT exist in some given XML
        Parameters:
        xPathExpression - XPath for actual value
        inXMLString - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathNotExists

        public static void assertXpathNotExists​(java.lang.String xPathExpression,
                                                org.w3c.dom.Document inDocument)
                                         throws XpathException
        Assert that a specific XPath does NOT exist in some given XML
        Parameters:
        xPathExpression - XPath for actual value
        inDocument - document to apply XPaths to
        Throws:
        XpathException - if XPath construction fails
        See Also:
        which provides the underlying evaluation mechanism
      • assertXMLValid

        public static void assertXMLValid​(org.xml.sax.InputSource xml)
                                   throws org.xml.sax.SAXException,
                                          ConfigurationException
        Assert that an InputSource containing XML contains valid XML: the document must contain a DOCTYPE declaration to be validated
        Parameters:
        xml - the document to validate
        Throws:
        org.xml.sax.SAXException - if the parser says so
        ConfigurationException - if validation could not be turned on
        See Also:
        Validator
      • assertXMLValid

        public static void assertXMLValid​(java.lang.String xmlString)
                                   throws org.xml.sax.SAXException,
                                          ConfigurationException
        Assert that a String containing XML contains valid XML: the String must contain a DOCTYPE declaration to be validated
        Parameters:
        xmlString - the document to validate
        Throws:
        org.xml.sax.SAXException - if the parser says so
        ConfigurationException - if validation could not be turned on
        See Also:
        Validator
      • assertXMLValid

        public static void assertXMLValid​(org.xml.sax.InputSource xml,
                                          java.lang.String systemId)
                                   throws org.xml.sax.SAXException,
                                          ConfigurationException
        Assert that an InputSource containing XML contains valid XML: the document must contain a DOCTYPE to be validated, but the validation will use the systemId to obtain the DTD
        Parameters:
        xml - the document to validate
        systemId - used to obtain the DTD
        Throws:
        org.xml.sax.SAXException - if the parser says so
        ConfigurationException - if validation could not be turned on
        See Also:
        Validator
      • assertXMLValid

        public static void assertXMLValid​(java.lang.String xmlString,
                                          java.lang.String systemId)
                                   throws org.xml.sax.SAXException,
                                          ConfigurationException
        Assert that a String containing XML contains valid XML: the String must contain a DOCTYPE to be validated, but the validation will use the systemId to obtain the DTD
        Parameters:
        xmlString - the document to validate
        systemId - used to obtain the DTD
        Throws:
        org.xml.sax.SAXException - if the parser says so
        ConfigurationException - if validation could not be turned on
        See Also:
        Validator
      • assertXMLValid

        public static void assertXMLValid​(org.xml.sax.InputSource xml,
                                          java.lang.String systemId,
                                          java.lang.String doctype)
                                   throws org.xml.sax.SAXException,
                                          ConfigurationException
        Assert that a piece of XML contains valid XML: the document will be given a DOCTYPE to be validated with the name and systemId specified regardless of whether it already contains a doctype declaration.
        Parameters:
        xml - the document to validate
        systemId - used to obtain the DTD
        doctype - DOCTYPE to use during validation
        Throws:
        org.xml.sax.SAXException - if the parser says so
        ConfigurationException - if validation could not be turned on
        See Also:
        Validator
      • assertXMLValid

        public static void assertXMLValid​(java.lang.String xmlString,
                                          java.lang.String systemId,
                                          java.lang.String doctype)
                                   throws org.xml.sax.SAXException,
                                          ConfigurationException
        Assert that a String containing XML contains valid XML: the String will be given a DOCTYPE to be validated with the name and systemId specified regardless of whether it already contains a doctype declaration.
        Parameters:
        xmlString - the document to validate
        systemId - used to obtain the DTD
        doctype - DOCTYPE to use during validation
        Throws:
        org.xml.sax.SAXException - if the parser says so
        ConfigurationException - if validation could not be turned on
        See Also:
        Validator
      • assertXMLValid

        public static void assertXMLValid​(Validator validator)
        Assert that a Validator instance returns isValid() == true
        Parameters:
        validator - validator to check
      • assertNodeTestPasses

        public static void assertNodeTestPasses​(org.xml.sax.InputSource xml,
                                                NodeTester tester,
                                                short nodeType)
                                         throws org.xml.sax.SAXException,
                                                java.io.IOException
        Execute a NodeTest for a single node type and assert that it passes
        Parameters:
        xml - the document to validate
        tester - The test strategy
        nodeType - The node type to be tested: constants defined in org.w3c.dom.Node e.g. Node.ELEMENT_NODE
        Throws:
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        AbstractNodeTester, CountingNodeTester
      • assertNodeTestPasses

        public static void assertNodeTestPasses​(java.lang.String xmlString,
                                                NodeTester tester,
                                                short nodeType)
                                         throws org.xml.sax.SAXException,
                                                java.io.IOException
        Execute a NodeTest for a single node type and assert that it passes
        Parameters:
        xmlString - XML to be tested
        tester - The test strategy
        nodeType - The node type to be tested: constants defined in org.w3c.dom.Node e.g. Node.ELEMENT_NODE
        Throws:
        org.xml.sax.SAXException - if the parser says so
        java.io.IOException - on I/O errors
        See Also:
        AbstractNodeTester, CountingNodeTester
      • assertNodeTestPasses

        public static void assertNodeTestPasses​(NodeTest test,
                                                NodeTester tester,
                                                short[] nodeTypes,
                                                boolean assertion)
        Execute a NodeTest for multiple node types and make an assertion about it whether it is expected to pass
        Parameters:
        test - a NodeTest instance containing the XML source to be tested
        tester - The test strategy
        nodeTypes - The node types to be tested: constants defined in org.w3c.dom.Node e.g. Node.ELEMENT_NODE
        assertion - true if the test is expected to pass, false otherwise
        See Also:
        AbstractNodeTester, CountingNodeTester
      • asXpathResultDocument

        private static org.w3c.dom.Document asXpathResultDocument​(javax.xml.parsers.DocumentBuilder builder,
                                                                  org.w3c.dom.NodeList nodes)