Package org.custommonkey.xmlunit
Class XMLAssert
java.lang.Object
junit.framework.Assert
org.custommonkey.xmlunit.XMLAssert
- All Implemented Interfaces:
XMLConstants,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:
Available assertion methods are:
assertXMLEqual
assert that two pieces of XML markup are similarassertXMLNotEqual
assert that two pieces of XML markup are differentassertXMLIdentical
assert that two pieces of XML markup are identical. In most cases this assertion is too strong andassertXMLEqualis sufficientassertXpathExists
assert that an XPath expression matches at least one nodeassertXpathNotExists
assert that an XPath expression does not match any nodesassertXpathsEqual
assert that the nodes obtained by executing two Xpaths are similarassertXpathsNotEqual
assert that the nodes obtained by executing two Xpaths are differentassertXpathValuesEqual
assert that the flattened String obtained by executing two Xpaths are similarassertXpathValuesNotEqual
assert that the flattened String obtained by executing two Xpaths are differentassertXpathEvaluatesTo
assert that the flattened String obtained by executing an Xpath is a particular valueassertXMLValid
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 DTDassertNodeTestPasses
assert that a piece of XML markup passes aNodeTest
Diff instances which can be instantiated and evaluated
independently of this class.- See Also:
-
Field Summary
Fields inherited from interface org.custommonkey.xmlunit.XMLConstants
CLOSE_NODE, END_CDATA, END_COMMENT, END_PROCESSING_INSTRUCTION, NULL_NS_URI, OPEN_END_NODE, OPEN_START_NODE, START_CDATA, START_COMMENT, START_DOCTYPE, START_PROCESSING_INSTRUCTION, W3C_XML_SCHEMA_INSTANCE_NO_NAMESPACE_SCHEMA_LOCATION_ATTR, W3C_XML_SCHEMA_INSTANCE_NS_URI, W3C_XML_SCHEMA_INSTANCE_SCHEMA_LOCATION_ATTR, W3C_XML_SCHEMA_NS_URI, XML_DECLARATION, XMLNS_PREFIX, XPATH_ATTRIBUTE_IDENTIFIER, XPATH_CHARACTER_NODE_IDENTIFIER, XPATH_COMMENT_IDENTIFIER, XPATH_NODE_INDEX_END, XPATH_NODE_INDEX_START, XPATH_PROCESSING_INSTRUCTION_IDENTIFIER, XPATH_SEPARATORFields inherited from interface org.custommonkey.xmlunit.XSLTConstants
JAVA5_XSLTC_FACTORY_NAME, XSLT_END, XSLT_IDENTITY_TEMPLATE, XSLT_START, XSLT_START_NO_VERSION, XSLT_STRIP_COMMENTS_TEMPLATE, XSLT_STRIP_WHITESPACE, XSLT_XML_OUTPUT_NOINDENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertNodeTestPasses(String xmlString, NodeTester tester, short nodeType) Execute aNodeTestfor a single node type and assert that it passesstatic voidassertNodeTestPasses(NodeTest test, NodeTester tester, short[] nodeTypes, boolean assertion) Execute aNodeTestfor multiple node types and make an assertion about it whether it is expected to passstatic voidassertNodeTestPasses(InputSource xml, NodeTester tester, short nodeType) Execute aNodeTestfor a single node type and assert that it passesstatic voidassertXMLEqual(Reader control, Reader test) Assert that two XML documents are similarstatic voidassertXMLEqual(String err, Reader control, Reader test) Assert that two XML documents are similarstatic voidassertXMLEqual(String control, String test) Assert that two XML documents are similarstatic voidassertXMLEqual(String err, String control, String test) Assert that two XML documents are similarstatic voidassertXMLEqual(String msg, Diff diff, boolean assertion) Assert that the result of an XML comparison is or is not similar.static voidassertXMLEqual(String err, Document control, Document test) Assert that two XML documents are similarstatic voidassertXMLEqual(String err, InputSource control, InputSource test) Assert that two XML documents are similarstatic voidassertXMLEqual(Diff diff, boolean assertion) Assert that the result of an XML comparison is or is not similar.static voidassertXMLEqual(Document control, Document test) Assert that two XML documents are similarstatic voidassertXMLEqual(InputSource control, InputSource test) Assert that two XML documents are similarstatic voidassertXMLIdentical(String msg, Diff diff, boolean assertion) Assert that the result of an XML comparison is or is not identicalstatic voidassertXMLIdentical(Diff diff, boolean assertion) Assert that the result of an XML comparison is or is not identicalstatic voidassertXMLNotEqual(Reader control, Reader test) Assert that two XML documents are NOT similarstatic voidassertXMLNotEqual(String err, Reader control, Reader test) Assert that two XML documents are NOT similarstatic voidassertXMLNotEqual(String control, String test) Assert that two XML documents are NOT similarstatic voidassertXMLNotEqual(String err, String control, String test) Assert that two XML documents are NOT similarstatic voidassertXMLNotEqual(String err, Document control, Document test) Assert that two XML documents are NOT similarstatic voidassertXMLNotEqual(String err, InputSource control, InputSource test) Assert that two XML documents are NOT similarstatic voidassertXMLNotEqual(Document control, Document test) Assert that two XML documents are NOT similarstatic voidassertXMLNotEqual(InputSource control, InputSource test) Assert that two XML documents are NOT similarstatic voidassertXMLValid(String xmlString) Assert that a String containing XML contains valid XML: the String must contain a DOCTYPE declaration to be validatedstatic voidassertXMLValid(String xmlString, 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 DTDstatic voidassertXMLValid(String xmlString, String systemId, 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 voidassertXMLValid(Validator validator) Assert that a Validator instance returnsisValid() == truestatic voidAssert that an InputSource containing XML contains valid XML: the document must contain a DOCTYPE declaration to be validatedstatic voidassertXMLValid(InputSource xml, 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 DTDstatic voidassertXMLValid(InputSource xml, String systemId, 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.static voidassertXpathEvaluatesTo(String expectedValue, String xpathExpression, String inXMLString) Assert the value of an Xpath expression in an XML Stringstatic voidassertXpathEvaluatesTo(String expectedValue, String xpathExpression, Document inDocument) Assert the value of an Xpath expression in an DOM Documentstatic voidassertXpathEvaluatesTo(String expectedValue, String xpathExpression, InputSource control) Assert the value of an Xpath expression in an XML document.static voidassertXpathEvaluatesTo(QualifiedName expectedValue, String xpathExpression, String inXMLString) Assert the value of an Xpath expression in an XML Stringstatic voidassertXpathEvaluatesTo(QualifiedName expectedValue, String xpathExpression, Document inDocument) Assert the value of an Xpath expression in an DOM Documentstatic voidassertXpathEvaluatesTo(QualifiedName expectedValue, String xpathExpression, InputSource control) Assert the value of an Xpath expression in an XML document.static voidassertXpathExists(String xPathExpression, String inXMLString) Assert that a specific XPath exists in some given XMLstatic voidassertXpathExists(String xPathExpression, Document inDocument) Assert that a specific XPath exists in some given XMLstatic voidassertXpathExists(String xPathExpression, InputSource control) Assert that a specific XPath exists in some given XMLstatic voidassertXpathNotExists(String xPathExpression, String inXMLString) Assert that a specific XPath does NOT exist in some given XMLstatic voidassertXpathNotExists(String xPathExpression, Document inDocument) Assert that a specific XPath does NOT exist in some given XMLstatic voidassertXpathNotExists(String xPathExpression, InputSource control) Assert that a specific XPath does NOT exist in some given XMLstatic voidassertXpathsEqual(String controlXpath, String testXpath, String inXMLString) Assert that the node lists of two Xpaths in the same XML string are equalstatic voidassertXpathsEqual(String controlXpath, String inControlXMLString, String testXpath, String inTestXMLString) Assert that the node lists of two Xpaths in two XML strings are equalstatic voidassertXpathsEqual(String controlXpath, String testXpath, Document document) Assert that the node lists of two Xpaths in the same document are equalstatic voidassertXpathsEqual(String controlXpath, String testXpath, InputSource document) Assert that the node lists of two Xpaths in the same document are equalstatic voidassertXpathsEqual(String controlXpath, Document controlDocument, String testXpath, Document testDocument) Assert that the node lists of two Xpaths in two documents are equalstatic voidassertXpathsEqual(String controlXpath, InputSource controlDocument, String testXpath, InputSource testDocument) Assert that the node lists of two Xpaths in two documents are equalstatic voidassertXpathsNotEqual(String controlXpath, String testXpath, String inXMLString) Assert that the node lists of two Xpaths in the same XML string are NOT equalstatic voidassertXpathsNotEqual(String controlXpath, String inControlXMLString, String testXpath, String inTestXMLString) Assert that the node lists of two Xpaths in two XML strings are NOT equalstatic voidassertXpathsNotEqual(String controlXpath, String testXpath, Document document) Assert that the node lists of two Xpaths in the same document are NOT equalstatic voidassertXpathsNotEqual(String controlXpath, String testXpath, InputSource document) Assert that the node lists of two Xpaths in the same document are NOT equalstatic voidassertXpathsNotEqual(String controlXpath, Document controlDocument, String testXpath, Document testDocument) Assert that the node lists of two Xpaths in two documents are NOT equalstatic voidassertXpathsNotEqual(String controlXpath, InputSource controlDocument, String testXpath, InputSource testDocument) Assert that the node lists of two Xpaths in two XML strings are NOT equalstatic voidassertXpathValuesEqual(String controlXpath, String testXpath, String inXMLString) Assert that the evaluation of two Xpaths in the same XML string are equalstatic voidassertXpathValuesEqual(String controlXpath, String inControlXMLString, String testXpath, String inTestXMLString) Assert that the evaluation of two Xpaths in two XML strings are equalstatic voidassertXpathValuesEqual(String controlXpath, String testXpath, Document document) Assert that the evaluation of two Xpaths in the same document are equalstatic voidassertXpathValuesEqual(String controlXpath, String testXpath, InputSource document) Assert that the evaluation of two Xpaths in the same XML string are equalstatic voidassertXpathValuesEqual(String controlXpath, Document controlDocument, String testXpath, Document testDocument) Assert that the evaluation of two Xpaths in two documents are equalstatic voidassertXpathValuesEqual(String controlXpath, InputSource control, String testXpath, InputSource test) Assert that the evaluation of two Xpaths in two XML strings are equalstatic voidassertXpathValuesNotEqual(String controlXpath, String testXpath, String inXMLString) Assert that the evaluation of two Xpaths in the same XML string are NOT equalstatic voidassertXpathValuesNotEqual(String controlXpath, String inControlXMLString, String testXpath, String inTestXMLString) Assert that the evaluation of two Xpaths in two XML strings are NOT equalstatic voidassertXpathValuesNotEqual(String controlXpath, String testXpath, Document document) Assert that the evaluation of two Xpaths in the same document are NOT equalstatic voidassertXpathValuesNotEqual(String controlXpath, String testXpath, InputSource control) Assert that the evaluation of two Xpaths in the same XML string are NOT equalstatic voidassertXpathValuesNotEqual(String controlXpath, Document controlDocument, String testXpath, Document testDocument) Assert that the evaluation of two Xpaths in two documents are NOT equalstatic voidassertXpathValuesNotEqual(String controlXpath, InputSource control, String testXpath, InputSource test) Assert that the evaluation of two Xpaths in two XML strings are NOT equalMethods 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
-
Constructor Details
-
XMLAssert
protected XMLAssert()Empty constructor.
-
-
Method Details
-
assertXMLEqual
Assert that the result of an XML comparison is or is not similar.- Parameters:
diff- the result of an XML comparisonassertion- true if asserting that result is similar
-
assertXMLEqual
Assert that the result of an XML comparison is or is not similar.- Parameters:
msg- additional message to display if assertion failsdiff- the result of an XML comparisonassertion- true if asserting that result is similar
-
assertXMLIdentical
Assert that the result of an XML comparison is or is not identical- Parameters:
diff- the result of an XML comparisonassertion- true if asserting that result is identical
-
assertXMLIdentical
Assert that the result of an XML comparison is or is not identical- Parameters:
msg- Message to display if assertion failsdiff- the result of an XML comparisonassertion- true if asserting that result is identical
-
assertXMLEqual
public static void assertXMLEqual(InputSource control, InputSource test) throws SAXException, IOException Assert that two XML documents are similar- Parameters:
control- XML to be compared againsttest- XML to be tested- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
assertXMLEqual
Assert that two XML documents are similar- Parameters:
control- XML to be compared againsttest- XML to be tested- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
assertXMLEqual
Assert that two XML documents are similar- Parameters:
control- XML to be compared againsttest- XML to be tested
-
assertXMLEqual
Assert that two XML documents are similar- Parameters:
control- XML to be compared againsttest- XML to be tested- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
assertXMLEqual
public static void assertXMLEqual(String err, InputSource control, InputSource test) throws SAXException, IOException Assert that two XML documents are similar- Parameters:
err- Message to be displayed on assertion failurecontrol- XML to be compared againsttest- XML to be tested- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
assertXMLEqual
public static void assertXMLEqual(String err, String control, String test) throws SAXException, IOException Assert that two XML documents are similar- Parameters:
err- Message to be displayed on assertion failurecontrol- XML to be compared againsttest- XML to be tested- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
assertXMLEqual
Assert that two XML documents are similar- Parameters:
err- Message to be displayed on assertion failurecontrol- XML to be compared againsttest- XML to be tested
-
assertXMLEqual
public static void assertXMLEqual(String err, Reader control, Reader test) throws SAXException, IOException Assert that two XML documents are similar- Parameters:
err- Message to be displayed on assertion failurecontrol- XML to be compared againsttest- XML to be tested- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
assertXMLNotEqual
public static void assertXMLNotEqual(InputSource control, InputSource test) throws SAXException, IOException Assert that two XML documents are NOT similar- Parameters:
control- XML to be compared againsttest- XML to be tested- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
assertXMLNotEqual
Assert that two XML documents are NOT similar- Parameters:
control- XML to be compared againsttest- XML to be tested- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
assertXMLNotEqual
Assert that two XML documents are NOT similar- Parameters:
control- XML to be compared againsttest- XML to be tested
-
assertXMLNotEqual
Assert that two XML documents are NOT similar- Parameters:
control- XML to be compared againsttest- XML to be tested- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
assertXMLNotEqual
public static void assertXMLNotEqual(String err, InputSource control, InputSource test) throws SAXException, IOException Assert that two XML documents are NOT similar- Parameters:
err- Message to be displayed on assertion failurecontrol- XML to be compared againsttest- XML to be tested- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
assertXMLNotEqual
public static void assertXMLNotEqual(String err, String control, String test) throws SAXException, IOException Assert that two XML documents are NOT similar- Parameters:
err- Message to be displayed on assertion failurecontrol- XML to be compared againsttest- XML to be tested- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
assertXMLNotEqual
Assert that two XML documents are NOT similar- Parameters:
err- Message to be displayed on assertion failurecontrol- XML to be compared againsttest- XML to be tested
-
assertXMLNotEqual
public static void assertXMLNotEqual(String err, Reader control, Reader test) throws SAXException, IOException Assert that two XML documents are NOT similar- Parameters:
err- Message to be displayed on assertion failurecontrol- XML to be compared againsttest- XML to be tested- Throws:
SAXException- if the parser says soIOException- on I/O errors
-
assertXpathsEqual
public static void assertXpathsEqual(String controlXpath, String testXpath, Document document) throws XpathException Assert that the node lists of two Xpaths in the same document are equal- Parameters:
controlXpath- XPath for expected valuetestXpath- XPath for actual valuedocument- document to apply XPaths to- Throws:
XpathException- if XPath construction fails- See Also:
-
assertXpathsEqual
public static void assertXpathsEqual(String controlXpath, String testXpath, InputSource document) throws SAXException, IOException, XpathException Assert that the node lists of two Xpaths in the same document are equal- Parameters:
controlXpath- XPath for expected valuetestXpath- XPath for actual valuedocument- document to apply XPaths to- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathsEqual
public static void assertXpathsEqual(String controlXpath, String testXpath, String inXMLString) throws SAXException, IOException, XpathException Assert that the node lists of two Xpaths in the same XML string are equal- Parameters:
controlXpath- XPath for expected valuetestXpath- XPath for actual valueinXMLString- document to apply XPaths to- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathsEqual
public static void assertXpathsEqual(String controlXpath, InputSource controlDocument, String testXpath, InputSource testDocument) throws SAXException, IOException, XpathException Assert that the node lists of two Xpaths in two documents are equal- Parameters:
controlXpath- XPath for expected valuecontrolDocument- document for expected valuetestXpath- XPath for actual valuetestDocument- document for actual value- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathsEqual
public static void assertXpathsEqual(String controlXpath, String inControlXMLString, String testXpath, String inTestXMLString) throws SAXException, IOException, XpathException Assert that the node lists of two Xpaths in two XML strings are equal- Parameters:
controlXpath- XPath for expected valueinControlXMLString- document for expected valuetestXpath- XPath for actual valueinTestXMLString- document for actual value- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathsEqual
public static void assertXpathsEqual(String controlXpath, Document controlDocument, String testXpath, Document testDocument) throws XpathException Assert that the node lists of two Xpaths in two documents are equal- Parameters:
controlXpath- XPath for expected valuecontrolDocument- document for expected valuetestXpath- XPath for actual valuetestDocument- document for actual value- Throws:
XpathException- if XPath construction fails- See Also:
-
assertXpathsNotEqual
public static void assertXpathsNotEqual(String controlXpath, String testXpath, 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 valuetestXpath- XPath for actual valuedocument- document to apply XPaths to- Throws:
XpathException- if XPath construction fails- See Also:
-
assertXpathsNotEqual
public static void assertXpathsNotEqual(String controlXpath, String testXpath, InputSource document) throws SAXException, IOException, XpathException Assert that the node lists of two Xpaths in the same document are NOT equal- Parameters:
controlXpath- XPath for not-expected valuetestXpath- XPath for actual valuedocument- document to apply XPaths to- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathsNotEqual
public static void assertXpathsNotEqual(String controlXpath, String testXpath, String inXMLString) throws SAXException, IOException, XpathException Assert that the node lists of two Xpaths in the same XML string are NOT equal- Parameters:
controlXpath- XPath for not-expected valuetestXpath- XPath for actual valueinXMLString- document to apply XPaths to- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathsNotEqual
public static void assertXpathsNotEqual(String controlXpath, String inControlXMLString, String testXpath, String inTestXMLString) throws SAXException, IOException, XpathException Assert that the node lists of two Xpaths in two XML strings are NOT equal- Parameters:
controlXpath- XPath for not-expected valueinControlXMLString- document for not-expected valuetestXpath- XPath for actual valueinTestXMLString- document for actual value- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathsNotEqual
public static void assertXpathsNotEqual(String controlXpath, InputSource controlDocument, String testXpath, InputSource testDocument) throws SAXException, IOException, XpathException Assert that the node lists of two Xpaths in two XML strings are NOT equal- Parameters:
controlXpath- XPath for not-expected valuecontrolDocument- document for not-expected valuetestXpath- XPath for actual valuetestDocument- document for actual value- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathsNotEqual
public static void assertXpathsNotEqual(String controlXpath, Document controlDocument, String testXpath, Document testDocument) throws XpathException Assert that the node lists of two Xpaths in two documents are NOT equal- Parameters:
controlXpath- XPath for not-expected valuecontrolDocument- document for not-expected valuetestXpath- XPath for actual valuetestDocument- document for actual value- Throws:
XpathException- if XPath construction fails- See Also:
-
assertXpathValuesEqual
public static void assertXpathValuesEqual(String controlXpath, String testXpath, Document document) throws XpathException Assert that the evaluation of two Xpaths in the same document are equal- Parameters:
controlXpath- XPath for expected valuetestXpath- XPath for actual valuedocument- document to apply XPaths to- Throws:
XpathException- if XPath construction fails- See Also:
-
assertXpathValuesEqual
public static void assertXpathValuesEqual(String controlXpath, String testXpath, InputSource document) throws SAXException, IOException, XpathException Assert that the evaluation of two Xpaths in the same XML string are equal- Parameters:
controlXpath- XPath for expected valuetestXpath- XPath for actual valuedocument- document to apply XPaths to- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathValuesEqual
public static void assertXpathValuesEqual(String controlXpath, String testXpath, String inXMLString) throws SAXException, IOException, XpathException Assert that the evaluation of two Xpaths in the same XML string are equal- Parameters:
controlXpath- XPath for expected valuetestXpath- XPath for actual valueinXMLString- document to apply XPaths to- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathValuesEqual
public static void assertXpathValuesEqual(String controlXpath, InputSource control, String testXpath, InputSource test) throws SAXException, IOException, XpathException Assert that the evaluation of two Xpaths in two XML strings are equal- Parameters:
controlXpath- XPath for expected valuecontrol- document for expected valuetestXpath- XPath for actual valuetest- document for actual value- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathValuesEqual
public static void assertXpathValuesEqual(String controlXpath, String inControlXMLString, String testXpath, String inTestXMLString) throws SAXException, IOException, XpathException Assert that the evaluation of two Xpaths in two XML strings are equal- Parameters:
controlXpath- XPath for expected valueinControlXMLString- document for expected valuetestXpath- XPath for actual valueinTestXMLString- document for actual value- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathValuesEqual
public static void assertXpathValuesEqual(String controlXpath, Document controlDocument, String testXpath, Document testDocument) throws XpathException Assert that the evaluation of two Xpaths in two documents are equal- Parameters:
controlXpath- XPath for expected valuecontrolDocument- document for expected valuetestXpath- XPath for actual valuetestDocument- document for actual value- Throws:
XpathException- if XPath construction fails- See Also:
-
assertXpathValuesNotEqual
public static void assertXpathValuesNotEqual(String controlXpath, String testXpath, InputSource control) throws SAXException, IOException, XpathException Assert that the evaluation of two Xpaths in the same XML string are NOT equal- Parameters:
controlXpath- XPath for not-expected valuecontrol- document to apply XPaths totestXpath- XPath for actual value- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathValuesNotEqual
public static void assertXpathValuesNotEqual(String controlXpath, String testXpath, String inXMLString) throws SAXException, IOException, XpathException Assert that the evaluation of two Xpaths in the same XML string are NOT equal- Parameters:
controlXpath- XPath for not-expected valueinXMLString- document to apply XPaths totestXpath- XPath for actual value- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathValuesNotEqual
public static void assertXpathValuesNotEqual(String controlXpath, String testXpath, Document document) throws XpathException Assert that the evaluation of two Xpaths in the same document are NOT equal- Parameters:
controlXpath- XPath for not-expected valuedocument- document to apply XPaths totestXpath- XPath for actual value- Throws:
XpathException- if XPath construction fails- See Also:
-
assertXpathValuesNotEqual
public static void assertXpathValuesNotEqual(String controlXpath, InputSource control, String testXpath, InputSource test) throws SAXException, IOException, XpathException Assert that the evaluation of two Xpaths in two XML strings are NOT equal- Parameters:
controlXpath- XPath for not-expected valuecontrol- document for not-expected valuetestXpath- XPath for actual valuetest- document for actual value- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathValuesNotEqual
public static void assertXpathValuesNotEqual(String controlXpath, String inControlXMLString, String testXpath, String inTestXMLString) throws SAXException, IOException, XpathException Assert that the evaluation of two Xpaths in two XML strings are NOT equal- Parameters:
controlXpath- XPath for not-expected valueinControlXMLString- document for not-expected valuetestXpath- XPath for actual valueinTestXMLString- document for actual value- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathValuesNotEqual
public static void assertXpathValuesNotEqual(String controlXpath, Document controlDocument, String testXpath, Document testDocument) throws XpathException Assert that the evaluation of two Xpaths in two documents are NOT equal- Parameters:
controlXpath- XPath for not-expected valuecontrolDocument- document for not-expected valuetestXpath- XPath for actual valuetestDocument- document for actual value- Throws:
XpathException- if XPath construction fails- See Also:
-
assertXpathEvaluatesTo
public static void assertXpathEvaluatesTo(String expectedValue, String xpathExpression, InputSource control) throws SAXException, IOException, XpathException Assert the value of an Xpath expression in an XML document.- Parameters:
expectedValue- the expected valuexpathExpression- XPath for actual valuecontrol- document to apply XPaths to- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathEvaluatesTo
public static void assertXpathEvaluatesTo(String expectedValue, String xpathExpression, String inXMLString) throws SAXException, IOException, XpathException Assert the value of an Xpath expression in an XML String- Parameters:
expectedValue- the expected valuexpathExpression- XPath for actual valueinXMLString- document to apply XPaths to- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathEvaluatesTo
public static void assertXpathEvaluatesTo(String expectedValue, String xpathExpression, Document inDocument) throws XpathException Assert the value of an Xpath expression in an DOM Document- Parameters:
expectedValue- the expected valuexpathExpression- XPath for actual valueinDocument- document to apply XPaths to- Throws:
XpathException- if XPath construction fails- See Also:
-
assertXpathEvaluatesTo
public static void assertXpathEvaluatesTo(QualifiedName expectedValue, String xpathExpression, InputSource control) throws SAXException, IOException, XpathException Assert the value of an Xpath expression in an XML document.- Parameters:
expectedValue- the expected valuexpathExpression- XPath for actual valuecontrol- document to apply XPaths to- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathEvaluatesTo
public static void assertXpathEvaluatesTo(QualifiedName expectedValue, String xpathExpression, String inXMLString) throws SAXException, IOException, XpathException Assert the value of an Xpath expression in an XML String- Parameters:
expectedValue- the expected valuexpathExpression- XPath for actual valueinXMLString- document to apply XPaths to- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathEvaluatesTo
public static void assertXpathEvaluatesTo(QualifiedName expectedValue, String xpathExpression, Document inDocument) throws XpathException Assert the value of an Xpath expression in an DOM Document- Parameters:
expectedValue- the expected valuexpathExpression- XPath for actual valueinDocument- document to apply XPaths to- Throws:
XpathException- if XPath construction fails- See Also:
-
assertXpathExists
public static void assertXpathExists(String xPathExpression, InputSource control) throws IOException, SAXException, XpathException Assert that a specific XPath exists in some given XML- Parameters:
xPathExpression- XPath for actual valuecontrol- document to apply XPaths to- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathExists
public static void assertXpathExists(String xPathExpression, String inXMLString) throws IOException, SAXException, XpathException Assert that a specific XPath exists in some given XML- Parameters:
xPathExpression- XPath for actual valueinXMLString- document to apply XPaths to- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathExists
public static void assertXpathExists(String xPathExpression, Document inDocument) throws XpathException Assert that a specific XPath exists in some given XML- Parameters:
xPathExpression- XPath for actual valueinDocument- document to apply XPaths to- Throws:
XpathException- if XPath construction fails- See Also:
-
assertXpathNotExists
public static void assertXpathNotExists(String xPathExpression, InputSource control) throws IOException, SAXException, XpathException Assert that a specific XPath does NOT exist in some given XML- Parameters:
xPathExpression- XPath for actual valuecontrol- document to apply XPaths to- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathNotExists
public static void assertXpathNotExists(String xPathExpression, String inXMLString) throws IOException, SAXException, XpathException Assert that a specific XPath does NOT exist in some given XML- Parameters:
xPathExpression- XPath for actual valueinXMLString- document to apply XPaths to- Throws:
XpathException- if XPath construction failsSAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertXpathNotExists
public static void assertXpathNotExists(String xPathExpression, Document inDocument) throws XpathException Assert that a specific XPath does NOT exist in some given XML- Parameters:
xPathExpression- XPath for actual valueinDocument- document to apply XPaths to- Throws:
XpathException- if XPath construction fails- See Also:
-
assertXMLValid
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:
SAXException- if the parser says soConfigurationException- if validation could not be turned on- See Also:
-
assertXMLValid
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:
SAXException- if the parser says soConfigurationException- if validation could not be turned on- See Also:
-
assertXMLValid
public static void assertXMLValid(InputSource xml, String systemId) throws 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 validatesystemId- used to obtain the DTD- Throws:
SAXException- if the parser says soConfigurationException- if validation could not be turned on- See Also:
-
assertXMLValid
public static void assertXMLValid(String xmlString, String systemId) throws 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 validatesystemId- used to obtain the DTD- Throws:
SAXException- if the parser says soConfigurationException- if validation could not be turned on- See Also:
-
assertXMLValid
public static void assertXMLValid(InputSource xml, String systemId, String doctype) throws 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 validatesystemId- used to obtain the DTDdoctype- DOCTYPE to use during validation- Throws:
SAXException- if the parser says soConfigurationException- if validation could not be turned on- See Also:
-
assertXMLValid
public static void assertXMLValid(String xmlString, String systemId, String doctype) throws 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 validatesystemId- used to obtain the DTDdoctype- DOCTYPE to use during validation- Throws:
SAXException- if the parser says soConfigurationException- if validation could not be turned on- See Also:
-
assertXMLValid
Assert that a Validator instance returnsisValid() == true- Parameters:
validator- validator to check
-
assertNodeTestPasses
public static void assertNodeTestPasses(InputSource xml, NodeTester tester, short nodeType) throws SAXException, IOException Execute aNodeTestfor a single node type and assert that it passes- Parameters:
xml- the document to validatetester- The test strategynodeType- The node type to be tested: constants defined inorg.w3c.dom.Nodee.g.Node.ELEMENT_NODE- Throws:
SAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertNodeTestPasses
public static void assertNodeTestPasses(String xmlString, NodeTester tester, short nodeType) throws SAXException, IOException Execute aNodeTestfor a single node type and assert that it passes- Parameters:
xmlString- XML to be testedtester- The test strategynodeType- The node type to be tested: constants defined inorg.w3c.dom.Nodee.g.Node.ELEMENT_NODE- Throws:
SAXException- if the parser says soIOException- on I/O errors- See Also:
-
assertNodeTestPasses
public static void assertNodeTestPasses(NodeTest test, NodeTester tester, short[] nodeTypes, boolean assertion) Execute aNodeTestfor 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 testedtester- The test strategynodeTypes- The node types to be tested: constants defined inorg.w3c.dom.Nodee.g.Node.ELEMENT_NODEassertion- true if the test is expected to pass, false otherwise- See Also:
-