@Test
    public void testAllMultithreaded() throws Exception {

        Detector detector = new Tika().getDetector();
        FileFilter filter = new FileFilter() {
            //TODO: create proper randomized framework that will record seed, etc...
            private final Random random = new Random();
            //increase this to the number of files for a true smoke test
            //for now, randomly pick 20 files.
            int toProcess = 20;
            int processed = 0;

            @Override
            public boolean accept(File pathname) {
                if (processed >= toProcess) {
                    return false;
                } else if (random.nextBoolean()) {
                    processed++;
                    return true;
                }
                return false;
            }
        };
        int numThreads = 20;
        XMLReaderUtils.setPoolSize(numThreads);

        testDetector(detector, numThreads, 50, filter, numThreads * 3);
    }
Check that temporary files created by Tika are removed after
closing TikaInputStream.
tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/detect/TestContainerAwareDetector.java