@Test
void parse() {

    ContentType type = ContentType.parse("application/json; charset=utf-8");    // within cache
    assertThat(type.mediaType).isEqualTo("application/json");
    assertThat(type.charset()).get().isEqualTo(StandardCharsets.UTF_8);
    type = ContentType.parse("application/javascript; charset=utf-8");    // not in cache
    assertThat(type.mediaType).isEqualTo("application/javascript");
    assertThat(type.charset()).get().isEqualTo(StandardCharsets.UTF_8);
    type = ContentType.parse("application/vnd.maxmind.com-country+json; charset=UTF-8; version=2.1");
    assertThat(type.mediaType).isEqualTo("application/vnd.maxmind.com-country+json");
    assertThat(type.charset()).get().isEqualTo(StandardCharsets.UTF_8);
    type = ContentType.parse("image/png");
    assertThat(type.mediaType).isEqualTo("image/png");
    assertThat(type.charset()).isNotPresent();
    type = ContentType.parse("multipart/form-data; boundary=----WebKitFormBoundaryaANA7UQAvnwa2EkM");
    assertThat(type.mediaType).isEqualTo("multipart/form-data");
    assertThat(type.charset()).isNotPresent();
}