From c69016a2a6706da224c8a1d935f8837d593739fd Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sat, 28 Jan 2023 12:19:53 -0500 Subject: [PATCH] Sort members --- .../java/org/apache/commons/csv/IOUtils.java | 10 +-- .../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 c4baeb4703..4fb7120f30 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 @@ static long copyLarge(final Reader input, final Writer output, final char[] buff return count; } - /** No instances. */ - private IOUtils() { - // Noop - } - /** * Throws the given throwable. * @@ -144,4 +139,9 @@ static RuntimeException rethrow(final Throwable throwable) 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 c195a1b484..9eae51b055 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 @@ */ public class CSVDuplicateHeaderTest { + /** + * Return test cases for duplicate header data for use in CSVFormat. + *

+ * 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. + *

+ * + * @return the stream of arguments + */ + static Stream 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: *
@@ -225,40 +259,6 @@ static Stream duplicateHeaderData() {
         );
     }
 
-    /**
-     * Return test cases for duplicate header data for use in CSVFormat.
-     * 

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

- * - * @return the stream of arguments - */ - static Stream 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. *