RemoteResponse implements org.zalando.logbook.HttpResponse { @Override public Charset getCharset() { return Optional.of(response) .map(response -> response.getFirstHeader("Content-Type")) .map(Header::getValue) .map(ContentType::parse) .map(ContentType::getCharset) .orElse(UTF_8); }  @Override Origin getOrigin(); @Override String getProtocolVersion(); @Override int getStatus(); @Override HttpHeaders getHeaders(); @Override String getContentType(); @Override Charset getCharset(); @Override org.zalando.logbook.HttpResponse withBody(); @Override RemoteResponse withoutBody(); @Override byte[] getBody();  }
@Test void shouldReturnContentTypesCharsetIfGiven() { delegate.addHeader("Content-Type", "text/plain;charset=ISO-8859-1"); assertThat(unit.getCharset(), is(ISO_8859_1)); }
@Test void shouldReturnDefaultCharsetIfNoneGiven() { assertThat(unit.getCharset(), is(UTF_8)); }