You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2016/04/18 03:00:22 UTC

svn commit: r1739671 - in /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv: CSVPrinterTest.java JiraCsv167Test.java

Author: ggregory
Date: Mon Apr 18 01:00:22 2016
New Revision: 1739671

URL: http://svn.apache.org/viewvc?rev=1739671&view=rev
Log:
Use final.

Modified:
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/JiraCsv167Test.java

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java?rev=1739671&r1=1739670&r2=1739671&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Mon Apr 18 01:00:22 2016
@@ -89,7 +89,7 @@ public class CSVPrinterTest {
         final CSVParser parser = CSVParser.parse(result, format);
         final List<CSVRecord> parseResult = parser.getRecords();
 
-        String[][] expected = lines.clone();
+        final String[][] expected = lines.clone();
         for (int i = 0; i < expected.length; i++) {
             expected[i] = expectNulls(expected[i], format);
         }
@@ -236,10 +236,10 @@ public class CSVPrinterTest {
     @Test
     @Ignore
     public void testJira135All() throws IOException {
-        CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, format);
-        List<String> list = new LinkedList<String>();
+        final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, format);
+        final List<String> list = new LinkedList<String>();
         list.add("\"");
         list.add("\n");
         list.add("\\");
@@ -247,55 +247,55 @@ public class CSVPrinterTest {
         printer.close();
         final String expected = "\"\\\"\",\"\\n\",\"\\\"" + format.getRecordSeparator();
         assertEquals(expected, sw.toString());
-        String[] record0 = toFirstRecordValues(expected, format);
+        final String[] record0 = toFirstRecordValues(expected, format);
         assertArrayEquals(expectNulls(list.toArray(), format), record0);
     }
     
     @Test
     @Ignore
     public void testJira135_part3() throws IOException {
-        CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, format);
-        List<String> list = new LinkedList<String>();
+        final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, format);
+        final List<String> list = new LinkedList<String>();
         list.add("\\");
         printer.printRecord(list);
         printer.close();
         final String expected = "\"\\\\\"" + format.getRecordSeparator();
         assertEquals(expected, sw.toString());
-        String[] record0 = toFirstRecordValues(expected, format);
+        final String[] record0 = toFirstRecordValues(expected, format);
         assertArrayEquals(expectNulls(list.toArray(), format), record0);
     }
     
     @Test
     @Ignore
     public void testJira135_part2() throws IOException {
-        CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, format);
-        List<String> list = new LinkedList<String>();
+        final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, format);
+        final List<String> list = new LinkedList<String>();
         list.add("\n");
         printer.printRecord(list);
         printer.close();
         final String expected = "\"\\n\"" + format.getRecordSeparator();
         assertEquals(expected, sw.toString());
-        String[] record0 = toFirstRecordValues(expected, format);
+        final String[] record0 = toFirstRecordValues(expected, format);
         assertArrayEquals(expectNulls(list.toArray(), format), record0);
     }
     
     @Test
     @Ignore
     public void testJira135_part1() throws IOException {
-        CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
-        StringWriter sw = new StringWriter();
-        CSVPrinter printer = new CSVPrinter(sw, format);
-        List<String> list = new LinkedList<String>();
+        final CSVFormat format = CSVFormat.DEFAULT.withRecordSeparator('\n').withQuote('"').withEscape('\\');
+        final StringWriter sw = new StringWriter();
+        final CSVPrinter printer = new CSVPrinter(sw, format);
+        final List<String> list = new LinkedList<String>();
         list.add("\"");
         printer.printRecord(list);
         printer.close();
         final String expected = "\"\\\"\"" + format.getRecordSeparator();
         assertEquals(expected, sw.toString());
-        String[] record0 = toFirstRecordValues(expected, format);
+        final String[] record0 = toFirstRecordValues(expected, format);
         assertArrayEquals(expectNulls(list.toArray(), format), record0);
     }
     
@@ -493,8 +493,8 @@ public class CSVPrinterTest {
      * Converts an input CSV array into expected output values WRT NULLs. NULL strings are converted to null values
      * because the parser will convert these strings to null.
      */
-    private <T> T[] expectNulls(T[] original, CSVFormat csvFormat) {
-        T[] fixed = original.clone();
+    private <T> T[] expectNulls(final T[] original, final CSVFormat csvFormat) {
+        final T[] fixed = original.clone();
         for (int i = 0; i < fixed.length; i++) {
             if (ObjectUtils.equals(csvFormat.getNullString(), fixed[i])) {
                 fixed[i] = null;
@@ -503,7 +503,7 @@ public class CSVPrinterTest {
         return fixed;
     }
 
-    private String[] toFirstRecordValues(final String expected, CSVFormat format) throws IOException {
+    private String[] toFirstRecordValues(final String expected, final CSVFormat format) throws IOException {
         return CSVParser.parse(expected, format).getRecords().get(0).values();
     }
 

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/JiraCsv167Test.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/JiraCsv167Test.java?rev=1739671&r1=1739670&r2=1739671&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/JiraCsv167Test.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/JiraCsv167Test.java Mon Apr 18 01:00:22 2016
@@ -30,7 +30,7 @@ public class JiraCsv167Test {
     @Test
     public void parse() throws IOException {
         final File csvData = new File("src/test/resources/csv-167/sample1.csv");
-        BufferedReader br = new BufferedReader(new FileReader(csvData));
+        final BufferedReader br = new BufferedReader(new FileReader(csvData));
         String s = null;
         int totcomment = 0;
         int totrecs = 0;