|
BrokenEvent nanotests | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.brokenevent.nanotests.XmlAssert
public final class XmlAssert
XML-related asserts helper.
These methods can be used directly:
XmlAssert.assertElementContent(...)
, however, they read better if they
are referenced through static import:
import static com.brokenevent.nanotests.XmlAssert.*; ... assertElementContent(...);
Constructor Summary | |
---|---|
protected |
XmlAssert()
Protect constructor since it is a static only class |
Method Summary | |
---|---|
static void |
assertElementContent(org.w3c.dom.Document doc,
java.lang.String path,
java.lang.String expected)
Asserts that the element text content is equal to the given value. |
static void |
assertElementName(org.w3c.dom.Document doc,
java.lang.String path,
java.lang.String expected)
Asserts that the element name is equal to the given value. |
static void |
assertElementsCount(org.w3c.dom.Document doc,
java.lang.String path,
int expectedCount)
Asserts that the count of the elements found by given XPath expression if equals to the given value. |
static org.w3c.dom.Document |
loadDocument(java.lang.String content)
Helper method to load the document from the string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected XmlAssert()
Method Detail |
---|
public static org.w3c.dom.Document loadDocument(java.lang.String content)
content
- text content of the document
Document
of the XML DOM modelpublic static void assertElementContent(org.w3c.dom.Document doc, java.lang.String path, java.lang.String expected)
AssertionError
is thrown.
doc
- Document
to check element frompath
- XPath expression to find required element in DOMexpected
- expected element's text contentpublic static void assertElementName(org.w3c.dom.Document doc, java.lang.String path, java.lang.String expected)
AssertionError
is thrown.
doc
- Document
to check element frompath
- XPath expression to find required element in DOMexpected
- expected element's namepublic static void assertElementsCount(org.w3c.dom.Document doc, java.lang.String path, int expectedCount)
AssertionError
is thrown.
doc
- Document
to check element frompath
- XPath expression to find required element list in DOMexpectedCount
- expected count of the elements
|
BrokenEvent nanotests | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |