ContentType { @Override public String toString() { StringBuilder builder = new StringBuilder().append(type).append('/').append(subType); for (Entry<String, String> parameter : parameters.entrySet()) { builder.append("; ").append(parameter.getKey()).append('=').append(parameter.getValue()); } return builder.toString(); } ContentType(
            String type,
            String subType,
            Map<String, String> parameters); static ContentType valueOf(String value); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); String getType(); boolean isWildcardType(); String getSubType(); boolean isWildcardSubType(); boolean isWildcard(); Map<String, String> getParameters(); boolean isCompatible(ContentType other);  }
@Test public void toString_wildcard() { ContentType contentType = new ContentType("*", "*", new HashMap<>()); String string = contentType.toString(); assertThat(string).isEqualTo("*/*"); }
@Test public void toString_type_wildcard() { ContentType contentType = new ContentType("text", "*", new HashMap<>()); String string = contentType.toString(); assertThat(string).isEqualTo("text/*"); }
@Test public void toString_type_type() { ContentType contentType = new ContentType("text", "html", new HashMap<>()); String string = contentType.toString(); assertThat(string).isEqualTo("text/html"); }
@Test public void toString_parameters() { ContentType contentType = new ContentType("text", "html", ImmutableMap.<String, String>builder() .put("q", "0.8") .put("encoding", "UTF-8") .build()); String string = contentType.toString(); assertThat(string).isEqualTo("text/html; q=0.8; encoding=UTF-8"); }