Class RequestResultMatchers
java.lang.Object
org.springframework.test.web.servlet.result.RequestResultMatchers
Factory for assertions on the request.
An instance of this class is typically accessed via
MockMvcResultMatchers.request()
.
- Since:
- 3.2
- Author:
- Rossen Stoyanchev, Sam Brannen
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAssert that asynchronous processing was not started.asyncResult
(Object expectedResult) Assert the result from asynchronous processing.<T> ResultMatcher
asyncResult
(Matcher<? super T> matcher) Assert the result from asynchronous processing with the given matcher.Assert whether asynchronous processing started, usually as a result of a controller method returningCallable
orDeferredResult
.Assert a request attribute value.<T> ResultMatcher
Assert a request attribute value with the given HamcrestMatcher
.sessionAttribute
(String name, Object value) Assert a session attribute value.<T> ResultMatcher
sessionAttribute
(String name, Matcher<? super T> matcher) Assert a session attribute value with the given HamcrestMatcher
.sessionAttributeDoesNotExist
(String... names) Assert the given session attributes do not exist.
-
Constructor Details
-
RequestResultMatchers
protected RequestResultMatchers()Protected constructor.
-
-
Method Details
-
asyncStarted
Assert whether asynchronous processing started, usually as a result of a controller method returningCallable
orDeferredResult
.The test will await the completion of a
Callable
so thatasyncResult(Matcher)
orasyncResult(Object)
can be used to assert the resulting value.Neither a
Callable
nor aDeferredResult
will complete processing all the way since aMockHttpServletRequest
does not perform asynchronous dispatches.- See Also:
-
asyncNotStarted
Assert that asynchronous processing was not started.- See Also:
-
asyncResult
Assert the result from asynchronous processing with the given matcher.This method can be used when a controller method returns
Callable
orWebAsyncTask
. -
asyncResult
Assert the result from asynchronous processing.This method can be used when a controller method returns
Callable
orWebAsyncTask
. The value matched is the value returned from theCallable
or the exception raised. -
attribute
Assert a request attribute value with the given HamcrestMatcher
. -
attribute
Assert a request attribute value. -
sessionAttribute
Assert a session attribute value with the given HamcrestMatcher
. -
sessionAttribute
Assert a session attribute value. -
sessionAttributeDoesNotExist
Assert the given session attributes do not exist.- Since:
- 5.2.1
-