@Test
public void testLatinDetectionHeuristics() throws Exception {

    String windows = "test\r\n";
    String unix = "test\n";
    String euro = "test \u20ac\n";
    Metadata metadata;
    metadata = new Metadata();
    parser.parse(
            new ByteArrayInputStream(windows.getBytes("ISO-8859-15")),
            new DefaultHandler(), metadata, new ParseContext());
    assertEquals(
            "text/plain; charset=windows-1252",
            metadata.get(Metadata.CONTENT_TYPE));
    metadata = new Metadata();
    parser.parse(
            new ByteArrayInputStream(unix.getBytes("ISO-8859-15")),
            new DefaultHandler(), metadata, new ParseContext());
    assertEquals(
            "text/plain; charset=ISO-8859-1",
            metadata.get(Metadata.CONTENT_TYPE));
    metadata = new Metadata();
    parser.parse(
            new ByteArrayInputStream(euro.getBytes("ISO-8859-15")),
            new DefaultHandler(), metadata, new ParseContext());
    assertEquals(
            "text/plain; charset=ISO-8859-15",
            metadata.get(Metadata.CONTENT_TYPE));
}