2727import org .junit .jupiter .params .provider .MethodSource ;
2828
2929/**
30- * Tests {@link CSVFormat}.
30+ * Tests parsing of duplicate column names in a CSV header.
31+ * The test verifies that headers are consistently handled by CSVFormat and CSVParser.
3132 */
3233public class CSVDuplicateHeaderTest {
3334 /**
3435 * Return test cases for duplicate header data. Uses the order:
3536 * <pre>
36- * DuplicateHeaderMode duolicateHeaderMode
37+ * DuplicateHeaderMode duplicateHeaderMode
3738 * boolean allowMissingColumnNames
3839 * String[] headers
3940 * boolean valid
@@ -98,24 +99,24 @@ static Stream<Arguments> duplicateHeaderData() {
9899 /**
99100 * Test duplicate headers with the CSVFormat.
100101 *
101- * @param duolicateHeaderMode the duolicate header mode
102+ * @param duplicateHeaderMode the duplicate header mode
102103 * @param allowMissingColumnNames the allow missing column names flag
103104 * @param headers the headers
104105 * @param valid true if the settings are expected to be valid
105106 */
106107 @ ParameterizedTest
107108 @ MethodSource (value = {"duplicateHeaderData" })
108- public void testCSVFormat (DuplicateHeaderMode duolicateHeaderMode ,
109+ public void testCSVFormat (DuplicateHeaderMode duplicateHeaderMode ,
109110 boolean allowMissingColumnNames ,
110111 String [] headers ,
111112 boolean valid ) {
112113 CSVFormat .Builder builder = CSVFormat .DEFAULT .builder ()
113- .setDuplicateHeaderMode (duolicateHeaderMode )
114+ .setDuplicateHeaderMode (duplicateHeaderMode )
114115 .setAllowMissingColumnNames (allowMissingColumnNames )
115116 .setHeader (headers );
116117 if (valid ) {
117118 CSVFormat format = builder .build ();
118- Assertions .assertEquals (duolicateHeaderMode , format .getDuplicateHeaderMode (), "DuplicateHeaderMode" );
119+ Assertions .assertEquals (duplicateHeaderMode , format .getDuplicateHeaderMode (), "DuplicateHeaderMode" );
119120 Assertions .assertEquals (allowMissingColumnNames , format .getAllowMissingColumnNames (), "AllowMissingColumnNames" );
120121 Assertions .assertArrayEquals (headers , format .getHeader (), "Header" );
121122 } else {
@@ -126,20 +127,20 @@ public void testCSVFormat(DuplicateHeaderMode duolicateHeaderMode,
126127 /**
127128 * Test duplicate headers with the CSVParser.
128129 *
129- * @param duolicateHeaderMode the duolicate header mode
130+ * @param duplicateHeaderMode the duplicate header mode
130131 * @param allowMissingColumnNames the allow missing column names flag
131132 * @param headers the headers (joined with the CSVFormat delimiter to create a string input)
132133 * @param valid true if the settings are expected to be valid
133134 * @throws IOException Signals that an I/O exception has occurred.
134135 */
135136 @ ParameterizedTest
136137 @ MethodSource (value = {"duplicateHeaderData" })
137- public void testCSVParser (DuplicateHeaderMode duolicateHeaderMode ,
138+ public void testCSVParser (DuplicateHeaderMode duplicateHeaderMode ,
138139 boolean allowMissingColumnNames ,
139140 String [] headers ,
140141 boolean valid ) throws IOException {
141142 CSVFormat format = CSVFormat .DEFAULT .builder ()
142- .setDuplicateHeaderMode (duolicateHeaderMode )
143+ .setDuplicateHeaderMode (duplicateHeaderMode )
143144 .setAllowMissingColumnNames (allowMissingColumnNames )
144145 .setHeader ()
145146 .build ();
0 commit comments