@Test
    public void testInjectedXML() throws Exception {
        byte[] bytes = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><document>blah</document>"
                .getBytes(StandardCharsets.UTF_8);
        byte[] injected = injectXML(bytes, XXE);
        try {
            parse("injected", new ByteArrayInputStream(injected), new VulnerableSAXParser(),
                    new ParseContext());
            fail("injected should have triggered xxe");
        } catch (FileNotFoundException e) {
            //expected
        }
    }
This tests for XXE in basically xml type files, straight xml and zipped
xmls, e.g. ebook and ooxml.
It does not test for XXE prevention in files that may contain xml
files, such as PDFs and other XMP-containing files.
tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/parser/TestXXEInXML.java