ContentType implements Serializable { public static ContentType create(final String mimeType, final Charset charset) { final String normalizedMimeType = Args.notBlank(mimeType, "MIME type").toLowerCase(Locale.ROOT); Args.check(valid(normalizedMimeType), "MIME type may not contain reserved characters"); return new ContentType(normalizedMimeType, charset); } ContentType(
            final String mimeType,
            final Charset charset);   ContentType(
            final String mimeType,
            final Charset charset,
            final NameValuePair[] params); String getMimeType(); Charset getCharset(); String getParameter(final String name); @Override String toString(); static ContentType create(final String mimeType, final Charset charset); static ContentType create(final String mimeType); static ContentType create(
            final String mimeType, final String charset); static ContentType create(
            final String mimeType, final NameValuePair... params); static ContentType parse(final CharSequence s); static ContentType parseLenient(final CharSequence s); @Deprecated static ContentType getByMimeType(final String mimeType); ContentType withCharset(final Charset charset); ContentType withCharset(final String charset); ContentType withParameters(
            final NameValuePair... params); boolean isSameMimeType(final ContentType contentType); static final ContentType APPLICATION_ATOM_XML; static final ContentType APPLICATION_FORM_URLENCODED; static final ContentType APPLICATION_JSON; static final ContentType APPLICATION_OCTET_STREAM; static final ContentType APPLICATION_SOAP_XML; static final ContentType APPLICATION_SVG_XML; static final ContentType APPLICATION_XHTML_XML; static final ContentType APPLICATION_XML; static final ContentType IMAGE_BMP; static final ContentType IMAGE_GIF; static final ContentType IMAGE_JPEG; static final ContentType IMAGE_PNG; static final ContentType IMAGE_SVG; static final ContentType IMAGE_TIFF; static final ContentType IMAGE_WEBP; static final ContentType MULTIPART_FORM_DATA; static final ContentType TEXT_HTML; static final ContentType TEXT_PLAIN; static final ContentType TEXT_XML; static final ContentType WILDCARD; static final ContentType DEFAULT_TEXT; static final ContentType DEFAULT_BINARY; }
@Test public void testCreateInvalidInput() throws Exception { try { ContentType.create(null, (String) null); Assert.fail("NullPointerException should have been thrown"); } catch (final NullPointerException ex) { } try { ContentType.create(" ", (String) null); Assert.fail("IllegalArgumentException should have been thrown"); } catch (final IllegalArgumentException ex) { } try { ContentType.create("stuff;", (String) null); Assert.fail("IllegalArgumentException should have been thrown"); } catch (final IllegalArgumentException ex) { } try { ContentType.create("text/plain", ","); Assert.fail("IllegalArgumentException should have been thrown"); } catch (final IllegalArgumentException ex) { } }