@Test
public void testFormatting() throws IOException {

    List<Pattern> patterns = Collections.singletonList(Pattern.compile(".+\\.xml"));
    DocViewFormat format = new DocViewFormat();
    assertFalse("malformed.xml is expected to be malformed", format.format(dir, patterns, false).isEmpty());
    try (InputStream input = this.getClass().getResourceAsStream("DocViewFormat/formatted.xml")) {
        final String expected = IOUtils.toString(input, StandardCharsets.UTF_8);
        final String result = FileUtils.readFileToString(docViewFile, StandardCharsets.UTF_8);
        assertEquals(expected, result);
    }
    assertTrue("malformed.xml is expected to be formatted", format.format(dir, patterns, true).isEmpty());
}