Skip to content

Commit 6bfd380

Browse files
committed
Use final.
1 parent de4508c commit 6bfd380

3 files changed

Lines changed: 21 additions & 21 deletions

File tree

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,19 @@ private void parseFully(final CSVParser parser) {
9191

9292
@Test
9393
public void testParseWithDelimiterWithQuote() throws IOException {
94-
String source = "'a,b,c',xyz";
95-
CSVFormat csvFormat = CSVFormat.DEFAULT.withQuote('\'');
94+
final String source = "'a,b,c',xyz";
95+
final CSVFormat csvFormat = CSVFormat.DEFAULT.withQuote('\'');
9696
try (CSVParser csvParser = csvFormat.parse(new StringReader(source))) {
97-
CSVRecord csvRecord = csvParser.nextRecord();
97+
final CSVRecord csvRecord = csvParser.nextRecord();
9898
assertEquals("a,b,c", csvRecord.get(0));
9999
assertEquals("xyz", csvRecord.get(1));
100100
}
101101
}
102102

103103
@Test
104104
public void testParseWithDelimiterStringWithQuote() throws IOException {
105-
String source = "'a[|]b[|]c'[|]xyz\r\nabc[abc][|]xyz";
106-
CSVFormat csvFormat = CSVFormat.DEFAULT.builder().setDelimiter("[|]").setQuote('\'').build();
105+
final String source = "'a[|]b[|]c'[|]xyz\r\nabc[abc][|]xyz";
106+
final CSVFormat csvFormat = CSVFormat.DEFAULT.builder().setDelimiter("[|]").setQuote('\'').build();
107107
try (CSVParser csvParser = csvFormat.parse(new StringReader(source))) {
108108
CSVRecord csvRecord = csvParser.nextRecord();
109109
assertEquals("a[|]b[|]c", csvRecord.get(0));
@@ -116,19 +116,19 @@ public void testParseWithDelimiterStringWithQuote() throws IOException {
116116

117117
@Test
118118
public void testParseWithDelimiterWithEscape() throws IOException {
119-
String source = "a!,b!,c,xyz";
120-
CSVFormat csvFormat = CSVFormat.DEFAULT.withEscape('!');
119+
final String source = "a!,b!,c,xyz";
120+
final CSVFormat csvFormat = CSVFormat.DEFAULT.withEscape('!');
121121
try (CSVParser csvParser = csvFormat.parse(new StringReader(source))) {
122-
CSVRecord csvRecord = csvParser.nextRecord();
122+
final CSVRecord csvRecord = csvParser.nextRecord();
123123
assertEquals("a,b,c", csvRecord.get(0));
124124
assertEquals("xyz", csvRecord.get(1));
125125
}
126126
}
127127

128128
@Test
129129
public void testParseWithDelimiterStringWithEscape() throws IOException {
130-
String source = "a![!|!]b![|]c[|]xyz\r\nabc[abc][|]xyz";
131-
CSVFormat csvFormat = CSVFormat.DEFAULT.builder().setDelimiter("[|]").setEscape('!').build();
130+
final String source = "a![!|!]b![|]c[|]xyz\r\nabc[abc][|]xyz";
131+
final CSVFormat csvFormat = CSVFormat.DEFAULT.builder().setDelimiter("[|]").setEscape('!').build();
132132
try (CSVParser csvParser = csvFormat.parse(new StringReader(source))) {
133133
CSVRecord csvRecord = csvParser.nextRecord();
134134
assertEquals("a[|]b![|]c", csvRecord.get(0));
@@ -141,32 +141,32 @@ public void testParseWithDelimiterStringWithEscape() throws IOException {
141141

142142
@Test
143143
public void testParseWithQuoteWithEscape() throws IOException {
144-
String source = "'a?,b?,c?d',xyz";
145-
CSVFormat csvFormat = CSVFormat.DEFAULT.withQuote('\'').withEscape('?');
144+
final String source = "'a?,b?,c?d',xyz";
145+
final CSVFormat csvFormat = CSVFormat.DEFAULT.withQuote('\'').withEscape('?');
146146
try (CSVParser csvParser = csvFormat.parse(new StringReader(source))) {
147-
CSVRecord csvRecord = csvParser.nextRecord();
147+
final CSVRecord csvRecord = csvParser.nextRecord();
148148
assertEquals("a,b,c?d", csvRecord.get(0));
149149
assertEquals("xyz", csvRecord.get(1));
150150
}
151151
}
152152

153153
@Test
154154
public void testParseWithQuoteThrowsException() {
155-
CSVFormat csvFormat = CSVFormat.DEFAULT.withQuote('\'');
155+
final CSVFormat csvFormat = CSVFormat.DEFAULT.withQuote('\'');
156156
assertThrows(IOException.class, () -> csvFormat.parse(new StringReader("'a,b,c','")).nextRecord());
157157
assertThrows(IOException.class, () -> csvFormat.parse(new StringReader("'a,b,c'abc,xyz")).nextRecord());
158158
assertThrows(IOException.class, () -> csvFormat.parse(new StringReader("'abc'a,b,c',xyz")).nextRecord());
159159
}
160160

161161
@Test
162162
public void testNotValueCSV() throws IOException {
163-
String source = "#";
164-
CSVFormat csvFormat = CSVFormat.DEFAULT.withCommentMarker('#');
165-
CSVParser csvParser = csvFormat.parse(new StringReader(source));
166-
CSVRecord csvRecord = csvParser.nextRecord();
163+
final String source = "#";
164+
final CSVFormat csvFormat = CSVFormat.DEFAULT.withCommentMarker('#');
165+
final CSVParser csvParser = csvFormat.parse(new StringReader(source));
166+
final CSVRecord csvRecord = csvParser.nextRecord();
167167
assertNull(csvRecord);
168168
}
169-
169+
170170
@Test
171171
public void testBackslashEscaping() throws IOException {
172172

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public void testReadChar() throws Exception {
8787

8888
@Test
8989
public void testReadingInDifferentBuffer() throws Exception {
90-
char[] tmp1 = new char[2], tmp2 = new char[4];
90+
final char[] tmp1 = new char[2], tmp2 = new char[4];
9191
try (ExtendedBufferedReader reader = createBufferedReader("1\r\n2\r\n")) {
9292
reader.read(tmp1, 0, 2);
9393
reader.read(tmp2, 2, 2);

src/test/java/org/apache/commons/csv/issues/JiraCsv206Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void testJiraCsv206MultipleCharacterDelimiter() throws IOException {
3838
final CSVFormat csvFormat = CSVFormat.DEFAULT.builder().setDelimiter("[|]").build();
3939
CSVRecord record = null;
4040
try (final CSVParser csvParser = new CSVParser(reader, csvFormat)) {
41-
Iterator<CSVRecord> iterator = csvParser.iterator();
41+
final Iterator<CSVRecord> iterator = csvParser.iterator();
4242
record = iterator.next();
4343
assertEquals("FirstName", record.get(0));
4444
assertEquals("LastName", record.get(1));

0 commit comments

Comments
 (0)