Skip to content
This repository was archived by the owner on Jun 3, 2026. It is now read-only.

Commit d19e44c

Browse files
committed
Fill in the test coverage for getAllowDuplicateHeaderNames() to reflect
the _current_ behavior, right or wrong.
1 parent 4e4f270 commit d19e44c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/test/java/org/apache/commons/csv/CSVFormatTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import java.util.Arrays;
4646
import java.util.Objects;
4747

48+
import org.apache.commons.csv.CSVFormat.Builder;
4849
import org.junit.jupiter.api.Assertions;
4950
import org.junit.jupiter.api.Test;
5051

@@ -1168,6 +1169,15 @@ public void testWithEmptyDuplicates() {
11681169
assertFalse(formatWithEmptyDuplicates.getAllowDuplicateHeaderNames());
11691170
}
11701171

1172+
@Test
1173+
public void testGetAllowDuplicateHeaderNames() {
1174+
final Builder builder = CSVFormat.DEFAULT.builder();
1175+
assertTrue(builder.build().getAllowDuplicateHeaderNames());
1176+
assertTrue(builder.setDuplicateHeaderMode(DuplicateHeaderMode.ALLOW_ALL).build().getAllowDuplicateHeaderNames());
1177+
assertFalse(builder.setDuplicateHeaderMode(DuplicateHeaderMode.ALLOW_EMPTY).build().getAllowDuplicateHeaderNames());
1178+
assertFalse(builder.setDuplicateHeaderMode(DuplicateHeaderMode.DISALLOW).build().getAllowDuplicateHeaderNames());
1179+
}
1180+
11711181
@Test
11721182
public void testWithEmptyEnum() {
11731183
final CSVFormat formatWithHeader = CSVFormat.DEFAULT.withHeader(EmptyEnum.class);

0 commit comments

Comments
 (0)