|
ShrinkWrap Descriptors Test Utilities 2.0.0-alpha-3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.shrinkwrap.descriptor.test.util.XmlAssert
public final class XmlAssert
Simple helper for XML related Assertions.
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
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 namespace
Exception
- Assertion error or XML related parse exceptionspublic static void assertDefaultNamespace(String xml, String expectedURI)
xml
- to be verifiedexpectedNamespace
- expected value of xmlns attribute
Exception
- 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 attribute
Exception
- 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 expression
Exception
- Assertion error or XML/XPath related parse exceptionspublic static void assertPresenceUsingXPath(String xml, String expression, Object... expectedValue) throws Exception
Exception
public 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 match
|
ShrinkWrap Descriptors Test Utilities 2.0.0-alpha-3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |