From 42b9fdb099a438886842795d8b0b325952d9f3e9 Mon Sep 17 00:00:00 2001 From: Sebb Date: Sat, 15 Jun 2019 14:29:30 +0100 Subject: [PATCH] CSV-244 Test case failures following CSVFormat#equals() update --- src/changes/changes.xml | 1 + .../java/org/apache/commons/csv/CSVFormatTest.java | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index d9cd5cf9..70c1b8ee 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -39,6 +39,7 @@ + Test case failures following CSVFormat#equals() update. CSVFormat withTrim() and withIgnoreSurroundingSpaces() need better docs. CSVFormat equals() and hashCode() don't use all fields. CSVFormat#valiadte() does not account for allowDuplicateHeaderNames #43. diff --git a/src/test/java/org/apache/commons/csv/CSVFormatTest.java b/src/test/java/org/apache/commons/csv/CSVFormatTest.java index dfdaf695..b67cc0f8 100644 --- a/src/test/java/org/apache/commons/csv/CSVFormatTest.java +++ b/src/test/java/org/apache/commons/csv/CSVFormatTest.java @@ -517,10 +517,11 @@ public class CSVFormatTest { final CSVFormat csvFormatTwo = csvFormat.withIgnoreHeaderCase(); csvFormatTwo.hashCode(); - assertTrue(csvFormatTwo.getIgnoreHeaderCase()); + assertFalse(csvFormat.getIgnoreHeaderCase()); + assertTrue(csvFormatTwo.getIgnoreHeaderCase()); // now different assertFalse(csvFormatTwo.getTrailingDelimiter()); - assertTrue(csvFormatTwo.equals(csvFormat)); // TODO this fails since CSV-242 was applied. Why should they compare equal? + assertFalse(csvFormatTwo.equals(csvFormat)); // CSV-244 - should not be equal assertFalse(csvFormatTwo.getAllowMissingColumnNames()); assertFalse(csvFormatTwo.getTrim()); @@ -969,7 +970,7 @@ public class CSVFormatTest { assertNotSame(csvFormat, csvFormatTwo); assertNotSame(csvFormatTwo, csvFormat); - assertTrue(csvFormatTwo.equals(csvFormat)); // TODO this fails since CSV-242 was applied. Why should the formats compare equal? + assertFalse(csvFormatTwo.equals(csvFormat)); // CSV-244 - should not be equal final String string = csvFormatTwo.format(objectArray); @@ -1031,9 +1032,9 @@ public class CSVFormatTest { assertNotSame(csvFormatTwo, csvFormat); assertNotNull(string); - assertTrue(csvFormat.equals(csvFormatTwo)); + assertFalse(csvFormat.equals(csvFormatTwo)); // CSV-244 - should not be equal - assertTrue(csvFormatTwo.equals(csvFormat)); + assertFalse(csvFormatTwo.equals(csvFormat)); // CSV-244 - should not be equal assertEquals(",,,,,,,", string); }