Interface MvcTestResult
- All Superinterfaces:
org.assertj.core.api.AssertProvider<MvcTestResultAssert>
Provides the result of an executed request using
MockMvcTester
that
is meant to be used with assertThat
.
Can be in one of two distinct states:
- The request processed successfully, even if it failed with an exception
that has been resolved. The result is available,
and
getUnresolvedException()
will returnnull
. - The request failed unexpectedly.
getUnresolvedException()
provides more information about the error, and any attempt to access the result will fail with an exception.
If the request was asynchronous, it is fully resolved at this point and regular assertions can be applied without having to wait for the completion of the response.
- Since:
- 6.2
- Author:
- Stephane Nicoll, Brian Clozel
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturn the result of the processing.default MockHttpServletRequest
Return the performed request.default MockHttpServletResponse
Return the resulting response.Return the exception that was thrown unexpectedly while processing the request, if any.Methods inherited from interface org.assertj.core.api.AssertProvider
assertThat
-
Method Details
-
getMvcResult
MvcResult getMvcResult()Return the result of the processing. If the processing has failed with an unresolved exception, the result is not available, seegetUnresolvedException()
.- Returns:
- the
MvcResult
- Throws:
IllegalStateException
- if the processing has failed with an unresolved exception
-
getRequest
Return the performed request. -
getResponse
Return the resulting response. -
getUnresolvedException
Return the exception that was thrown unexpectedly while processing the request, if any.
-