public class XpathResultMatchers
extends java.lang.Object
An instance of this class is typically accessed via
MockMvcResultMatchers.xpath(java.lang.String, java.lang.Object...)
.
Modifier | Constructor and Description |
---|---|
protected |
XpathResultMatchers(java.lang.String expression,
java.util.Map<java.lang.String,java.lang.String> namespaces,
java.lang.Object... args)
Protected constructor, not for direct instantiation.
|
Modifier and Type | Method and Description |
---|---|
ResultMatcher |
booleanValue(java.lang.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 org.w3c.dom.Node> matcher)
Evaluate the XPath and assert the
Node content found with the
given Hamcrest Matcher . |
ResultMatcher |
nodeCount(int expectedCount)
Evaluate the XPath and assert the number of nodes found.
|
ResultMatcher |
nodeCount(Matcher<java.lang.Integer> matcher)
Evaluate the XPath and assert the number of nodes found with the given
Hamcrest
Matcher . |
ResultMatcher |
number(java.lang.Double expectedValue)
Evaluate the XPath and assert the
Double value found. |
ResultMatcher |
number(Matcher<? super java.lang.Double> matcher)
Evaluate the XPath and assert the
Double value found with the
given Hamcrest Matcher . |
ResultMatcher |
string(Matcher<? super java.lang.String> matcher)
Apply the XPath and assert the
String value found with the given
Hamcrest Matcher . |
ResultMatcher |
string(java.lang.String expectedValue)
Apply the XPath and assert the
String value found. |
protected XpathResultMatchers(java.lang.String expression, @Nullable java.util.Map<java.lang.String,java.lang.String> namespaces, java.lang.Object... args) throws javax.xml.xpath.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...)
javax.xml.xpath.XPathExpressionException
public ResultMatcher node(Matcher<? super org.w3c.dom.Node> matcher)
Node
content found with the
given Hamcrest Matcher
.public ResultMatcher exists()
public ResultMatcher doesNotExist()
public ResultMatcher nodeCount(Matcher<java.lang.Integer> matcher)
Matcher
.public ResultMatcher nodeCount(int expectedCount)
public ResultMatcher string(Matcher<? super java.lang.String> matcher)
String
value found with the given
Hamcrest Matcher
.public ResultMatcher string(java.lang.String expectedValue)
String
value found.public ResultMatcher number(Matcher<? super java.lang.Double> matcher)
Double
value found with the
given Hamcrest Matcher
.public ResultMatcher number(java.lang.Double expectedValue)
Double
value found.public ResultMatcher booleanValue(java.lang.Boolean value)
Boolean
value found.