@Test
public void testUsingCharsetInContentTypeHeader() throws Exception {

    // Could be ISO 8859-1 or ISO 8859-15 or ...
    // u00e1 is latin small letter a with acute
    final String test2 = "the name is \u00e1ndre";
    Metadata metadata = new Metadata();
    parser.parse(
            new ByteArrayInputStream(test2.getBytes(ISO_8859_1)),
            new BodyContentHandler(), metadata, new ParseContext());
    assertEquals("text/plain; charset=ISO-8859-1", metadata.get(Metadata.CONTENT_TYPE));
    assertEquals("ISO-8859-1", metadata.get(Metadata.CONTENT_ENCODING)); // deprecated
    metadata = new Metadata();
    metadata.set(Metadata.CONTENT_TYPE, "text/html; charset=ISO-8859-15");
    parser.parse(
            new ByteArrayInputStream(test2.getBytes(ISO_8859_1)),
            new BodyContentHandler(), metadata, new ParseContext());
    assertEquals("text/html; charset=ISO-8859-15", metadata.get(Metadata.CONTENT_TYPE));
    assertEquals("ISO-8859-15", metadata.get(Metadata.CONTENT_ENCODING)); // deprecated
}