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