|
55 | 55 | // 3 a b,c,d "quoted" e |
56 | 56 | // |
57 | 57 | public class JiraCsv290Test { |
58 | | - private void testHelper(String filename, CSVFormat format) throws Exception { |
59 | | - List<List<String>> content = new ArrayList<>(); |
| 58 | + private void testHelper(final String filename, final CSVFormat format) throws Exception { |
| 59 | + final List<List<String>> content = new ArrayList<>(); |
60 | 60 | try (CSVParser csvParser = CSVParser.parse(new InputStreamReader( |
61 | 61 | this.getClass().getResourceAsStream("/org/apache/commons/csv/CSV-290/" + filename)), format)) { |
62 | 62 | for (CSVRecord csvRecord : csvParser) { |
63 | | - List<String> row = new ArrayList<>(); |
| 63 | + final List<String> row = new ArrayList<>(); |
64 | 64 | content.add(row); |
65 | 65 | for (int i = 0; i < csvRecord.size(); i++) { |
66 | 66 | row.add(csvRecord.get(i)); |
@@ -96,22 +96,22 @@ public void testPostgresqlText() throws Exception { |
96 | 96 |
|
97 | 97 | @Test |
98 | 98 | public void testWriteThenRead() throws Exception { |
99 | | - StringWriter sw = new StringWriter(); |
| 99 | + final StringWriter sw = new StringWriter(); |
100 | 100 |
|
101 | | - CSVPrinter printer = new CSVPrinter(sw, |
| 101 | + final CSVPrinter printer = new CSVPrinter(sw, |
102 | 102 | CSVFormat.POSTGRESQL_CSV.builder().setHeader().setSkipHeaderRecord(true).build()); |
103 | 103 |
|
104 | 104 | printer.printRecord("column1", "column2"); |
105 | 105 | printer.printRecord("v11", "v12"); |
106 | 106 | printer.printRecord("v21", "v22"); |
107 | 107 | printer.close(); |
108 | 108 |
|
109 | | - CSVParser parser = new CSVParser(new StringReader(sw.toString()), |
| 109 | + final CSVParser parser = new CSVParser(new StringReader(sw.toString()), |
110 | 110 | CSVFormat.POSTGRESQL_CSV.builder().setHeader().setSkipHeaderRecord(true).build()); |
111 | 111 |
|
112 | 112 | assertArrayEquals(new Object[] { "column1", "column2" }, parser.getHeaderNames().toArray()); |
113 | 113 |
|
114 | | - Iterator<CSVRecord> i = parser.iterator(); |
| 114 | + final Iterator<CSVRecord> i = parser.iterator(); |
115 | 115 | assertArrayEquals(new String[] { "v11", "v12" }, i.next().toList().toArray()); |
116 | 116 | assertArrayEquals(new String[] { "v21", "v22" }, i.next().toList().toArray()); |
117 | 117 | } |
|
0 commit comments