Interface MvcTestResult

All Superinterfaces:
org.assertj.core.api.AssertProvider<MvcTestResultAssert>

public interface MvcTestResult extends 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:

  1. The request processed successfully, even if it failed with an exception that has been resolved. The result is available, and getUnresolvedException() will return null.
  2. The request failed unexpectedly. getUnresolvedException() provides more information about the error, and any attempt to access the result will fail with an exception.
Since:
6.2
Author:
Stephane Nicoll, Brian Clozel
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the result of the processing.
    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, see getUnresolvedException().
      Returns:
      the MvcResult
      Throws:
      IllegalStateException - if the processing has failed with an unresolved exception
    • getUnresolvedException

      @Nullable Exception getUnresolvedException()
      Return the exception that was thrown unexpectedly while processing the request, if any.