Class ExchangeResult

java.lang.Object
org.springframework.test.web.servlet.client.ExchangeResult
Direct Known Subclasses:
EntityExchangeResult

public class ExchangeResult extends Object
Container for request and response details for exchanges performed through RestTestClient.
Since:
7.0
Author:
Rob Worsnop, Rossen Stoyanchev
  • Method Details

    • getMethod

      public HttpMethod getMethod()
      Return the method of the request.
    • getUrl

      public URI getUrl()
      Return the URI of the request.
    • getUriTemplate

      public @Nullable String getUriTemplate()
      Return the original URI template used to prepare the request, if any.
    • getRequestHeaders

      public HttpHeaders getRequestHeaders()
      Return the request headers sent to the server.
    • getStatus

      public HttpStatusCode getStatus()
      Return the HTTP status code as an HttpStatusCode value.
    • getResponseHeaders

      public HttpHeaders getResponseHeaders()
      Return the response headers received from the server.
    • getResponseCookies

      public MultiValueMap<String, ResponseCookie> getResponseCookies()
      Return response cookies received from the server.
    • assertWithDiagnostics

      public void assertWithDiagnostics(Runnable assertion)
      Execute the given Runnable, catch any AssertionError, log details about the request and response at ERROR level under the class log category, and after that re-throw the error.
    • toString

      public String toString()
      Overrides:
      toString in class Object