From 4083b7a2a0e7c2fa952b034614224fe6dc786b34 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Thu, 8 Jul 2021 12:11:04 -0400 Subject: [PATCH] Use final. --- .../org/apache/commons/csv/CSVPrinterTest.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java index 48465328..780a5021 100644 --- a/src/test/java/org/apache/commons/csv/CSVPrinterTest.java +++ b/src/test/java/org/apache/commons/csv/CSVPrinterTest.java @@ -90,7 +90,7 @@ public class CSVPrinterTest { private String longText2; private final String recordSeparator = CSVFormat.DEFAULT.getRecordSeparator(); - + private void doOneRandom(final CSVFormat format) throws Exception { final Random r = new Random(); @@ -164,7 +164,7 @@ public class CSVPrinterTest { throws IOException { // Use withHeaderComments first to test CSV-145 // @formatter:off - CSVFormat format = baseFormat.builder() + final CSVFormat format = baseFormat.builder() .setHeaderComments("Generated by Apache Commons CSV 1.1", now) .setCommentMarker('#') .setHeader("Col1", "Col2") @@ -1270,8 +1270,8 @@ public class CSVPrinterTest { + "a4,b4\n"// 4) ; final String[][] res = {{"a1", "b1"}, {"a2", "b2"}, {"a3", "b3"}, {"a4", "b4"}}; - CSVFormat format = CSVFormat.DEFAULT; - StringWriter sw = new StringWriter(); + final CSVFormat format = CSVFormat.DEFAULT; + final StringWriter sw = new StringWriter(); try (final CSVPrinter printer = format.print(sw); final CSVParser parser = CSVParser.parse(code, format)) { printer.printRecords(parser); } @@ -1290,10 +1290,10 @@ public class CSVPrinterTest { + "a4,b4\n"// 4) ; final String[][] res = {{"a1", "b1"}, {"a2", "b2"}, {"a3", "b3"}, {"a4", "b4"}}; - CSVFormat format = CSVFormat.DEFAULT; - StringWriter sw = new StringWriter(); + final CSVFormat format = CSVFormat.DEFAULT; + final StringWriter sw = new StringWriter(); try (final CSVPrinter printer = format.print(sw); final CSVParser parser = CSVParser.parse(code, format)) { - for (CSVRecord record : parser) { + for (final CSVRecord record : parser) { printer.printRecord(record); } } @@ -1312,8 +1312,8 @@ public class CSVPrinterTest { + "a4,b4\n"// 4) ; final String[][] res = {{"a1", "b1"}, {"a2", "b2"}, {"a3", "b3"}, {"a4", "b4"}}; - CSVFormat format = CSVFormat.DEFAULT; - StringWriter sw = new StringWriter(); + final CSVFormat format = CSVFormat.DEFAULT; + final StringWriter sw = new StringWriter(); try (final CSVPrinter printer = format.print(sw); final CSVParser parser = CSVParser.parse(code, format)) { printer.printRecords(parser.getRecords()); }