public class XpathRequestMatchers extends Object
RequestMatcher
's using an XPath
expression. An instance of this class is typically accessed via
RequestMatchers.xpath(..)
.Modifier | Constructor and Description |
---|---|
protected |
XpathRequestMatchers(String expression,
Map<String,String> namespaces,
Object... args)
Class constructor, not for direct instantiation.
|
Modifier and Type | Method and Description |
---|---|
<T> RequestMatcher |
booleanValue(Boolean value)
Apply the XPath and assert the boolean value found.
|
<T> RequestMatcher |
doesNotExist()
Assert that content does not exist at the given XPath.
|
<T> RequestMatcher |
exists()
Assert that content exists at the given XPath.
|
<T> RequestMatcher |
node(Matcher<? super Node> matcher)
Apply the XPath and assert it with the given
Matcher<Node> . |
<T> RequestMatcher |
nodeCount(int expectedCount)
Apply the XPath and assert the number of nodes found.
|
<T> RequestMatcher |
nodeCount(Matcher<Integer> matcher)
Apply the XPath and assert the number of nodes found with the given
Matcher<Integer> . |
RequestMatcher |
number(Double value)
Apply the XPath and assert the number of nodes found.
|
<T> RequestMatcher |
number(Matcher<? super Double> matcher)
Apply the XPath and assert the number found with the given matcher.
|
<T> RequestMatcher |
string(Matcher<? super String> matcher)
Apply the XPath and assert the String content found with the given matcher.
|
RequestMatcher |
string(String value)
Apply the XPath and assert the String content found.
|
protected XpathRequestMatchers(String expression, @Nullable Map<String,String> namespaces, Object... args) throws XPathExpressionException
MockRestRequestMatchers.xpath(String, Object...)
or
MockRestRequestMatchers.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
- if expression compilation failedpublic <T> RequestMatcher node(Matcher<? super Node> matcher)
Matcher<Node>
.public <T> RequestMatcher exists()
public <T> RequestMatcher doesNotExist()
public <T> RequestMatcher nodeCount(Matcher<Integer> matcher)
Matcher<Integer>
.public <T> RequestMatcher nodeCount(int expectedCount)
public <T> RequestMatcher string(Matcher<? super String> matcher)
public RequestMatcher string(String value)
public <T> RequestMatcher number(Matcher<? super Double> matcher)
public RequestMatcher number(Double value)
public <T> RequestMatcher booleanValue(Boolean value)