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 2019/12/18 21:04:07 UTC

[commons-csv] branch master updated (7cc7b59 -> 5e9216d)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git.


    from 7cc7b59  Update tests from Mockito 3.1.0 to 3.2.0.
     new 06dda31  Remove trailing white spaces on all lines.
     new 5e9216d  Remove unnecessary array creation for varargs.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/main/java/org/apache/commons/csv/CSVFormat.java        |  2 +-
 src/test/java/org/apache/commons/csv/CSVFormatTest.java    |  6 +++---
 src/test/java/org/apache/commons/csv/CSVParserTest.java    |  4 ++--
 src/test/java/org/apache/commons/csv/PerformanceTest.java  |  5 ++---
 .../java/org/apache/commons/csv/issues/JiraCsv203Test.java | 14 +++++++-------
 5 files changed, 15 insertions(+), 16 deletions(-)


[commons-csv] 01/02: Remove trailing white spaces on all lines.

Posted by gg...@apache.org.
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

commit 06dda31f5218c138c2eafbe27f154d2faa79b507
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Dec 18 15:29:20 2019 -0500

    Remove trailing white spaces on all lines.
---
 src/main/java/org/apache/commons/csv/CSVFormat.java     | 2 +-
 src/test/java/org/apache/commons/csv/CSVFormatTest.java | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java
index b7cf1ba..0742c93 100644
--- a/src/main/java/org/apache/commons/csv/CSVFormat.java
+++ b/src/main/java/org/apache/commons/csv/CSVFormat.java
@@ -1598,7 +1598,7 @@ public final class CSVFormat implements Serializable {
         }
         if (quoteMode != null) {
             sb.append(' ');
-            sb.append("QuoteMode=<").append(quoteMode).append('>');            
+            sb.append("QuoteMode=<").append(quoteMode).append('>');
         }
         if (isCommentMarkerSet()) {
             sb.append(' ');
diff --git a/src/test/java/org/apache/commons/csv/CSVFormatTest.java b/src/test/java/org/apache/commons/csv/CSVFormatTest.java
index 0147867..c7f9885 100644
--- a/src/test/java/org/apache/commons/csv/CSVFormatTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVFormatTest.java
@@ -69,7 +69,7 @@ public class CSVFormatTest {
             fail("Objects must not compare equal for " + name + "(" + type + ")");
         }
         if (left.hashCode() == right.hashCode()) {
-            fail("Hash code should not be equal for " + name + "(" + type + ")");            
+            fail("Hash code should not be equal for " + name + "(" + type + ")");
         }
     }
 
@@ -196,7 +196,7 @@ public class CSVFormatTest {
                    }
                }
             }
-         }   
+         }
     }
 
     @Test
@@ -1174,5 +1174,5 @@ public class CSVFormatTest {
         final CSVFormat formatWithRecordSeparator = CSVFormat.DEFAULT.withSystemRecordSeparator();
         assertEquals(System.getProperty("line.separator"), formatWithRecordSeparator.getRecordSeparator());
     }
-    
+
 }


[commons-csv] 02/02: Remove unnecessary array creation for varargs.

Posted by gg...@apache.org.
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

commit 5e9216d331d0c8c49d505370f90e3d29722df577
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Dec 18 16:04:03 2019 -0500

    Remove unnecessary array creation for varargs.
---
 src/test/java/org/apache/commons/csv/CSVParserTest.java    |  4 ++--
 src/test/java/org/apache/commons/csv/PerformanceTest.java  |  5 ++---
 .../java/org/apache/commons/csv/issues/JiraCsv203Test.java | 14 +++++++-------
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/test/java/org/apache/commons/csv/CSVParserTest.java b/src/test/java/org/apache/commons/csv/CSVParserTest.java
index 310574a..0d8dd31 100644
--- a/src/test/java/org/apache/commons/csv/CSVParserTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVParserTest.java
@@ -296,12 +296,12 @@ public class CSVParserTest {
         assertThrows(
                 IllegalArgumentException.class,
                 () -> CSVParser.parse("a,b,a\n1,2,3\nx,y,z",
-                        CSVFormat.DEFAULT.withHeader(new String[] {}).withAllowDuplicateHeaderNames(false)));
+                        CSVFormat.DEFAULT.withHeader().withAllowDuplicateHeaderNames(false)));
     }
 
     @Test
     public void testDuplicateHeadersAllowedByDefault() throws Exception {
-        CSVParser.parse("a,b,a\n1,2,3\nx,y,z", CSVFormat.DEFAULT.withHeader(new String[] {}));
+        CSVParser.parse("a,b,a\n1,2,3\nx,y,z", CSVFormat.DEFAULT.withHeader());
     }
 
     @Test
diff --git a/src/test/java/org/apache/commons/csv/PerformanceTest.java b/src/test/java/org/apache/commons/csv/PerformanceTest.java
index 0f1bb2c..1f7884f 100644
--- a/src/test/java/org/apache/commons/csv/PerformanceTest.java
+++ b/src/test/java/org/apache/commons/csv/PerformanceTest.java
@@ -264,7 +264,7 @@ public class PerformanceTest {
     private static Constructor<Lexer> getLexerCtor(final String clazz) throws Exception {
         @SuppressWarnings("unchecked")
         final Class<Lexer> lexer = (Class<Lexer>) Class.forName("org.apache.commons.csv." + clazz);
-        return lexer.getConstructor(new Class<?>[]{CSVFormat.class, ExtendedBufferedReader.class});
+        return lexer.getConstructor(CSVFormat.class, ExtendedBufferedReader.class);
     }
 
     private static void testCSVLexer(final boolean newToken, final String test) throws Exception {
@@ -317,8 +317,7 @@ public class PerformanceTest {
 
     private static Lexer createTestCSVLexer(final String test, final ExtendedBufferedReader input)
             throws InstantiationException, IllegalAccessException, InvocationTargetException, Exception {
-        return test.startsWith("CSVLexer") ? getLexerCtor(test)
-                .newInstance(new Object[] { format, input }) : new Lexer(format, input);
+        return test.startsWith("CSVLexer") ? getLexerCtor(test).newInstance(format, input) : new Lexer(format, input);
     }
 
     private static Stats iterate(final Iterable<CSVRecord> it) {
diff --git a/src/test/java/org/apache/commons/csv/issues/JiraCsv203Test.java b/src/test/java/org/apache/commons/csv/issues/JiraCsv203Test.java
index bb11625..9c887bd 100644
--- a/src/test/java/org/apache/commons/csv/issues/JiraCsv203Test.java
+++ b/src/test/java/org/apache/commons/csv/issues/JiraCsv203Test.java
@@ -37,7 +37,7 @@ public class JiraCsv203Test {
 
         final StringBuffer buffer = new StringBuffer();
         try (final CSVPrinter printer = new CSVPrinter(buffer, format)) {
-            printer.printRecord(new Object[] { null, "Hello", null, "World" });
+            printer.printRecord(null, "Hello", null, "World");
         }
         assertEquals("\"N/A\",\"Hello\",\"N/A\",\"World\"\r\n", buffer.toString());
     }
@@ -51,7 +51,7 @@ public class JiraCsv203Test {
 
         final StringBuffer buffer = new StringBuffer();
         try (final CSVPrinter printer = new CSVPrinter(buffer, format)) {
-            printer.printRecord(new Object[] { null, "Hello", null, "World" });
+            printer.printRecord(null, "Hello", null, "World");
         }
         assertEquals("N/A,\"Hello\",N/A,\"World\"\r\n", buffer.toString());
     }
@@ -64,7 +64,7 @@ public class JiraCsv203Test {
 
         final StringBuffer buffer = new StringBuffer();
         try (final CSVPrinter printer = new CSVPrinter(buffer, format)) {
-            printer.printRecord(new Object[] { null, "Hello", null, "World" });
+            printer.printRecord(null, "Hello", null, "World");
         }
         assertEquals("N/A,Hello,N/A,World\r\n", buffer.toString());
     }
@@ -78,7 +78,7 @@ public class JiraCsv203Test {
 
         final StringBuffer buffer = new StringBuffer();
         try (final CSVPrinter printer = new CSVPrinter(buffer, format)) {
-            printer.printRecord(new Object[] { null, "Hello", null, "World" });
+            printer.printRecord(null, "Hello", null, "World");
         }
         assertEquals("N/A,Hello,N/A,World\r\n", buffer.toString());
     }
@@ -92,7 +92,7 @@ public class JiraCsv203Test {
 
         final StringBuffer buffer = new StringBuffer();
         try (final CSVPrinter printer = new CSVPrinter(buffer, format)) {
-            printer.printRecord(new Object[] { null, "Hello", null, "World" });
+            printer.printRecord(null, "Hello", null, "World");
         }
         assertEquals("N/A,\"Hello\",N/A,\"World\"\r\n", buffer.toString());
     }
@@ -106,7 +106,7 @@ public class JiraCsv203Test {
 
         final StringBuffer buffer = new StringBuffer();
         try (final CSVPrinter printer = new CSVPrinter(buffer, format)) {
-            printer.printRecord(new Object[] { null, "Hello", null, "World" });
+            printer.printRecord(null, "Hello", null, "World");
         }
         assertEquals(",\"Hello\",,\"World\"\r\n", buffer.toString());
     }
@@ -120,7 +120,7 @@ public class JiraCsv203Test {
 
         final StringBuffer buffer = new StringBuffer();
         try (final CSVPrinter printer = new CSVPrinter(buffer, format)) {
-            printer.printRecord(new Object[] { "", "Hello", "", "World" });
+            printer.printRecord("", "Hello", "", "World");
             //printer.printRecord(new Object[] { null, "Hello", null, "World" });
         }
         assertEquals("\"\",\"Hello\",\"\",\"World\"\r\n", buffer.toString());