FileAnalyser { public String getMimetype(File inputFile) { try { final MagicMatch match = getMatch(inputFile); final String mimeType = match.getMimeType(); if ("???".equals(mimeType)) { return guessMimeTypeFromDescription(match); } return mimeType; } catch (MagicMatchNotFoundException e) { LOGGER.debug("Failed to get Mime Type", e); final MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap(); return mimeTypesMap.getContentType(inputFile); } }  static String identifyLineDelimiter(String fileContent); static String identifyLineDelimiter(File fileToAnalyse); String getDescription(File inputFile); String getMimetype(File inputFile);  }
@Test public void testGetMimetypeGZFile() throws URISyntaxException { assertEquals("application/x-gzip", fileAnalyser.getMimetype(new File(archiveUrl.toURI().getPath(), "pol.txt.gz"))); }
@Test public void testGetMimetypeBZ2File() throws URISyntaxException { assertEquals("application/x-bzip2", fileAnalyser.getMimetype(new File(archiveUrl.toURI().getPath(), "pol.txt.bz2"))); }
@Test public void testGetMimetypeTarGZFile() throws URISyntaxException { assertEquals("application/x-gzip", fileAnalyser.getMimetype(new File(archiveUrl.toURI().getPath(), "test2.tar.gz"))); }
@Test public void testGetMimetypeTarBZ2File() throws URISyntaxException { assertEquals("application/x-bzip2", fileAnalyser.getMimetype(new File(archiveUrl.toURI().getPath(), "test3.tar.bz2"))); }
@Test @Ignore public void testGetMimetypeTarFile() throws URISyntaxException { assertEquals("application/octet-stream", fileAnalyser.getMimetype(new File(archiveUrl.toURI().getPath(), "test1.tar"))); }