MimeHelper { public static String getExtension( final String mimeType ) { return MimeHelper.mimes.get( mimeType ); }  static String getExtension( final String mimeType ); static String getMimeTypeFromExtension( final String extension ); static String getMimeTypeFromFileName( final String fileName ); static String getDefaultCharset( final String mimeType ); static final String MIMETYPE_RTF; static final String RTF_EXTENSION; static final String MIMETYPE_MS_WORD; static final String MS_WORD_EXTENSION; static final String MIMETYPE_PDF; static final String PDF_EXTENSION; static final String MIMETYPE_MS_EXCEL; static final String MS_EXCEL_EXTENSION; static final String MIMETYPE_MS_PPT; static final String MS_PPT_EXTENSION; static final String MIMETYPE_MS_PROJECT; static final String MS_PROJECT_EXTENSION; static final String MIMETYPE_ZIP; static final String ZIP_EXTENSION; static final String MIMETYPE_MP3; static final String MP3_EXTENSION; static final String MIMETYPE_WAV; static final String WAV_EXTENSION; static final String MIMETYPE_BMP; static final String BMP_EXTENSION; static final String MIMETYPE_GIF; static final String GIF_EXTENSION; static final String MIMETYPE_JPEG; static final String JPEG_EXTENSION_1; static final String JPEG_EXTENSION_2; static final String JPEG_EXTENSION_3; static final String MIMETYPE_PNG; static final String PNG_EXTENSION; static final String MIMETYPE_SVG; static final String SVG_EXTENSION; static final String MIMETYPE_TIFF; static final String TIFF_EXTENSION_1; static final String TIFF_EXTENSION_2; static final String MIMETYPE_CSV; static final String CSV_EXTENSION; static final String MIMETYPE_HTML; static final String HTML_EXTENSION_1; static final String HTML_EXTENSION_2; static final String MIMETYPE_TEXT; static final String TEXT_EXTENSION; static final String PROPERTIES_EXTENSION; static final String MIMETYPE_MPG; static final String MPG_EXTENSION_1; static final String MPG_EXTENSION_2; static final String MPG_EXTENSION_3; static final String MIMETYPE_AVI; static final String AVI_EXTENSION; static final String MIMETYPE_XACTION; static final String XACTION_EXTENSION; static final String MIMETYPE_CSS; static final String CSS_EXTENSION; static final String MIMETYPE_JS; static final String JS_EXTENSION; static final String MIMETYPE_XML; static final String XML_EXTENSION; static final String MIMETYPE_FLASH; static final String FLASH_EXTENSION; static final String MIMETYPE_MS_EXCEL_2007; static final String MS_EXCEL_2007_EXTENSION; static final String MIMETYPE_EMAIL_MSG; static final String EMAIL_MSG_EXTENSION; }
@Test public void getExtensionTest() { assertEquals( MimeHelper.RTF_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_RTF ) ); assertEquals( MimeHelper.MS_WORD_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_MS_WORD ) ); assertEquals( MimeHelper.PDF_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_PDF ) ); assertEquals( MimeHelper.MS_EXCEL_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_MS_EXCEL ) ); assertEquals( MimeHelper.MS_PPT_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_MS_PPT ) ); assertEquals( MimeHelper.MS_PROJECT_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_MS_PROJECT ) ); assertEquals( MimeHelper.ZIP_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_ZIP ) ); assertEquals( MimeHelper.MP3_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_MP3 ) ); assertEquals( MimeHelper.WAV_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_WAV ) ); assertEquals( MimeHelper.BMP_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_BMP ) ); assertEquals( MimeHelper.GIF_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_GIF ) ); assertEquals( MimeHelper.JPEG_EXTENSION_1, MimeHelper.getExtension( MimeHelper.MIMETYPE_JPEG ) ); assertEquals( MimeHelper.PNG_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_PNG ) ); assertEquals( MimeHelper.SVG_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_SVG ) ); assertEquals( MimeHelper.TIFF_EXTENSION_1, MimeHelper.getExtension( MimeHelper.MIMETYPE_TIFF ) ); assertEquals( MimeHelper.CSV_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_CSV ) ); assertEquals( MimeHelper.HTML_EXTENSION_1, MimeHelper.getExtension( MimeHelper.MIMETYPE_HTML ) ); assertEquals( MimeHelper.TEXT_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_TEXT ) ); assertEquals( MimeHelper.MPG_EXTENSION_1, MimeHelper.getExtension( MimeHelper.MIMETYPE_MPG ) ); assertEquals( MimeHelper.AVI_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_AVI ) ); assertEquals( MimeHelper.XACTION_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_XACTION ) ); assertEquals( MimeHelper.CSS_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_CSS ) ); assertEquals( MimeHelper.JS_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_JS ) ); assertEquals( MimeHelper.XML_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_XML ) ); assertEquals( MimeHelper.FLASH_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_FLASH ) ); assertEquals( MimeHelper.MS_EXCEL_2007_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_MS_EXCEL_2007 ) ); assertEquals( MimeHelper.EMAIL_MSG_EXTENSION, MimeHelper.getExtension( MimeHelper.MIMETYPE_EMAIL_MSG ) ); }