@Test
    public void testAsync() throws Exception {
        String content = getParamOutContent("-a", "--config=" + ASYNC_CONFIG.toAbsolutePath());

        int json = 0;
        for (File f : ASYNC_OUTPUT_DIR
                .toFile()
                .listFiles()) {
            if (f
                    .getName()
                    .endsWith(".json")) {
                //check one file for pretty print
                if (f
                        .getName()
                        .equals("coffee.xls.json")) {
                    checkForPrettyPrint(f);
                }
                json++;
            }
        }
        assertEquals(18, json);
    }
clear outContent and errContent if they are not empty by create a new one.
set outContent and errContent as System.out and System.err
tika-app/src/test/java/org/apache/tika/cli/TikaCLIAsyncTest.java