This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git
The following commit(s) were added to refs/heads/master by this push:
new 6bfd380 Use final.
6bfd380 is described below
commit 6bfd380cb18d9b5a27f4466edad4226acce288a0
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Jul 8 11:49:48 2021 -0400
Use final.
---
.../java/org/apache/commons/csv/CSVParserTest.java | 38 +++++++++++-----------
.../commons/csv/ExtendedBufferedReaderTest.java | 2 +-
.../apache/commons/csv/issues/JiraCsv206Test.java | 2 +-
3 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/src/test/java/org/apache/commons/csv/CSVParserTest.java
b/src/test/java/org/apache/commons/csv/CSVParserTest.java
index 392d82e..7976ae8 100644
--- a/src/test/java/org/apache/commons/csv/CSVParserTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVParserTest.java
@@ -91,10 +91,10 @@ public class CSVParserTest {
@Test
public void testParseWithDelimiterWithQuote() throws IOException {
- String source = "'a,b,c',xyz";
- CSVFormat csvFormat = CSVFormat.DEFAULT.withQuote('\'');
+ final String source = "'a,b,c',xyz";
+ final CSVFormat csvFormat = CSVFormat.DEFAULT.withQuote('\'');
try (CSVParser csvParser = csvFormat.parse(new StringReader(source))) {
- CSVRecord csvRecord = csvParser.nextRecord();
+ final CSVRecord csvRecord = csvParser.nextRecord();
assertEquals("a,b,c", csvRecord.get(0));
assertEquals("xyz", csvRecord.get(1));
}
@@ -102,8 +102,8 @@ public class CSVParserTest {
@Test
public void testParseWithDelimiterStringWithQuote() throws IOException {
- String source = "'a[|]b[|]c'[|]xyz\r\nabc[abc][|]xyz";
- CSVFormat csvFormat =
CSVFormat.DEFAULT.builder().setDelimiter("[|]").setQuote('\'').build();
+ final String source = "'a[|]b[|]c'[|]xyz\r\nabc[abc][|]xyz";
+ final CSVFormat csvFormat =
CSVFormat.DEFAULT.builder().setDelimiter("[|]").setQuote('\'').build();
try (CSVParser csvParser = csvFormat.parse(new StringReader(source))) {
CSVRecord csvRecord = csvParser.nextRecord();
assertEquals("a[|]b[|]c", csvRecord.get(0));
@@ -116,10 +116,10 @@ public class CSVParserTest {
@Test
public void testParseWithDelimiterWithEscape() throws IOException {
- String source = "a!,b!,c,xyz";
- CSVFormat csvFormat = CSVFormat.DEFAULT.withEscape('!');
+ final String source = "a!,b!,c,xyz";
+ final CSVFormat csvFormat = CSVFormat.DEFAULT.withEscape('!');
try (CSVParser csvParser = csvFormat.parse(new StringReader(source))) {
- CSVRecord csvRecord = csvParser.nextRecord();
+ final CSVRecord csvRecord = csvParser.nextRecord();
assertEquals("a,b,c", csvRecord.get(0));
assertEquals("xyz", csvRecord.get(1));
}
@@ -127,8 +127,8 @@ public class CSVParserTest {
@Test
public void testParseWithDelimiterStringWithEscape() throws IOException {
- String source = "a![!|!]b![|]c[|]xyz\r\nabc[abc][|]xyz";
- CSVFormat csvFormat =
CSVFormat.DEFAULT.builder().setDelimiter("[|]").setEscape('!').build();
+ final String source = "a![!|!]b![|]c[|]xyz\r\nabc[abc][|]xyz";
+ final CSVFormat csvFormat =
CSVFormat.DEFAULT.builder().setDelimiter("[|]").setEscape('!').build();
try (CSVParser csvParser = csvFormat.parse(new StringReader(source))) {
CSVRecord csvRecord = csvParser.nextRecord();
assertEquals("a[|]b![|]c", csvRecord.get(0));
@@ -141,10 +141,10 @@ public class CSVParserTest {
@Test
public void testParseWithQuoteWithEscape() throws IOException {
- String source = "'a?,b?,c?d',xyz";
- CSVFormat csvFormat =
CSVFormat.DEFAULT.withQuote('\'').withEscape('?');
+ final String source = "'a?,b?,c?d',xyz";
+ final CSVFormat csvFormat =
CSVFormat.DEFAULT.withQuote('\'').withEscape('?');
try (CSVParser csvParser = csvFormat.parse(new StringReader(source))) {
- CSVRecord csvRecord = csvParser.nextRecord();
+ final CSVRecord csvRecord = csvParser.nextRecord();
assertEquals("a,b,c?d", csvRecord.get(0));
assertEquals("xyz", csvRecord.get(1));
}
@@ -152,7 +152,7 @@ public class CSVParserTest {
@Test
public void testParseWithQuoteThrowsException() {
- CSVFormat csvFormat = CSVFormat.DEFAULT.withQuote('\'');
+ final CSVFormat csvFormat = CSVFormat.DEFAULT.withQuote('\'');
assertThrows(IOException.class, () -> csvFormat.parse(new
StringReader("'a,b,c','")).nextRecord());
assertThrows(IOException.class, () -> csvFormat.parse(new
StringReader("'a,b,c'abc,xyz")).nextRecord());
assertThrows(IOException.class, () -> csvFormat.parse(new
StringReader("'abc'a,b,c',xyz")).nextRecord());
@@ -160,13 +160,13 @@ public class CSVParserTest {
@Test
public void testNotValueCSV() throws IOException {
- String source = "#";
- CSVFormat csvFormat = CSVFormat.DEFAULT.withCommentMarker('#');
- CSVParser csvParser = csvFormat.parse(new StringReader(source));
- CSVRecord csvRecord = csvParser.nextRecord();
+ final String source = "#";
+ final CSVFormat csvFormat = CSVFormat.DEFAULT.withCommentMarker('#');
+ final CSVParser csvParser = csvFormat.parse(new StringReader(source));
+ final CSVRecord csvRecord = csvParser.nextRecord();
assertNull(csvRecord);
}
-
+
@Test
public void testBackslashEscaping() throws IOException {
diff --git
a/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java
b/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java
index 8efe056..a6396ee 100644
--- a/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java
+++ b/src/test/java/org/apache/commons/csv/ExtendedBufferedReaderTest.java
@@ -87,7 +87,7 @@ public class ExtendedBufferedReaderTest {
@Test
public void testReadingInDifferentBuffer() throws Exception {
- char[] tmp1 = new char[2], tmp2 = new char[4];
+ final char[] tmp1 = new char[2], tmp2 = new char[4];
try (ExtendedBufferedReader reader =
createBufferedReader("1\r\n2\r\n")) {
reader.read(tmp1, 0, 2);
reader.read(tmp2, 2, 2);
diff --git a/src/test/java/org/apache/commons/csv/issues/JiraCsv206Test.java
b/src/test/java/org/apache/commons/csv/issues/JiraCsv206Test.java
index 57f1149..a4ebf45 100644
--- a/src/test/java/org/apache/commons/csv/issues/JiraCsv206Test.java
+++ b/src/test/java/org/apache/commons/csv/issues/JiraCsv206Test.java
@@ -38,7 +38,7 @@ public class JiraCsv206Test {
final CSVFormat csvFormat =
CSVFormat.DEFAULT.builder().setDelimiter("[|]").build();
CSVRecord record = null;
try (final CSVParser csvParser = new CSVParser(reader, csvFormat)) {
- Iterator<CSVRecord> iterator = csvParser.iterator();
+ final Iterator<CSVRecord> iterator = csvParser.iterator();
record = iterator.next();
assertEquals("FirstName", record.get(0));
assertEquals("LastName", record.get(1));