Class XMLTestCase

  • All Implemented Interfaces:
    junit.framework.Test, XMLConstants, XSLTConstants

    public abstract class XMLTestCase
    extends junit.framework.TestCase
    implements XSLTConstants
    JUnit TestCase subclass: extend this to add XML assertion facilities to your test suites. Available assertions are provided by static methods of the XMLAssert class. NB: All underlying similarity and difference testing is done using Diff instances which can be instantiated and evaluated independently of an XMLTestCase.
    See Also:
    Diff.similar(), Diff.identical()
    • Constructor Summary

      Constructors 
      Constructor Description
      XMLTestCase()
      Construct a new XML test case.
      XMLTestCase​(java.lang.String name)
      Construct a new test case.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void assertNodeTestPasses​(java.lang.String xmlString, NodeTester tester, short nodeType)
      Execute a NodeTest for a single node type and assert that it passes
      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
      void assertNodeTestPasses​(org.xml.sax.InputSource xml, NodeTester tester, short nodeType)
      Execute a NodeTest for a single node type and assert that it passes
      void assertXMLEqual​(java.io.Reader control, java.io.Reader test)
      Assert that two XML documents are similar
      void assertXMLEqual​(java.lang.String err, java.io.Reader control, java.io.Reader test)
      Assert that two XML documents are similar
      void assertXMLEqual​(java.lang.String control, java.lang.String test)
      Assert that two XML documents are similar
      void assertXMLEqual​(java.lang.String err, java.lang.String control, java.lang.String test)
      Assert that two XML documents are similar
      void assertXMLEqual​(java.lang.String msg, Diff diff, boolean assertion)
      Assert that the result of an XML comparison is or is not similar.
      void assertXMLEqual​(java.lang.String err, org.w3c.dom.Document control, org.w3c.dom.Document test)
      Assert that two XML documents are similar
      void assertXMLEqual​(java.lang.String err, org.xml.sax.InputSource control, org.xml.sax.InputSource test)
      Assert that two XML documents are similar
      void assertXMLEqual​(Diff diff, boolean assertion)
      Assert that the result of an XML comparison is or is not similar.
      void assertXMLEqual​(org.w3c.dom.Document control, org.w3c.dom.Document test)
      Assert that two XML documents are similar
      void assertXMLEqual​(org.xml.sax.InputSource control, org.xml.sax.InputSource test)
      Assert that two XML documents are similar
      void assertXMLIdentical​(java.lang.String msg, Diff diff, boolean assertion)
      Assert that the result of an XML comparison is or is not identical
      void assertXMLIdentical​(Diff diff, boolean assertion)
      Assert that the result of an XML comparison is or is not identical
      void assertXMLNotEqual​(java.io.Reader control, java.io.Reader test)
      Assert that two XML documents are NOT similar
      void assertXMLNotEqual​(java.lang.String err, java.io.Reader control, java.io.Reader test)
      Assert that two XML documents are NOT similar
      void assertXMLNotEqual​(java.lang.String control, java.lang.String test)
      Assert that two XML documents are NOT similar
      void assertXMLNotEqual​(java.lang.String err, java.lang.String control, java.lang.String test)
      Assert that two XML documents are NOT similar
      void assertXMLNotEqual​(java.lang.String err, org.w3c.dom.Document control, org.w3c.dom.Document test)
      Assert that two XML documents are NOT similar
      void assertXMLNotEqual​(java.lang.String err, org.xml.sax.InputSource control, org.xml.sax.InputSource test)
      Assert that two XML documents are NOT similar
      void assertXMLNotEqual​(org.w3c.dom.Document control, org.w3c.dom.Document test)
      Assert that two XML documents are NOT similar
      void assertXMLNotEqual​(org.xml.sax.InputSource control, org.xml.sax.InputSource test)
      Assert that two XML documents are NOT similar
      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
      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
      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.
      void assertXMLValid​(Validator validator)
      Assert that a Validator instance returns isValid() == true
      void assertXMLValid​(org.xml.sax.InputSource xml)
      Assert that a piece of XML contains valid XML: the input must contain a DOCTYPE declaration to be validated
      void assertXMLValid​(org.xml.sax.InputSource xml, java.lang.String systemId)
      Assert that a piece of XML contains valid XML: the document must contain a DOCTYPE to be validated, but the validation will use the systemId to obtain the DTD
      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.
      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
      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
      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 String
      void assertXpathExists​(java.lang.String xPathExpression, java.lang.String inXMLString)
      Assert that a specific XPath exists in some given XML
      void assertXpathExists​(java.lang.String xPathExpression, org.w3c.dom.Document inDocument)
      Assert that a specific XPath exists in some given XML
      void assertXpathExists​(java.lang.String xPathExpression, org.xml.sax.InputSource xml)
      Assert that a specific XPath exists in some given XML
      void assertXpathNotExists​(java.lang.String xPathExpression, java.lang.String inXMLString)
      Assert that a specific XPath does NOT exist in some given XML
      void assertXpathNotExists​(java.lang.String xPathExpression, org.w3c.dom.Document inDocument)
      Assert that a specific XPath does NOT exist in some given XML
      void assertXpathNotExists​(java.lang.String xPathExpression, org.xml.sax.InputSource xml)
      Assert that a specific XPath does NOT exist in some given XML
      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
      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
      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
      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
      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
      void assertXpathsEqual​(java.lang.String controlXpath, org.xml.sax.InputSource control, java.lang.String testXpath, org.xml.sax.InputSource test)
      Assert that the node lists of two Xpaths in two XML pieces are equal
      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
      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
      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
      void assertXpathsNotEqual​(java.lang.String controlXpath, java.lang.String testXpath, org.xml.sax.InputSource control)
      Assert that the node lists of two Xpaths in the same XML are NOT equal
      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
      void assertXpathsNotEqual​(java.lang.String controlXpath, org.xml.sax.InputSource control, java.lang.String testXpath, org.xml.sax.InputSource test)
      Assert that the node lists of two Xpaths in two pieces of XML are NOT equal
      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
      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
      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
      void assertXpathValuesEqual​(java.lang.String controlXpath, java.lang.String testXpath, org.xml.sax.InputSource control)
      Assert that the evaluation of two Xpaths in the same XML are equal
      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
      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
      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
      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
      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
      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
      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
      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
      Diff compareXML​(java.io.Reader control, java.io.Reader test)
      Compare XML documents provided by two Reader classes
      Diff compareXML​(java.io.Reader control, java.lang.String test)
      Compare XML documents provided by two Reader classes
      Diff compareXML​(java.lang.String control, java.io.Reader test)
      Compare XML documents provided by two Reader classes
      Diff compareXML​(java.lang.String control, java.lang.String test)
      Compare two XML documents provided as strings
      Diff compareXML​(org.w3c.dom.Document control, org.w3c.dom.Document test)
      Compare two XML documents provided as strings
      Diff compareXML​(org.xml.sax.InputSource control, org.xml.sax.InputSource test)
      Compare XML documents provided by two InputSource classes
      • Methods inherited from class junit.framework.TestCase

        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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
      • Methods inherited from class java.lang.Object

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

      • XMLTestCase

        public XMLTestCase()
        Construct a new XML test case.
      • XMLTestCase

        public XMLTestCase​(java.lang.String name)
        Construct a new test case.
        Parameters:
        name - Name of test
    • Method Detail

      • compareXML

        public Diff compareXML​(org.xml.sax.InputSource control,
                               org.xml.sax.InputSource test)
                        throws org.xml.sax.SAXException,
                               java.io.IOException
        Compare XML documents provided by two InputSource classes
        Parameters:
        control - Control document
        test - Document to test
        Returns:
        Diff object describing differences in documents
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • compareXML

        public Diff compareXML​(java.io.Reader control,
                               java.io.Reader test)
                        throws org.xml.sax.SAXException,
                               java.io.IOException
        Compare XML documents provided by two Reader classes
        Parameters:
        control - Control document
        test - Document to test
        Returns:
        Diff object describing differences in documents
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • compareXML

        public Diff compareXML​(java.lang.String control,
                               java.io.Reader test)
                        throws org.xml.sax.SAXException,
                               java.io.IOException
        Compare XML documents provided by two Reader classes
        Parameters:
        control - Control document
        test - Document to test
        Returns:
        Diff object describing differences in documents
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • compareXML

        public Diff compareXML​(java.io.Reader control,
                               java.lang.String test)
                        throws org.xml.sax.SAXException,
                               java.io.IOException
        Compare XML documents provided by two Reader classes
        Parameters:
        control - Control document
        test - Document to test
        Returns:
        Diff object describing differences in documents
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • compareXML

        public Diff compareXML​(java.lang.String control,
                               java.lang.String test)
                        throws org.xml.sax.SAXException,
                               java.io.IOException
        Compare two XML documents provided as strings
        Parameters:
        control - Control document
        test - Document to test
        Returns:
        Diff object describing differences in documents
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • compareXML

        public Diff compareXML​(org.w3c.dom.Document control,
                               org.w3c.dom.Document test)
        Compare two XML documents provided as strings
        Parameters:
        control - Control document
        test - Document to test
        Returns:
        Diff object describing differences in documents
      • assertXMLEqual

        public 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 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
      • assertXMLIdentical

        public 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 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 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
        java.io.IOException
      • assertXMLEqual

        public 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
        java.io.IOException
      • assertXMLEqual

        public 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 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
        java.io.IOException
      • assertXMLEqual

        public 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
        java.io.IOException
      • assertXMLEqual

        public 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
        java.io.IOException
      • assertXMLEqual

        public 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 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
        java.io.IOException
      • assertXMLNotEqual

        public 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
        java.io.IOException
      • assertXMLNotEqual

        public 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
        java.io.IOException
      • assertXMLNotEqual

        public 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 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
        java.io.IOException
      • assertXMLNotEqual

        public 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
        java.io.IOException
      • assertXMLNotEqual

        public 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
        java.io.IOException
      • assertXMLNotEqual

        public 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 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
        java.io.IOException
      • assertXpathsEqual

        public 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 -
        testXpath -
        document -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
        See Also:
        XpathEngine
      • assertXpathsEqual

        public 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 -
        testXpath -
        document -
        Throws:
        XpathException
        See Also:
        XpathEngine
      • assertXpathsEqual

        public 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 -
        testXpath -
        inXMLString -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathsEqual

        public void assertXpathsEqual​(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 node lists of two Xpaths in two XML pieces are equal
        Parameters:
        controlXpath -
        control -
        testXpath -
        test -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathsEqual

        public 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 -
        inControlXMLString -
        testXpath -
        inTestXMLString -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathsEqual

        public 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 -
        testXpath -
        controlDocument -
        testDocument -
        Throws:
        XpathException
        See Also:
        XpathEngine
      • assertXpathsNotEqual

        public 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 -
        testXpath -
        document -
        Throws:
        XpathException
        See Also:
        XpathEngine
      • assertXpathsNotEqual

        public void assertXpathsNotEqual​(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 node lists of two Xpaths in the same XML are NOT equal
        Parameters:
        controlXpath -
        testXpath -
        control -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathsNotEqual

        public 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 -
        testXpath -
        inXMLString -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathsNotEqual

        public void assertXpathsNotEqual​(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 node lists of two Xpaths in two pieces of XML are NOT equal
        Parameters:
        controlXpath -
        control -
        testXpath -
        test -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathsNotEqual

        public 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 -
        inControlXMLString -
        testXpath -
        inTestXMLString -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathsNotEqual

        public 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 -
        testXpath -
        controlDocument -
        testDocument -
        Throws:
        XpathException
        See Also:
        XpathEngine
      • assertXpathValuesEqual

        public 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 -
        testXpath -
        document -
        Throws:
        XpathException
        See Also:
        XpathEngine
      • assertXpathValuesEqual

        public void assertXpathValuesEqual​(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 are equal
        Parameters:
        controlXpath -
        testXpath -
        control -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathValuesEqual

        public 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 -
        testXpath -
        inXMLString -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathValuesEqual

        public 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 -
        control -
        testXpath -
        test -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathValuesEqual

        public 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 -
        inControlXMLString -
        testXpath -
        inTestXMLString -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathValuesEqual

        public 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 -
        testXpath -
        controlDocument -
        testDocument -
        Throws:
        XpathException
        See Also:
        XpathEngine
      • assertXpathValuesNotEqual

        public 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 -
        testXpath -
        control -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathValuesNotEqual

        public 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 -
        testXpath -
        inXMLString -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathValuesNotEqual

        public 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 -
        testXpath -
        document -
        Throws:
        XpathException
      • assertXpathValuesNotEqual

        public 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 -
        control -
        testXpath -
        test -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathValuesNotEqual

        public 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 -
        inControlXMLString -
        testXpath -
        inTestXMLString -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
      • assertXpathValuesNotEqual

        public 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 -
        testXpath -
        controlDocument -
        testDocument -
        Throws:
        XpathException
      • assertXpathEvaluatesTo

        public 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 String
        Parameters:
        expectedValue -
        xpathExpression -
        control -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathEvaluatesTo

        public 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 -
        xpathExpression -
        inXMLString -
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        XpathException
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathEvaluatesTo

        public 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 -
        xpathExpression -
        inDocument -
        Throws:
        XpathException
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathExists

        public void assertXpathExists​(java.lang.String xPathExpression,
                                      org.xml.sax.InputSource xml)
                               throws java.io.IOException,
                                      org.xml.sax.SAXException,
                                      XpathException
        Assert that a specific XPath exists in some given XML
        Parameters:
        xPathExpression -
        xml -
        Throws:
        java.io.IOException
        org.xml.sax.SAXException
        XpathException
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathExists

        public 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 -
        inXMLString -
        Throws:
        java.io.IOException
        org.xml.sax.SAXException
        XpathException
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathNotExists

        public void assertXpathNotExists​(java.lang.String xPathExpression,
                                         org.xml.sax.InputSource xml)
                                  throws java.io.IOException,
                                         org.xml.sax.SAXException,
                                         XpathException
        Assert that a specific XPath does NOT exist in some given XML
        Parameters:
        xPathExpression -
        xml -
        Throws:
        java.io.IOException
        org.xml.sax.SAXException
        XpathException
        See Also:
        which provides the underlying evaluation mechanism
      • assertXpathNotExists

        public 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 -
        inXMLString -
        Throws:
        java.io.IOException
        org.xml.sax.SAXException
        XpathException
        See Also:
        which provides the underlying evaluation mechanism
      • assertXMLValid

        public void assertXMLValid​(org.xml.sax.InputSource xml)
                            throws org.xml.sax.SAXException,
                                   ConfigurationException
        Assert that a piece of XML contains valid XML: the input must contain a DOCTYPE declaration to be validated
        Parameters:
        xml -
        Throws:
        org.xml.sax.SAXException
        ConfigurationException - if validation could not be turned on
        See Also:
        Validator
      • assertXMLValid

        public 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 -
        Throws:
        org.xml.sax.SAXException
        ConfigurationException - if validation could not be turned on
        See Also:
        Validator
      • assertXMLValid

        public void assertXMLValid​(org.xml.sax.InputSource xml,
                                   java.lang.String systemId)
                            throws org.xml.sax.SAXException,
                                   ConfigurationException
        Assert that a piece of 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 -
        systemId -
        Throws:
        org.xml.sax.SAXException
        ConfigurationException - if validation could not be turned on
        See Also:
        Validator
      • assertXMLValid

        public 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 -
        systemId -
        Throws:
        org.xml.sax.SAXException
        ConfigurationException - if validation could not be turned on
        See Also:
        Validator
      • assertXMLValid

        public 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 -
        systemId -
        doctype -
        Throws:
        org.xml.sax.SAXException
        ConfigurationException - if validation could not be turned on
        See Also:
        Validator
      • assertXMLValid

        public 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 -
        systemId -
        doctype -
        Throws:
        org.xml.sax.SAXException
        ConfigurationException - if validation could not be turned on
        See Also:
        Validator
      • assertXMLValid

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

        public 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 - XML to be tested
        tester - The test strategy
        nodeType - The node type to be tested: constants defined in Node e.g. Node.ELEMENT_NODE
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        See Also:
        AbstractNodeTester, CountingNodeTester
      • assertNodeTestPasses

        public 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 Node e.g. Node.ELEMENT_NODE
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
        See Also:
        AbstractNodeTester, CountingNodeTester
      • assertNodeTestPasses

        public 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 Node e.g. Node.ELEMENT_NODE
        assertion - true if the test is expected to pass, false otherwise
        See Also:
        AbstractNodeTester, CountingNodeTester