ContentType { public String toContentTypeString() { final StringBuilder sb = new StringBuilder(); sb.append(type).append(TypeUtil.TYPE_SUBTYPE_SEPARATOR).append(subtype); for (Entry<String, String> entry : parameters.entrySet()) { sb.append(TypeUtil.PARAMETER_SEPARATOR).append(entry.getKey()) .append(TypeUtil.PARAMETER_KEY_VALUE_SEPARATOR).append(entry.getValue()); } return sb.toString(); } private  ContentType(final String type, final String subtype, final Map<String, String> parameters); static ContentType create(final ContentType contentType,
      final String parameterName, final String parameterValue); static ContentType create(final String format); static ContentType parse(final String format); String getType(); String getSubtype(); Map<String, String> getParameters(); String getParameter(final String name); @Override int hashCode(); @Override boolean equals(final Object obj); boolean isCompatible(final ContentType other); String toContentTypeString(); @Override String toString(); static final String PARAMETER_CHARSET; static final String PARAMETER_IEEE754_COMPATIBLE; static final String PARAMETER_ODATA_METADATA; static final String VALUE_ODATA_METADATA_NONE; static final String VALUE_ODATA_METADATA_MINIMAL; static final String VALUE_ODATA_METADATA_FULL; static final ContentType APPLICATION_JSON; static final ContentType JSON; static final ContentType JSON_NO_METADATA; static final ContentType JSON_FULL_METADATA; static final ContentType APPLICATION_XML; static final ContentType APPLICATION_ATOM_XML; static final ContentType APPLICATION_ATOM_XML_ENTRY; static final ContentType APPLICATION_ATOM_XML_ENTRY_UTF8; static final ContentType APPLICATION_ATOM_XML_FEED; static final ContentType APPLICATION_ATOM_XML_FEED_UTF8; static final ContentType APPLICATION_ATOM_SVC; static final ContentType APPLICATION_OCTET_STREAM; static final ContentType APPLICATION_XHTML_XML; static final ContentType TEXT_HTML; static final ContentType TEXT_XML; static final ContentType TEXT_PLAIN; static final ContentType APPLICATION_SVG_XML; static final ContentType APPLICATION_FORM_URLENCODED; static final ContentType APPLICATION_HTTP; static final ContentType MULTIPART_MIXED; static final ContentType MULTIPART_FORM_DATA; }
@Test public void toContentTypeString() { assertEquals("application/json;a=b;c=d", ContentType.create(ContentType.create(ContentType.APPLICATION_JSON, "a", "b"), "c", "d") .toContentTypeString()); }