MimeTypeUtils { public static String detect(File f) throws IOException { return detect(f, false); }  static boolean belongsTo(String mimeType, String otherType,
      String otherStructuredSyntaxSuffix); static String detect(File f); static String detect(File f, boolean gzip); static final String XML; static final String JSON; }
@Test public void detectJSON() throws IOException { File tempFile = folder.newFile(); FileUtils.write(tempFile, " \n {\"name\": \"Elvis\"}", StandardCharsets.UTF_8); assertEquals(JSON, detect(tempFile)); }
@Test public void detectXML() throws IOException { File tempFile = folder.newFile(); FileUtils.write(tempFile, " \n\n\n <root></root> ", StandardCharsets.UTF_8); assertEquals(XML, detect(tempFile)); }
@Test public void detectNone() throws IOException { File tempFile = folder.newFile(); FileUtils.write(tempFile, " \n\n\n ", StandardCharsets.UTF_8); assertNull(detect(tempFile)); }