public class XpathRequestMatchers extends Object
RequestMatcher
implementations
that use an XPath expression.
An instance of this class is typically accessed via
MockRestRequestMatchers.xpath(String, Object...)
or
MockRestRequestMatchers.xpath(String, Map, Object...)
.
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 |
---|---|
RequestMatcher |
booleanValue(Boolean value)
Apply the XPath and assert the boolean value found.
|
RequestMatcher |
doesNotExist()
Assert that content does not exist at the given XPath.
|
RequestMatcher |
exists()
Assert that content exists at the given XPath.
|
RequestMatcher |
node(Matcher<? super Node> matcher)
Apply the XPath and assert it with the given
Matcher<Node> . |
RequestMatcher |
nodeCount(int expectedCount)
Apply the XPath and assert the number of nodes found.
|
RequestMatcher |
nodeCount(Matcher<? super 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 value found.
|
RequestMatcher |
number(Matcher<? super Double> matcher)
Apply the XPath and assert the number found with the given matcher.
|
RequestMatcher |
string(Matcher<? super String> matcher)
Apply the XPath and assert the String content found with the given matcher.
|
RequestMatcher |
string(String content)
Apply the XPath and assert the String content found.
|
protected XpathRequestMatchers(String expression, @Nullable Map<String,String> namespaces, Object... args) throws XPathExpressionException
Use MockRestRequestMatchers.xpath(String, Object...)
or
MockRestRequestMatchers.xpath(String, Map, Object...)
.
expression
- the XPath expressionnamespaces
- the 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 RequestMatcher node(Matcher<? super Node> matcher)
Matcher<Node>
.public RequestMatcher exists()
public RequestMatcher doesNotExist()
public RequestMatcher nodeCount(Matcher<? super Integer> matcher)
Matcher<Integer>
.public RequestMatcher nodeCount(int expectedCount)
public RequestMatcher string(Matcher<? super String> matcher)
public RequestMatcher string(String content)
public RequestMatcher number(Matcher<? super Double> matcher)
public RequestMatcher number(Double value)
public RequestMatcher booleanValue(Boolean value)