|
34 | 34 | */
|
35 | 35 | public class CSVDuplicateHeaderTest {
|
36 | 36 |
|
| 37 | + /** |
| 38 | + * Return test cases for duplicate header data for use in CSVFormat. |
| 39 | + * <p> |
| 40 | + * This filters the parsing test data to all cases where the allow missing column |
| 41 | + * names flag is true and ignore header case is false: these flags are exclusively for parsing. |
| 42 | + * CSVFormat validation applies to both parsing and writing and thus validation |
| 43 | + * is less strict and behaves as if the allow missing column names constraint and |
| 44 | + * the ignore header case behavior are absent. |
| 45 | + * The filtered data is then returned with the parser flags set to both true and false |
| 46 | + * for each test case. |
| 47 | + * </p> |
| 48 | + * |
| 49 | + * @return the stream of arguments |
| 50 | + */ |
| 51 | + static Stream<Arguments> duplicateHeaderAllowsMissingColumnsNamesData() { |
| 52 | + return duplicateHeaderData() |
| 53 | + .filter(arg -> Boolean.TRUE.equals(arg.get()[1]) && Boolean.FALSE.equals(arg.get()[2])) |
| 54 | + .flatMap(arg -> { |
| 55 | + // Return test case with flags as all true/false combinations |
| 56 | + final Object[][] data = new Object[4][]; |
| 57 | + final Boolean[] flags = {Boolean.TRUE, Boolean.FALSE}; |
| 58 | + int i = 0; |
| 59 | + for (final Boolean a : flags) { |
| 60 | + for (final Boolean b : flags) { |
| 61 | + data[i] = arg.get().clone(); |
| 62 | + data[i][1] = a; |
| 63 | + data[i][2] = b; |
| 64 | + i++; |
| 65 | + } |
| 66 | + } |
| 67 | + return Arrays.stream(data).map(Arguments::of); |
| 68 | + }); |
| 69 | + } |
| 70 | + |
37 | 71 | /**
|
38 | 72 | * Return test cases for duplicate header data for use in parsing (CSVParser). Uses the order:
|
39 | 73 | * <pre>
|
@@ -225,40 +259,6 @@ static Stream<Arguments> duplicateHeaderData() {
|
225 | 259 | );
|
226 | 260 | }
|
227 | 261 |
|
228 |
| - /** |
229 |
| - * Return test cases for duplicate header data for use in CSVFormat. |
230 |
| - * <p> |
231 |
| - * This filters the parsing test data to all cases where the allow missing column |
232 |
| - * names flag is true and ignore header case is false: these flags are exclusively for parsing. |
233 |
| - * CSVFormat validation applies to both parsing and writing and thus validation |
234 |
| - * is less strict and behaves as if the allow missing column names constraint and |
235 |
| - * the ignore header case behavior are absent. |
236 |
| - * The filtered data is then returned with the parser flags set to both true and false |
237 |
| - * for each test case. |
238 |
| - * </p> |
239 |
| - * |
240 |
| - * @return the stream of arguments |
241 |
| - */ |
242 |
| - static Stream<Arguments> duplicateHeaderAllowsMissingColumnsNamesData() { |
243 |
| - return duplicateHeaderData() |
244 |
| - .filter(arg -> Boolean.TRUE.equals(arg.get()[1]) && Boolean.FALSE.equals(arg.get()[2])) |
245 |
| - .flatMap(arg -> { |
246 |
| - // Return test case with flags as all true/false combinations |
247 |
| - final Object[][] data = new Object[4][]; |
248 |
| - final Boolean[] flags = {Boolean.TRUE, Boolean.FALSE}; |
249 |
| - int i = 0; |
250 |
| - for (final Boolean a : flags) { |
251 |
| - for (final Boolean b : flags) { |
252 |
| - data[i] = arg.get().clone(); |
253 |
| - data[i][1] = a; |
254 |
| - data[i][2] = b; |
255 |
| - i++; |
256 |
| - } |
257 |
| - } |
258 |
| - return Arrays.stream(data).map(Arguments::of); |
259 |
| - }); |
260 |
| - } |
261 |
| - |
262 | 262 | /**
|
263 | 263 | * Tests duplicate headers with the CSVFormat.
|
264 | 264 | *
|
|
0 commit comments