Class FlashResponse

java.lang.Object
dev.relism.flash.testing.FlashResponse

public final class FlashResponse extends Object
A response from a FlashTest server, with chainable assertions.

 app.get("/api/users")
    .expectStatus(200)
    .expectHeader("content-type", "application/json")
    .expectBodyContains("alice");
 
Every failure message carries the request line, the status and the body, so a red test says what actually came back rather than only what did not match. Use status(), body() and headers() for anything the assertions do not cover.
  • Method Details

    • status

      public int status()
      Response status code.
    • body

      public String body()
      Response body decoded as a string.
    • headers

      public HttpHeaders headers()
      All response headers.
    • header

      public String header(String name)
      First value of name (case-insensitive), or null if absent.
    • expectStatus

      public FlashResponse expectStatus(int expected)
      Asserts the status code.
    • expectHeader

      public FlashResponse expectHeader(String name, String expected)
      Asserts the first value of a header (name case-insensitive).
    • expectBody

      public FlashResponse expectBody(String expected)
      Asserts the body matches exactly.
    • expectBodyContains

      public FlashResponse expectBodyContains(String fragment)
      Asserts the body contains fragment.