MimeTypeToExtensionsUtil { public static String getExtension(final String mimeType) { if (MIME_TYPES_EXTENSIONS.containsKey(mimeType)) { return MIME_TYPES_EXTENSIONS.get(mimeType); } return mimeType.substring(mimeType.indexOf("/") + 1); }  static String getExtension(final String mimeType);  }
@Test public void mapApplicationZipToZip() { String extension = MimeTypeToExtensionsUtil.getExtension("application/zip"); Assert.assertEquals("zip", extension); }
@Test public void mapImagePngToPng() { String extension = MimeTypeToExtensionsUtil.getExtension("image/png"); Assert.assertEquals("png", extension); }
@Test public void mapImageJpegToJpg() { String extension = MimeTypeToExtensionsUtil.getExtension("image/jpeg"); Assert.assertEquals("jpg", extension); }
@Test public void mapTextPlainToLog() { String extension = MimeTypeToExtensionsUtil.getExtension("text/plain"); Assert.assertEquals("log", extension); }