ResponseImpl implements Response { @Override public Optional<ContentType> contentType() { return Optional.ofNullable(contentType); } 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 contentType() { ResponseImpl response = new ResponseImpl(null); response.contentType(ContentType.APPLICATION_JSON); assertThat(response.headers).containsEntry(Headers.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); }