
public final class XmlAssert extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
assertAbsenceUsingXPath(String xml,
String expression)
Verifies if XML file does not contain elements matching given XPath expression.
|
static void |
assertDefaultNamespace(String xml,
String expectedURI)
Verifies if default namespace (xmlns attribute of the root element) has expected URI.
|
static void |
assertIdentical(String expected,
String actual)
Asserts equality of two XML files comparing flatten versions - stripped from leading and trailing whitespaces and
those between xml nodes.
|
static void |
assertNamespaceURIDefined(String xml,
String namespace,
String expectedURI)
Verifies if given namespace has URI defined.
|
static void |
assertPresenceUsingXPath(String xml,
String expression,
Object... expectedValue) |
static void |
assertPresenceUsingXPath(String xml,
String expression,
String... expectedValues)
Assert that the specified XPath Expression resolves to the specified values.
|
static void |
assertSchemaLocation(String xml,
String namespaceUri,
String expectedLocation)
Verifies if given namespace has proper URI defined using ns:schemaLocation attribute.
|
static void |
assertSimilar(String firstXml,
String secondXml)
Asserts similarity of two XML files comparing flatten versions - stripped from leading and trailing whitespaces
and those between xml nodes.
|
public static void assertSchemaLocation(String xml, String namespaceUri, String expectedLocation)
xml - The XML to assert againstnamespaceUri - The namespace URI to assert againstexpectedLocation - The expected location for given namespaceException - Assertion error or XML related parse exceptionspublic static void assertDefaultNamespace(String xml, String expectedURI)
xml - to be verifiedexpectedURI - expected value of xmlns attributeException - Assertion error or XML related parse exceptions.public static void assertNamespaceURIDefined(String xml, String namespace, String expectedURI)
xml - to be verifiednamespace - expectedURI - expected value of xmlns attributeException - Assertion error or XML related parse exceptions.public static void assertPresenceUsingXPath(String xml, String expression, String... expectedValues)
xml - The XML to assert againstexpression - XPath expression to extractexpectedValues - The Expected values found by expressionException - Assertion error or XML/XPath related parse exceptionspublic static void assertPresenceUsingXPath(String xml, String expression, Object... expectedValue) throws Exception
Exceptionpublic static void assertAbsenceUsingXPath(String xml, String expression)
xml - The XML file to verify.expression - The XPath expression to evaluate.Exception - Assertion error or XML/XPath related parse exceptionspublic static void assertIdentical(String expected, String actual)
expected - actual - Exception - Assertion error when given string don't matchpublic static void assertSimilar(String firstXml, String secondXml)
firstXml - secondXml - Exception - Assertion error when given string don't matchCopyright © 2025 JBoss by Red Hat. All rights reserved.