ResponseImpl implements Response { @Override public Optional<String> header(String name) { return Optional.ofNullable(headers.get(new HttpString(name))); } 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 useHeaderToUpdateContentType() { ResponseImpl response = new ResponseImpl(null); assertThatThrownBy(() -> response.header("Content-Type", "application/json")) .hasMessageContaining("must not use header()"); }