public String parseBodyToHTML() throws IOException, SAXException, TikaException {
        ContentHandler handler = new BodyContentHandler(new ToXMLContentHandler());

        AutoDetectParser parser = new AutoDetectParser();
        Metadata metadata = new Metadata();
        try (InputStream stream = ContentHandlerExample.class.getResourceAsStream("test.doc")) {
            parser.parse(stream, handler, metadata);
            return handler.toString();
        }
    }
@Test
    public void testParseBodyToHTML() throws IOException, SAXException, TikaException {
        String result = example
                .parseBodyToHTML()
                .trim();

        assertNotContained("<html", result);
        assertNotContained("<head>", result);
        assertNotContained("<meta name=\"dc:creator\"", result);
        assertNotContained("<title>", result);
        assertNotContained("<body>", result);
        assertContains(">test", result);
    }