public abstract class MockRestRequestMatchers extends Object
RequestMatcher
classes. Typically used to
provide input for MockRestServiceServer.expect(RequestMatcher)
.
Consider adding this class as a Java editor favorite. To navigate to this setting, open the Preferences and type "favorites".
Constructor and Description |
---|
MockRestRequestMatchers() |
Modifier and Type | Method and Description |
---|---|
static RequestMatcher |
anything()
Match to any request.
|
static ContentRequestMatchers |
content()
Access to request body matchers.
|
static RequestMatcher |
header(String name,
org.hamcrest.Matcher<? super String>... matchers)
Assert request header values with the given Hamcrest matcher.
|
static RequestMatcher |
header(String name,
String... expectedValues)
Assert request header values.
|
static <T> RequestMatcher |
jsonPath(String expression,
org.hamcrest.Matcher<T> matcher)
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(String expression,
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 |
queryParam(String name,
org.hamcrest.Matcher<? super String>... matchers)
Assert request query parameter values with the given Hamcrest matcher.
|
static RequestMatcher |
queryParam(String name,
String... expectedValues)
Assert request query parameter values.
|
static RequestMatcher |
requestTo(org.hamcrest.Matcher<String> matcher)
Assert the request URI string with the given matcher.
|
static RequestMatcher |
requestTo(String expectedUri)
Assert the request URI string.
|
static RequestMatcher |
requestTo(URI uri)
Expect a request to the given URI.
|
static XpathRequestMatchers |
xpath(String expression,
Map<String,String> namespaces,
Object... args)
Access to response body matchers using an XPath to inspect a specific
subset of the body.
|
static XpathRequestMatchers |
xpath(String expression,
Object... args)
Access to request body matchers using an XPath to inspect a specific
subset of the body.
|
public static RequestMatcher anything()
public static RequestMatcher method(HttpMethod method)
HttpMethod
of the request.method
- the HTTP methodpublic static RequestMatcher requestTo(org.hamcrest.Matcher<String> matcher)
matcher
- String matcher for the expected URIpublic static RequestMatcher requestTo(String expectedUri)
expectedUri
- the expected URIpublic static RequestMatcher requestTo(URI uri)
uri
- the expected URI@SafeVarargs public static RequestMatcher queryParam(String name, org.hamcrest.Matcher<? super String>... matchers)
public static RequestMatcher queryParam(String name, String... expectedValues)
@SafeVarargs public static RequestMatcher header(String name, org.hamcrest.Matcher<? super String>... matchers)
public static RequestMatcher header(String name, String... expectedValues)
public static ContentRequestMatchers content()
public static JsonPathRequestMatchers jsonPath(String expression, 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(String expression, org.hamcrest.Matcher<T> matcher)
expression
- the JSON path expressionmatcher
- a matcher for the value expected at the JSON pathpublic static XpathRequestMatchers xpath(String expression, Object... args) throws XPathExpressionException
String.format(String, Object...)
.expression
- the XPath optionally parameterized with argumentsargs
- arguments to parameterize the XPath expression withXPathExpressionException
public static XpathRequestMatchers xpath(String expression, Map<String,String> namespaces, Object... args) throws XPathExpressionException
String.format(String, Object...)
.expression
- the XPath optionally parameterized with argumentsnamespaces
- namespaces referenced in the XPath expressionargs
- arguments to parameterize the XPath expression withXPathExpressionException