Package dev.relism.flash.testing
Class FlashResponse
java.lang.Object
dev.relism.flash.testing.FlashResponse
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 Summary
Modifier and TypeMethodDescriptionbody()Response body decoded as a string.expectBody(String expected) Asserts the body matches exactly.expectBodyContains(String fragment) Asserts the body containsfragment.expectHeader(String name, String expected) Asserts the first value of a header (name case-insensitive).expectStatus(int expected) Asserts the status code.First value ofname(case-insensitive), ornullif absent.headers()All response headers.intstatus()Response status code.
-
Method Details
-
status
public int status()Response status code. -
body
Response body decoded as a string. -
headers
All response headers. -
header
First value ofname(case-insensitive), ornullif absent. -
expectStatus
Asserts the status code. -
expectHeader
Asserts the first value of a header (name case-insensitive). -
expectBody
Asserts the body matches exactly. -
expectBodyContains
Asserts the body containsfragment.
-