DomMatchers

class DomMatchers


A collection of hamcrest matchers for objects in the org.w3c.dom package (such as and Element).

Summary

Public functions

java-static Matcher<Document!>!

Returns a matcher that matches Documents that have a body containing the given text.

java-static Matcher<Document!>!
elementById(id: String!, elementMatcher: Matcher<Element!>!)

Matches Documents that have an Element with the given id that matches the given element matcher.

java-static Matcher<Document!>!
elementByXPath(xpath: String!, elementMatcher: Matcher<Element!>!)

Matches a XPath and validates it against the first Element that it finds in the .

java-static Matcher<Document!>!

Returns a matcher that matches Documents that have at least one element with the given id.

java-static Matcher<Document!>!

Returns a matcher that matches Documents that have at least one element with the given xpath.

java-static Matcher<Document!>!
withBody(bodyMatcher: Matcher<Element!>!)

Returns a matcher that matches Documents with body that matches the given matcher.

java-static Matcher<Element!>!
withTextContent(textContent: String!)

Returns a matcher that matches Elements with the given textContent.

java-static Matcher<Element!>!
withTextContent(textContentMatcher: Matcher<String!>!)

Returns a matcher that matches Elements that have textContent matching the given matcher.

Public functions

containingTextInBody

java-static fun containingTextInBody(text: String!): Matcher<Document!>!

Returns a matcher that matches Documents that have a body containing the given text.

elementById

java-static fun elementById(id: String!, elementMatcher: Matcher<Element!>!): Matcher<Document!>!

Matches Documents that have an Element with the given id that matches the given element matcher.

elementByXPath

java-static fun elementByXPath(xpath: String!, elementMatcher: Matcher<Element!>!): Matcher<Document!>!

Matches a XPath and validates it against the first Element that it finds in the .

hasElementWithId

java-static fun hasElementWithId(id: String!): Matcher<Document!>!

Returns a matcher that matches Documents that have at least one element with the given id.

hasElementWithXpath

java-static fun hasElementWithXpath(xpath: String!): Matcher<Document!>!

Returns a matcher that matches Documents that have at least one element with the given xpath.

withBody

java-static fun withBody(bodyMatcher: Matcher<Element!>!): Matcher<Document!>!

Returns a matcher that matches Documents with body that matches the given matcher.

withTextContent

java-static fun withTextContent(textContent: String!): Matcher<Element!>!

Returns a matcher that matches Elements with the given textContent. Equivalent of withTextContent(is(textContent)).

withTextContent

java-static fun withTextContent(textContentMatcher: Matcher<String!>!): Matcher<Element!>!

Returns a matcher that matches Elements that have textContent matching the given matcher.