public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
                      ParseContext context) throws IOException, SAXException, TikaException {
        TikaInputStream tis = TikaInputStream.get(stream, new TemporaryResources(), metadata);
        File tmpFile = tis.getFile();

        GrobidRESTParser grobidParser = new GrobidRESTParser();
        grobidParser.parse(tmpFile.getAbsolutePath(), handler, metadata, context);

        PDFParser parser = new PDFParser();
        parser.parse(new FileInputStream(tmpFile), handler, metadata, context);
    }
@Test
    public void testJournalParser() {
        String path = "/test-documents/testJournalParser.pdf";
        ContentHandler handler = new BodyContentHandler();
        Metadata metadata = new Metadata();

        assumeTrue(canRun());

        InputStream stream = JournalParserTest.class.getResourceAsStream(path);
        JournalParser jParser = new JournalParser();
        try {
            jParser.parse(stream, handler, metadata, new ParseContext());
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }

        assertNotNull(metadata.get("grobid:header_Title"));
    }