public class XpathResultMatchers
extends java.lang.Object
ResultMatcher
's using an XPath
expression. An instance of this class is typically accessed via
MockMvcResultMatchers.xpath(java.lang.String, java.lang.Object...)
.Modifier and Type | Field and Description |
---|---|
private XpathExpectationsHelper |
xpathHelper |
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(
Evaluate the XPath and assert the
Node content found with the
given Hamcrest Matcher . |
ResultMatcher |
nodeCount(
Evaluate the XPath and assert the number of nodes found with the given
Hamcrest
Matcher . |
ResultMatcher |
number(
Evaluate the XPath and assert the
Double value found with the
given Hamcrest Matcher . |
ResultMatcher |
string(
Apply the XPath and assert the
String value found with the given
Hamcrest Matcher . |
private final XpathExpectationsHelper xpathHelper
protected XpathResultMatchers(java.lang.String expression, 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)
Node
content found with the
given Hamcrest Matcher
.public ResultMatcher exists()
public ResultMatcher doesNotExist()
public ResultMatcher nodeCount(matcher)
Matcher
.public ResultMatcher string(matcher)
String
value found with the given
Hamcrest Matcher
.public ResultMatcher number(matcher)
Double
value found with the
given Hamcrest Matcher
.public ResultMatcher booleanValue(java.lang.Boolean value)
Boolean
value found.