ResponseImpl implements Response { @Override public HTTPStatus status() { return status; } ResponseImpl(Body body); @Override HTTPStatus status(); @Override Response status(HTTPStatus status); @Override Optional<String> header(String name); @Override Response header(String name, String value); @Override Optional<ContentType> contentType(); @Override Response contentType(ContentType contentType); @Override Response cookie(CookieSpec spec, String value); final Body body; }
@Test void redirect() { assertThatThrownBy(() -> Response.redirect(null, HTTPStatus.OK)) .isInstanceOf(Error.class) .hasMessageContaining("invalid redirect status"); assertThat(Response.redirect("/path").status()).isEqualTo(HTTPStatus.SEE_OTHER); }