Skip to content
This repository was archived by the owner on Jun 3, 2026. It is now read-only.

Commit c510c72

Browse files
committed
Tidy up; rename shared fields to be clearer
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1306307 13f79535-47bb-0310-9956-ffa450edef68
1 parent ba26844 commit c510c72

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

src/test/java/org/apache/commons/csv/CSVParserTest.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@
4141
*/
4242
public class CSVParserTest {
4343

44-
String code = "a,b,c,d\n"
44+
private static final String CSVINPUT = "a,b,c,d\n"
4545
+ " a , b , 1 2 \n"
4646
+ "\"foo baar\", b,\n"
4747
// + " \"foo\n,,\n\"\",,\n\\\"\",d,e\n";
4848
+ " \"foo\n,,\n\"\",,\n\"\"\",d,e\n"; // changed to use standard CSV escaping
49-
String[][] res = {
49+
50+
private static final String[][] RESULT = {
5051
{"a", "b", "c", "d"},
5152
{"a", "b", "1 2"},
5253
{"foo baar", "b", ""},
@@ -55,8 +56,8 @@ public class CSVParserTest {
5556

5657
@Test
5758
public void testGetLine() throws IOException {
58-
CSVParser parser = new CSVParser(new StringReader(code), CSVFormat.DEFAULT.withSurroundingSpacesIgnored(true));
59-
for (String[] re : res) {
59+
CSVParser parser = new CSVParser(new StringReader(CSVINPUT), CSVFormat.DEFAULT.withSurroundingSpacesIgnored(true));
60+
for (String[] re : RESULT) {
6061
assertArrayEquals(re, parser.getRecord().values());
6162
}
6263

@@ -65,12 +66,12 @@ public void testGetLine() throws IOException {
6566

6667
@Test
6768
public void testGetRecords() throws IOException {
68-
CSVParser parser = new CSVParser(new StringReader(code), CSVFormat.DEFAULT.withSurroundingSpacesIgnored(true));
69+
CSVParser parser = new CSVParser(new StringReader(CSVINPUT), CSVFormat.DEFAULT.withSurroundingSpacesIgnored(true));
6970
List<CSVRecord> records = parser.getRecords();
70-
assertEquals(res.length, records.size());
71+
assertEquals(RESULT.length, records.size());
7172
assertTrue(records.size() > 0);
72-
for (int i = 0; i < res.length; i++) {
73-
assertArrayEquals(res[i], records.get(i).values());
73+
for (int i = 0; i < RESULT.length; i++) {
74+
assertArrayEquals(RESULT[i], records.get(i).values());
7475
}
7576
}
7677

@@ -331,7 +332,7 @@ public void testDefaultFormat() throws IOException {
331332
String code = ""
332333
+ "a,b\n" // 1)
333334
+ "\"\n\",\" \"\n" // 2)
334-
+ "\"\",#\n" // 2)
335+
+ "\"\",#\n" // 3)
335336
;
336337
String[][] res = {
337338
{"a", "b"},

0 commit comments

Comments
 (0)