MimeType implements Serializable { public static MimeType fromMimeTypeString(final String mimeTypeString) { Objects.requireNonNull(mimeTypeString, "The mimeTypeString cannot be null!"); MimeType mimeType = mimeTypes.get(mimeTypeString); if (mimeType == null) { mimeType = new MimeType(mimeTypeString); } return mimeType; } MimeType(); private  MimeType(final String mimeTypeString);  MimeType(final String mimeTypeString, final String extension); String getMimeTypeString(); void setMimeTypeString(String mimeTypeString); static MimeType fromFileName(final String fileName); static String getExtension(MimeType mimeType); static String getFileExtension(final String fileName); static MimeType fromFile(final File file); static MimeType fromMimeTypeString(final String mimeTypeString); void defineFileExtension(final String extension); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static final MimeType BINARY; static final MimeType XML; static final MimeType HTML; static final MimeType PDF; static final MimeType PKCS7; static final MimeType TST; static final MimeType ASICS; static final MimeType ASICE; static final MimeType ODT; static final MimeType ODS; static final MimeType ODP; static final MimeType ODG; static final MimeType TEXT; static final MimeType CRL; static final MimeType CER; static final MimeType PNG; static final MimeType JPEG; static final MimeType SVG; }
@Test public void fromMimeTypeStringTest() { assertEquals(MimeType.XML, MimeType.fromMimeTypeString("text/xml")); assertEquals(MimeType.PDF, MimeType.fromMimeTypeString("application/pdf")); assertEquals(MimeType.PNG, MimeType.fromMimeTypeString("image/png")); assertEquals(MimeType.ASICE, MimeType.fromMimeTypeString("application/vnd.etsi.asic-e+zip")); MimeType asiceNewLineMimeType = MimeType.fromMimeTypeString("application/vnd.etsi.asic-e+zip\n"); assertNotNull(asiceNewLineMimeType); assertNotEquals(MimeType.ASICE, asiceNewLineMimeType); }