@Test
public void testAgeRecogniser() throws Exception {

    //test config is added to resources directory
    try (InputStream is = getClass().getResourceAsStream(CONFIG_FILE);
         InputStream bis = new ByteArrayInputStream(TEST_TEXT.getBytes(Charset.defaultCharset()));
    ) {
        TikaConfig config = new TikaConfig(is);
        Tika tika = new Tika(config);
        Metadata md = new Metadata();
        tika.parse(bis, md);
        Assert.assertArrayEquals("Age Parser not invoked.",
                new String[] {CompositeParser.class.getCanonicalName(), AgeRecogniser.class.getCanonicalName()},
                md.getValues("X-Parsed-By"));
        Assert.assertArrayEquals("Wrong age predicted.",
                new String[] {Double.toString(TEST_AGE)},
                md.getValues(AgeRecogniser.MD_KEY_ESTIMATED_AGE));
    }
}