1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.commons.csv.issues;
21
22 import static org.junit.jupiter.api.Assertions.assertNotNull;
23
24 import java.io.IOException;
25 import java.io.InputStream;
26 import java.io.InputStreamReader;
27 import java.io.UnsupportedEncodingException;
28 import java.nio.charset.StandardCharsets;
29
30 import org.apache.commons.csv.CSVFormat;
31 import org.apache.commons.csv.CSVParser;
32 import org.junit.jupiter.api.Test;
33
34 class JiraCsv198Test {
35
36
37 private static final CSVFormat CSV_FORMAT = CSVFormat.EXCEL.builder()
38 .setDelimiter('^')
39 .setHeader()
40 .setSkipHeaderRecord(true)
41 .get();
42
43
44 @Test
45 void test() throws UnsupportedEncodingException, IOException {
46 final InputStream pointsOfReference = getClass().getResourceAsStream("/org/apache/commons/csv/CSV-198/optd_por_public.csv");
47 assertNotNull(pointsOfReference);
48 try (@SuppressWarnings("resource")
49 CSVParser parser = CSV_FORMAT.parse(new InputStreamReader(pointsOfReference, StandardCharsets.UTF_8))) {
50 parser.forEach(record -> assertNotNull(record.get("location_type")));
51 }
52 }
53
54 }