Skip to content

Commit 42b9fdb

Browse files
committed
CSV-244 Test case failures following CSVFormat#equals() update
1 parent 0279bea commit 42b9fdb

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
</properties>
4040
<body>
4141
<release version="1.8" date="2019-MM-DD" description="Feature and bug fix release (Java 8)">
42+
<action issue="CSV-244" type="fix" dev="sebb">Test case failures following CSVFormat#equals() update.</action>
4243
<action issue="CSV-243" type="fix" dev="sebb">CSVFormat withTrim() and withIgnoreSurroundingSpaces() need better docs.</action>
4344
<action issue="CSV-242" type="fix" dev="sebb">CSVFormat equals() and hashCode() don't use all fields.</action>
4445
<action issue="CSV-241" type="fix" dev="ggregory" due-to="LuckyIlam, Gary Gregory">CSVFormat#valiadte() does not account for allowDuplicateHeaderNames #43.</action>

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -517,10 +517,11 @@ public void testHashCodeAndWithIgnoreHeaderCase() {
517517
final CSVFormat csvFormatTwo = csvFormat.withIgnoreHeaderCase();
518518
csvFormatTwo.hashCode();
519519

520-
assertTrue(csvFormatTwo.getIgnoreHeaderCase());
520+
assertFalse(csvFormat.getIgnoreHeaderCase());
521+
assertTrue(csvFormatTwo.getIgnoreHeaderCase()); // now different
521522
assertFalse(csvFormatTwo.getTrailingDelimiter());
522523

523-
assertTrue(csvFormatTwo.equals(csvFormat)); // TODO this fails since CSV-242 was applied. Why should they compare equal?
524+
assertFalse(csvFormatTwo.equals(csvFormat)); // CSV-244 - should not be equal
524525
assertFalse(csvFormatTwo.getAllowMissingColumnNames());
525526

526527
assertFalse(csvFormatTwo.getTrim());
@@ -969,7 +970,7 @@ public void testWithHeaderComments() {
969970
assertNotSame(csvFormat, csvFormatTwo);
970971
assertNotSame(csvFormatTwo, csvFormat);
971972

972-
assertTrue(csvFormatTwo.equals(csvFormat)); // TODO this fails since CSV-242 was applied. Why should the formats compare equal?
973+
assertFalse(csvFormatTwo.equals(csvFormat)); // CSV-244 - should not be equal
973974

974975
final String string = csvFormatTwo.format(objectArray);
975976

@@ -1031,9 +1032,9 @@ public void testWithHeaderComments() {
10311032
assertNotSame(csvFormatTwo, csvFormat);
10321033

10331034
assertNotNull(string);
1034-
assertTrue(csvFormat.equals(csvFormatTwo));
1035+
assertFalse(csvFormat.equals(csvFormatTwo)); // CSV-244 - should not be equal
10351036

1036-
assertTrue(csvFormatTwo.equals(csvFormat));
1037+
assertFalse(csvFormatTwo.equals(csvFormat)); // CSV-244 - should not be equal
10371038
assertEquals(",,,,,,,", string);
10381039

10391040
}

0 commit comments

Comments
 (0)