ParsingExample { public String parseExample() throws IOException, SAXException, TikaException { AutoDetectParser parser = new AutoDetectParser(); BodyContentHandler handler = new BodyContentHandler(); Metadata metadata = new Metadata(); try (InputStream stream = ParsingExample.class.getResourceAsStream("test.doc")) { parser.parse(stream, handler, metadata); return handler.toString(); } }  String parseToStringExample(); String parseExample(); String parseNoEmbeddedExample(); String parseEmbeddedExample(); List<Metadata> recursiveParserWrapperExample(); String serializedRecursiveParserWrapperExample(); List<Path> extractEmbeddedDocumentsExample(Path outputPath);  }
@Test public void testParseExample() throws IOException, SAXException, TikaException { String result = parsingExample.parseExample().trim(); assertEquals("Expected 'test', but got '" + result + "'", "test", result); }