@Test
public void TDP_1240_should_detect_separator_if_wrong_characters_exceed_threshold() throws IOException {

    // null character
    char[] chars = new char[51];
    for (int i = 0; i < 49; i++) {
        chars[i] = 0;
    }
    chars[49] = ';';
    chars[50] = '\n';
    try (InputStream inputStream = IOUtils.toInputStream(new String(chars))) {
        // We do know the format and therefore we go directly to the CSV schema guessing
        SchemaParser.Request request = getRequest(inputStream, "#10");
        request.getMetadata().setEncoding("UTF-8");
        csvSchemaParser.parse(request);
        final Map<String, String> parameters = request.getMetadata().getContent().getParameters();
        char actual = parameters.get(CSVFormatFamily.SEPARATOR_PARAMETER).charAt(0);
        assertEquals(';', actual);
    }
    // wrong character
    chars = new char[51];
    for (int i = 0; i < 49; i++) {
        chars[i] = 65533;
    }
    chars[49] = ';';
    chars[50] = '\n';
    try (InputStream inputStream = IOUtils.toInputStream(new String(chars))) {
        // We do know the format and therefore we go directly to the CSV schema guessing
        SchemaParser.Request request = getRequest(inputStream, "#11");
        request.getMetadata().setEncoding("UTF-8");
        csvSchemaParser.parse(request);
        final Map<String, String> parameters = request.getMetadata().getContent().getParameters();
        char actual = parameters.get(CSVFormatFamily.SEPARATOR_PARAMETER).charAt(0);
        assertEquals(';', actual);
    }
}