@Test
public void testIdentityMapper() throws Exception {

    final String html = "<html><head><title>Title</title></head>" +
            "<body></body></html>";
    Metadata metadata = new Metadata();
    ParseContext parseContext = new ParseContext();
    parseContext.set(HtmlMapper.class, IdentityHtmlMapper.INSTANCE);
    StringWriter sw = new StringWriter();
    new HtmlParser().parse(
            new ByteArrayInputStream(html.getBytes(UTF_8)),
            makeHtmlTransformer(sw), metadata, parseContext);
    String result = sw.toString();
    // Make sure we don't get <body><BODY/></body>
    assertTrue(Pattern.matches("(?s).*<body/>.*$", result));
}