HTTPClientImpl implements HTTPClient { @Nullable MediaType mediaType(ContentType contentType) { if (contentType == null) return null; if (contentType == ContentType.APPLICATION_JSON) return MEDIA_TYPE_APPLICATION_JSON; return MediaType.get(contentType.toString()); } HTTPClientImpl(OkHttpClient client, String userAgent, Duration slowOperationThreshold); @Override HTTPResponse execute(HTTPRequest request);  }
@Test void mediaType() { assertThat(httpClient.mediaType(null)).isNull(); assertThat(httpClient.mediaType(ContentType.APPLICATION_JSON)) .isSameAs(httpClient.mediaType(ContentType.APPLICATION_JSON)); assertThat(httpClient.mediaType(ContentType.APPLICATION_FORM_URLENCODED).toString()) .isEqualTo(ContentType.APPLICATION_FORM_URLENCODED.mediaType); }