public class RequestResultMatchers extends Object
An instance of this class is typically accessed via
MockMvcResultMatchers.request()
.
Modifier | Constructor and Description |
---|---|
protected |
RequestResultMatchers()
Protected constructor.
|
Modifier and Type | Method and Description |
---|---|
ResultMatcher |
asyncNotStarted()
Assert that asynchronous processing was not started.
|
<T> ResultMatcher |
asyncResult(Matcher<? super T> matcher)
Assert the result from asynchronous processing with the given matcher.
|
ResultMatcher |
asyncResult(Object expectedResult)
Assert the result from asynchronous processing.
|
ResultMatcher |
asyncStarted()
Assert whether asynchronous processing started, usually as a result of a
controller method returning
Callable or DeferredResult . |
<T> ResultMatcher |
attribute(String name,
Matcher<? super T> matcher)
Assert a request attribute value with the given Hamcrest
Matcher . |
ResultMatcher |
attribute(String name,
Object expectedValue)
Assert a request attribute value.
|
<T> ResultMatcher |
sessionAttribute(String name,
Matcher<? super T> matcher)
Assert a session attribute value with the given Hamcrest
Matcher . |
ResultMatcher |
sessionAttribute(String name,
Object value)
Assert a session attribute value.
|
ResultMatcher |
sessionAttributeDoesNotExist(String... names)
Assert the given session attributes do not exist.
|
public ResultMatcher asyncStarted()
Callable
or DeferredResult
.
The test will await the completion of a Callable
so that
asyncResult(Matcher)
or asyncResult(Object)
can be used
to assert the resulting value.
Neither a Callable
nor a DeferredResult
will complete
processing all the way since a MockHttpServletRequest
does not
perform asynchronous dispatches.
asyncNotStarted()
public ResultMatcher asyncNotStarted()
asyncStarted()
public <T> ResultMatcher asyncResult(Matcher<? super T> matcher)
This method can be used when a controller method returns Callable
or WebAsyncTask
.
public ResultMatcher asyncResult(@Nullable Object expectedResult)
This method can be used when a controller method returns Callable
or WebAsyncTask
. The value matched is the value returned from the
Callable
or the exception raised.
public <T> ResultMatcher attribute(String name, Matcher<? super T> matcher)
Matcher
.public ResultMatcher attribute(String name, @Nullable Object expectedValue)
public <T> ResultMatcher sessionAttribute(String name, Matcher<? super T> matcher)
Matcher
.public ResultMatcher sessionAttribute(String name, @Nullable Object value)
public ResultMatcher sessionAttributeDoesNotExist(String... names)