@Test
public void testMetaTagHandling() throws Exception {

    final String test = "<html><body><h1>header</h1><p>some text</p></body></html>";
    Metadata metadata = new Metadata();
    metadata.add("Content-Type", "text/html; charset=utf-8");
    metadata.add("Language", null);
    StringWriter sw = new StringWriter();
    new HtmlParser().parse(
            new ByteArrayInputStream(test.getBytes(UTF_8)),
            makeHtmlTransformer(sw), metadata, new ParseContext());
    String result = sw.toString();
    // <meta> tag for Content-Type should exist, but nothing for Language
    assertTrue(Pattern.matches("(?s).*<meta name=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>.*$", result));
    assertFalse(Pattern.matches("(?s).*<meta name=\"Language\".*$", result));
}