public abstract class MockRestRequestMatchers
extends java.lang.Object
RequestMatcher
classes. Typically used to
provide input for MockRestServiceServer.expect(RequestMatcher)
.
Eclipse users: consider adding this class as a Java editor favorite. To navigate, open the Preferences and type "favorites".
Modifier | Constructor and Description |
---|---|
private |
MockRestRequestMatchers()
Private class constructor.
|
Modifier and Type | Method and Description |
---|---|
static RequestMatcher |
anything()
Match to any request.
|
private static void |
assertHeaderValueCount(java.lang.String name,
HttpHeaders headers,
int expectedCount) |
static ContentRequestMatchers |
content()
Access to request body matchers.
|
static RequestMatcher |
header(java.lang.String name,
Assert request header values with the given Hamcrest matcher.
|
static <T> RequestMatcher |
jsonPath(java.lang.String expression,
Access to request body matchers using a JSONPath expression to
inspect a specific subset of the body and a Hamcrest match for asserting
the value found at the JSON path.
|
static JsonPathRequestMatchers |
jsonPath(java.lang.String expression,
java.lang.Object... args)
Access to request body matchers using a JSONPath expression to
inspect a specific subset of the body.
|
static RequestMatcher |
method(HttpMethod method)
Assert the
HttpMethod of the request. |
static RequestMatcher |
requestTo(
Assert the request URI string with the given matcher.
|
static XpathRequestMatchers |
xpath(java.lang.String expression,
java.util.Map<java.lang.String,java.lang.String> namespaces,
java.lang.Object... args)
Access to response body matchers using an XPath to inspect a specific
subset of the body.
|
static XpathRequestMatchers |
xpath(java.lang.String expression,
java.lang.Object... args)
Access to request body matchers using an XPath to inspect a specific
subset of the body.
|
private MockRestRequestMatchers()
public static RequestMatcher anything()
public static RequestMatcher requestTo(matcher)
matcher
- String matcher for the expected URIpublic static RequestMatcher method(HttpMethod method)
HttpMethod
of the request.method
- the HTTP methodpublic static RequestMatcher header(java.lang.String name,... matchers)
private static void assertHeaderValueCount(java.lang.String name, HttpHeaders headers, int expectedCount)
public static ContentRequestMatchers content()
public static JsonPathRequestMatchers jsonPath(java.lang.String expression, java.lang.Object... args)
String.format(String, Object...)
.expression
- the JSON path optionally parameterized with argumentsargs
- arguments to parameterize the JSON path expression withpublic static <T> RequestMatcher jsonPath(java.lang.String expression,matcher)
expression
- the JSON path expressionmatcher
- a matcher for the value expected at the JSON pathpublic static XpathRequestMatchers xpath(java.lang.String expression, java.lang.Object... args) throws javax.xml.xpath.XPathExpressionException
String.format(String, Object...)
.expression
- the XPath optionally parameterized with argumentsargs
- arguments to parameterize the XPath expression withjavax.xml.xpath.XPathExpressionException
public static XpathRequestMatchers xpath(java.lang.String expression, java.util.Map<java.lang.String,java.lang.String> namespaces, java.lang.Object... args) throws javax.xml.xpath.XPathExpressionException
String.format(String, Object...)
.expression
- the XPath optionally parameterized with argumentsnamespaces
- namespaces referenced in the XPath expressionargs
- arguments to parameterize the XPath expression withjavax.xml.xpath.XPathExpressionException