private void assertAutoDetect(TestParams tp) throws Exception {
        try (InputStream input = getResourceAsStream(tp.resourceRealName)) {
            if (input == null) {
                fail("Could not open stream from specified resource: " + tp.resourceRealName);
            }
            Metadata metadata = new Metadata();
            metadata.set(TikaCoreProperties.RESOURCE_NAME_KEY, tp.resourceStatedName);
            metadata.set(Metadata.CONTENT_TYPE, tp.statedType);
            ContentHandler handler = new BodyContentHandler();
            new AutoDetectParser(tika).parse(input, handler, metadata);

            assertEquals(tp.realType, metadata.get(Metadata.CONTENT_TYPE),
                    "Bad content type: " + tp);

            if (tp.expectedContentFragment != null) {
                assertTrue(handler.toString().contains(tp.expectedContentFragment),
                        "Expected content not found: " + tp);
            }
        }
    }
This is where a single test is done.

@param tp the parameters encapsulated in a TestParams instance
@throws IOException
tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/parser/AutoDetectParserTest.java