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 <garydgreg...@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. *