public abstract class MockMvcResultMatchers
extends java.lang.Object
ResultMatcher
-based result actions.
Eclipse users: consider adding this class as a Java editor favorite. To navigate, open the Preferences and type "favorites".
Modifier and Type | Field and Description |
---|---|
private static AntPathMatcher |
pathMatcher |
Constructor and Description |
---|
MockMvcResultMatchers() |
Modifier and Type | Method and Description |
---|---|
static ContentResultMatchers |
content()
Access to response body assertions.
|
static CookieResultMatchers |
cookie()
Access to response cookie assertions.
|
static FlashAttributeResultMatchers |
flash()
Access to flash attribute assertions.
|
static ResultMatcher |
forwardedUrl(java.lang.String expectedUrl)
Asserts the request was forwarded to the given URL.
|
static ResultMatcher |
forwardedUrlPattern(java.lang.String urlPattern)
Asserts the request was forwarded to the given URL.
|
static HandlerResultMatchers |
handler()
Access to assertions for the handler that handled the request.
|
static HeaderResultMatchers |
header()
Access to response header assertions.
|
static <T> ResultMatcher |
jsonPath(java.lang.String expression,
<any> matcher)
Access to response body assertions 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 JsonPathResultMatchers |
jsonPath(java.lang.String expression,
java.lang.Object... args)
Access to response body assertions using a JSONPath expression to
inspect a specific subset of the body.
|
static ModelResultMatchers |
model()
Access to model-related assertions.
|
static ResultMatcher |
redirectedUrl(java.lang.String expectedUrl)
Asserts the request was redirected to the given URL.
|
static ResultMatcher |
redirectedUrlPattern(java.lang.String expectedUrl)
Asserts the request was redirected to the given URL.
|
static RequestResultMatchers |
request()
Access to request-related assertions.
|
static StatusResultMatchers |
status()
Access to response status assertions.
|
static ViewResultMatchers |
view()
Access to assertions on the selected view.
|
static XpathResultMatchers |
xpath(java.lang.String expression,
java.util.Map<java.lang.String,java.lang.String> namespaces,
java.lang.Object... args)
Access to response body assertions using an XPath to inspect a specific
subset of the body.
|
static XpathResultMatchers |
xpath(java.lang.String expression,
java.lang.Object... args)
Access to response body assertions using an XPath to inspect a specific
subset of the body.
|
private static final AntPathMatcher pathMatcher
public static RequestResultMatchers request()
public static HandlerResultMatchers handler()
public static ModelResultMatchers model()
public static ViewResultMatchers view()
public static FlashAttributeResultMatchers flash()
public static ResultMatcher forwardedUrl(java.lang.String expectedUrl)
expectedUrl
- the exact URL expectedpublic static ResultMatcher forwardedUrlPattern(java.lang.String urlPattern)
AntPathMatcher
expressions.urlPattern
- an AntPath expression to match againstAntPathMatcher
public static ResultMatcher redirectedUrl(java.lang.String expectedUrl)
expectedUrl
- the exact URL expectedpublic static ResultMatcher redirectedUrlPattern(java.lang.String expectedUrl)
AntPathMatcher
expressions.expectedUrl
- an AntPath expression to match againstAntPathMatcher
public static StatusResultMatchers status()
public static HeaderResultMatchers header()
public static ContentResultMatchers content()
public static JsonPathResultMatchers 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> ResultMatcher jsonPath(java.lang.String expression, <any> matcher)
expression
- the JSON path expressionmatcher
- a matcher for the value expected at the JSON pathpublic static XpathResultMatchers 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 XpathResultMatchers 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
public static CookieResultMatchers cookie()