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 2023/01/28 17:24:02 UTC

[commons-csv] branch master updated (347c8723 -> c69016a2)

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 347c8723 Port some code from IO to NIO APIs
     new f00b91b5 Add assert as sanity check
     new c69016a2 Sort members

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/IOUtils.java  | 10 ++--
 .../apache/commons/csv/CSVDuplicateHeaderTest.java | 68 +++++++++++-----------
 .../apache/commons/csv/issues/JiraCsv149Test.java  |  2 +
 3 files changed, 41 insertions(+), 39 deletions(-)


[commons-csv] 01/02: Add assert as sanity check

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 f00b91b58937104bf1b17799f9660d26ffdff65f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jan 28 12:19:41 2023 -0500

    Add assert as sanity check
---
 src/test/java/org/apache/commons/csv/issues/JiraCsv149Test.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/test/java/org/apache/commons/csv/issues/JiraCsv149Test.java b/src/test/java/org/apache/commons/csv/issues/JiraCsv149Test.java
index a42cb2a3..70f8c5ea 100644
--- a/src/test/java/org/apache/commons/csv/issues/JiraCsv149Test.java
+++ b/src/test/java/org/apache/commons/csv/issues/JiraCsv149Test.java
@@ -17,6 +17,7 @@
 package org.apache.commons.csv.issues;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 import java.io.IOException;
 import java.io.StringReader;
@@ -51,6 +52,7 @@ public class JiraCsv149Test {
         int lineCounter = 2;
         try (final CSVParser parser = new CSVParser(records, format)) {
             for (final CSVRecord record : parser) {
+                assertNotNull(record);
                 assertEquals(lineCounter++, parser.getCurrentLineNumber());
             }
         }


[commons-csv] 02/02: Sort members

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 c69016a2a6706da224c8a1d935f8837d593739fd
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jan 28 12:19:53 2023 -0500

    Sort members
---
 src/main/java/org/apache/commons/csv/IOUtils.java  | 10 ++--
 .../apache/commons/csv/CSVDuplicateHeaderTest.java | 68 +++++++++++-----------
 2 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/src/main/java/org/apache/commons/csv/IOUtils.java b/src/main/java/org/apache/commons/csv/IOUtils.java
index c4baeb47..4fb7120f 100644
--- a/src/main/java/org/apache/commons/csv/IOUtils.java
+++ b/src/main/java/org/apache/commons/csv/IOUtils.java
@@ -126,11 +126,6 @@ final class IOUtils {
         return count;
     }
 
-    /** No instances. */
-    private IOUtils() {
-        // Noop
-    }
-
     /**
      * Throws the given throwable.
      *
@@ -144,4 +139,9 @@ final class IOUtils {
         throw (T) throwable;
     }
 
+    /** No instances. */
+    private IOUtils() {
+        // Noop
+    }
+
 }
diff --git a/src/test/java/org/apache/commons/csv/CSVDuplicateHeaderTest.java b/src/test/java/org/apache/commons/csv/CSVDuplicateHeaderTest.java
index c195a1b4..9eae51b0 100644
--- a/src/test/java/org/apache/commons/csv/CSVDuplicateHeaderTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVDuplicateHeaderTest.java
@@ -34,6 +34,40 @@ import org.junit.jupiter.params.provider.MethodSource;
  */
 public class CSVDuplicateHeaderTest {
 
+    /**
+     * Return test cases for duplicate header data for use in CSVFormat.
+     * <p>
+     * This filters the parsing test data to all cases where the allow missing column
+     * names flag is true and ignore header case is false: these flags are exclusively for parsing.
+     * CSVFormat validation applies to both parsing and writing and thus validation
+     * is less strict and behaves as if the allow missing column names constraint and
+     * the ignore header case behavior are absent.
+     * The filtered data is then returned with the parser flags set to both true and false
+     * for each test case.
+     * </p>
+     *
+     * @return the stream of arguments
+     */
+    static Stream<Arguments> duplicateHeaderAllowsMissingColumnsNamesData() {
+        return duplicateHeaderData()
+            .filter(arg -> Boolean.TRUE.equals(arg.get()[1]) && Boolean.FALSE.equals(arg.get()[2]))
+            .flatMap(arg -> {
+                // Return test case with flags as all true/false combinations
+                final Object[][] data = new Object[4][];
+                final Boolean[] flags = {Boolean.TRUE, Boolean.FALSE};
+                int i = 0;
+                for (final Boolean a : flags) {
+                    for (final Boolean b : flags) {
+                        data[i] = arg.get().clone();
+                        data[i][1] = a;
+                        data[i][2] = b;
+                        i++;
+                    }
+                }
+                return Arrays.stream(data).map(Arguments::of);
+            });
+    }
+
     /**
      * Return test cases for duplicate header data for use in parsing (CSVParser). Uses the order:
      * <pre>
@@ -225,40 +259,6 @@ public class CSVDuplicateHeaderTest {
         );
     }
 
-    /**
-     * Return test cases for duplicate header data for use in CSVFormat.
-     * <p>
-     * This filters the parsing test data to all cases where the allow missing column
-     * names flag is true and ignore header case is false: these flags are exclusively for parsing.
-     * CSVFormat validation applies to both parsing and writing and thus validation
-     * is less strict and behaves as if the allow missing column names constraint and
-     * the ignore header case behavior are absent.
-     * The filtered data is then returned with the parser flags set to both true and false
-     * for each test case.
-     * </p>
-     *
-     * @return the stream of arguments
-     */
-    static Stream<Arguments> duplicateHeaderAllowsMissingColumnsNamesData() {
-        return duplicateHeaderData()
-            .filter(arg -> Boolean.TRUE.equals(arg.get()[1]) && Boolean.FALSE.equals(arg.get()[2]))
-            .flatMap(arg -> {
-                // Return test case with flags as all true/false combinations
-                final Object[][] data = new Object[4][];
-                final Boolean[] flags = {Boolean.TRUE, Boolean.FALSE};
-                int i = 0;
-                for (final Boolean a : flags) {
-                    for (final Boolean b : flags) {
-                        data[i] = arg.get().clone();
-                        data[i][1] = a;
-                        data[i][2] = b;
-                        i++;
-                    }
-                }
-                return Arrays.stream(data).map(Arguments::of);
-            });
-    }
-
     /**
      * Tests duplicate headers with the CSVFormat.
      *