public class XpathResultMatchers extends Object
An instance of this class is typically accessed via
MockMvcResultMatchers.xpath(java.lang.String, java.lang.Object...)
.
Modifier | Constructor and Description |
---|---|
protected |
XpathResultMatchers(String expression,
Map<String,String> namespaces,
Object... args)
Protected constructor, not for direct instantiation.
|
Modifier and Type | Method and Description |
---|---|
ResultMatcher |
booleanValue(Boolean value)
Evaluate the XPath and assert the
Boolean value found. |
ResultMatcher |
doesNotExist()
Evaluate the XPath and assert that content doesn't exist.
|
ResultMatcher |
exists()
Evaluate the XPath and assert that content exists.
|
ResultMatcher |
node(Matcher<? super Node> matcher)
|
ResultMatcher |
nodeCount(int expectedCount)
Evaluate the XPath and assert the number of nodes found.
|
ResultMatcher |
nodeCount(Matcher<Integer> matcher)
Evaluate the XPath and assert the number of nodes found with the given
Hamcrest
Matcher . |
ResultMatcher |
number(Double expectedValue)
Evaluate the XPath and assert the
Double value found. |
ResultMatcher |
number(Matcher<? super Double> matcher)
|
ResultMatcher |
string(Matcher<? super String> matcher)
|
ResultMatcher |
string(String expectedValue)
Apply the XPath and assert the
String value found. |
protected XpathResultMatchers(String expression, Map<String,String> namespaces, Object... args) throws XPathExpressionException
MockMvcResultMatchers.xpath(String, Object...)
or
MockMvcResultMatchers.xpath(String, Map, Object...)
.expression
- the XPath expressionnamespaces
- XML namespaces referenced in the XPath expression, or null
args
- arguments to parameterize the XPath expression with using the
formatting specifiers defined in String.format(String, Object...)
XPathExpressionException
public ResultMatcher node(Matcher<? super Node> matcher)
public ResultMatcher exists()
public ResultMatcher doesNotExist()
public ResultMatcher nodeCount(Matcher<Integer> matcher)
Matcher
.public ResultMatcher nodeCount(int expectedCount)
public ResultMatcher string(Matcher<? super String> matcher)
public ResultMatcher string(String expectedValue)
String
value found.public ResultMatcher number(Matcher<? super Double> matcher)
public ResultMatcher number(Double expectedValue)
Double
value found.public ResultMatcher booleanValue(Boolean value)
Boolean
value found.