@Test
public void testHtmlLanguage() throws Exception {

    final String html = "<html lang=\"fr\"></html>";
    StringWriter sw = new StringWriter();
    Metadata metadata = new Metadata();
    new HtmlParser().parse(
            new ByteArrayInputStream(html.getBytes(UTF_8)),
            makeHtmlTransformer(sw), metadata, new ParseContext());
    assertEquals("fr", metadata.get(Metadata.CONTENT_LANGUAGE));
    assertTrue("Missing HTML lang attribute",
            Pattern.matches("(?s)<html[^>]* lang=\"fr\".*", sw.toString()));
}