public static void main(String[] args) throws Exception {
        Tika tika = new Tika();

        for (String file : args) {
            String type = tika.detect(new File(file));
            System.out.println(file + ": " + type);
        }
    }
@Test
    public void testSimpleTypeDetector() throws Exception {
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();

        PrintStream out = System.out;
        System.setOut(new PrintStream(buffer, true, UTF_8.name()));

        SimpleTypeDetector.main(new String[]{"pom.xml"});

        System.setOut(out);

        assertContains("pom.xml: application/xml", buffer
                .toString(UTF_8.name())
                .trim());
    }