### Question:
Utils { public static String getMimeType( File file ) { if (mimeTypeUtils == null) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(Utils.class.getClassLoader()); InputStream stream =Thread.currentThread().getContextClassLoader().getResourceAsStream("org/modeshape/web/jcr/rest/client/mime.types"); Map<String, String> customMap = MimeTypeUtil.load(stream, null); mimeTypeUtils = new MimeTypeUtil(customMap, true); } finally { Thread.currentThread().setContextClassLoader(cl); } } String mimeType = mimeTypeUtils.mimeTypeOf(file); return ((mimeType == null) ? "application/octet-stream" : mimeType); } Utils(); static boolean equivalent( Object thisObj,
                                      Object thatObj ); static String getMimeType( File file );  }### Answer:
@Test public void shouldHaveCorrectMimetypeForEclipseTextFiles() { for (String extension : TEXT_EXTENSIONS) { String mimetype = Utils.getMimeType(new File('.' + extension)); assertThat(mimetype, is(TEXT_MIMETYPE)); } }
@Test public void shouldHaveCorrectMimetypeForEclipseXmlFiles() { for (String extension : XML_EXTENSIONS) { String mimetype = Utils.getMimeType(new File('.' + extension)); assertThat(mimetype, is(XML_MIMETYPE)); } }
@Test public void shouldUseDefaultMimetypeIfUnknownExtension() { String mimetype = Utils.getMimeType(new File('.' + "bogusExtension")); assertThat(mimetype, is(DEFAULT_MIMETYPE)); }