Test javadoc updates and typos

This commit is contained in:
Alex Herbert 2022-10-22 18:45:45 +01:00
parent 1c0a8f12e6
commit 4ddeddc2a1
1 changed files with 10 additions and 9 deletions

View File

@ -27,13 +27,14 @@ import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.MethodSource;
/** /**
* Tests {@link CSVFormat}. * Tests parsing of duplicate column names in a CSV header.
* The test verifies that headers are consistently handled by CSVFormat and CSVParser.
*/ */
public class CSVDuplicateHeaderTest { public class CSVDuplicateHeaderTest {
/** /**
* Return test cases for duplicate header data. Uses the order: * Return test cases for duplicate header data. Uses the order:
* <pre> * <pre>
* DuplicateHeaderMode duolicateHeaderMode * DuplicateHeaderMode duplicateHeaderMode
* boolean allowMissingColumnNames * boolean allowMissingColumnNames
* String[] headers * String[] headers
* boolean valid * boolean valid
@ -98,24 +99,24 @@ public class CSVDuplicateHeaderTest {
/** /**
* Test duplicate headers with the CSVFormat. * Test duplicate headers with the CSVFormat.
* *
* @param duolicateHeaderMode the duolicate header mode * @param duplicateHeaderMode the duplicate header mode
* @param allowMissingColumnNames the allow missing column names flag * @param allowMissingColumnNames the allow missing column names flag
* @param headers the headers * @param headers the headers
* @param valid true if the settings are expected to be valid * @param valid true if the settings are expected to be valid
*/ */
@ParameterizedTest @ParameterizedTest
@MethodSource(value = {"duplicateHeaderData"}) @MethodSource(value = {"duplicateHeaderData"})
public void testCSVFormat(DuplicateHeaderMode duolicateHeaderMode, public void testCSVFormat(DuplicateHeaderMode duplicateHeaderMode,
boolean allowMissingColumnNames, boolean allowMissingColumnNames,
String[] headers, String[] headers,
boolean valid) { boolean valid) {
CSVFormat.Builder builder = CSVFormat.DEFAULT.builder() CSVFormat.Builder builder = CSVFormat.DEFAULT.builder()
.setDuplicateHeaderMode(duolicateHeaderMode) .setDuplicateHeaderMode(duplicateHeaderMode)
.setAllowMissingColumnNames(allowMissingColumnNames) .setAllowMissingColumnNames(allowMissingColumnNames)
.setHeader(headers); .setHeader(headers);
if (valid) { if (valid) {
CSVFormat format = builder.build(); CSVFormat format = builder.build();
Assertions.assertEquals(duolicateHeaderMode, format.getDuplicateHeaderMode(), "DuplicateHeaderMode"); Assertions.assertEquals(duplicateHeaderMode, format.getDuplicateHeaderMode(), "DuplicateHeaderMode");
Assertions.assertEquals(allowMissingColumnNames, format.getAllowMissingColumnNames(), "AllowMissingColumnNames"); Assertions.assertEquals(allowMissingColumnNames, format.getAllowMissingColumnNames(), "AllowMissingColumnNames");
Assertions.assertArrayEquals(headers, format.getHeader(), "Header"); Assertions.assertArrayEquals(headers, format.getHeader(), "Header");
} else { } else {
@ -126,7 +127,7 @@ public class CSVDuplicateHeaderTest {
/** /**
* Test duplicate headers with the CSVParser. * Test duplicate headers with the CSVParser.
* *
* @param duolicateHeaderMode the duolicate header mode * @param duplicateHeaderMode the duplicate header mode
* @param allowMissingColumnNames the allow missing column names flag * @param allowMissingColumnNames the allow missing column names flag
* @param headers the headers (joined with the CSVFormat delimiter to create a string input) * @param headers the headers (joined with the CSVFormat delimiter to create a string input)
* @param valid true if the settings are expected to be valid * @param valid true if the settings are expected to be valid
@ -134,12 +135,12 @@ public class CSVDuplicateHeaderTest {
*/ */
@ParameterizedTest @ParameterizedTest
@MethodSource(value = {"duplicateHeaderData"}) @MethodSource(value = {"duplicateHeaderData"})
public void testCSVParser(DuplicateHeaderMode duolicateHeaderMode, public void testCSVParser(DuplicateHeaderMode duplicateHeaderMode,
boolean allowMissingColumnNames, boolean allowMissingColumnNames,
String[] headers, String[] headers,
boolean valid) throws IOException { boolean valid) throws IOException {
CSVFormat format = CSVFormat.DEFAULT.builder() CSVFormat format = CSVFormat.DEFAULT.builder()
.setDuplicateHeaderMode(duolicateHeaderMode) .setDuplicateHeaderMode(duplicateHeaderMode)
.setAllowMissingColumnNames(allowMissingColumnNames) .setAllowMissingColumnNames(allowMissingColumnNames)
.setHeader() .setHeader()
.build(); .build();