@Test
public void testEBCDIC_CP500() throws Exception {

    Metadata metadata = new Metadata();
    StringWriter writer = new StringWriter();
    parser.parse(
            TXTParserTest.class.getResourceAsStream("/test-documents/english.cp500.txt"),
            new WriteOutContentHandler(writer),
            metadata,
            new ParseContext());
    assertEquals("text/plain; charset=IBM500", metadata.get(Metadata.CONTENT_TYPE));
    // Additional check that it isn't too eager on short blocks of text
    metadata = new Metadata();
    writer = new StringWriter();
    parser.parse(
            new ByteArrayInputStream("<html><body>hello world</body></html>".getBytes(ISO_8859_1)),
            new WriteOutContentHandler(writer),
            metadata,
            new ParseContext());
    assertEquals("text/plain; charset=ISO-8859-1", metadata.get(Metadata.CONTENT_TYPE));
}