]> granicus.if.org Git - icu/commitdiff
ICU-13240 Fixes and re-enables a test which was disabled since JUnit migration.
authorNorbert Runge <nrunge@google.com>
Thu, 22 Jun 2017 18:32:20 +0000 (18:32 +0000)
committerNorbert Runge <nrunge@google.com>
Thu, 22 Jun 2017 18:32:20 +0000 (18:32 +0000)
X-SVN-Rev: 40192

icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/TestMessageFormat.java

index 3f9736c4d3df729f5698aceffd68666074e3a492..7e9fa53edba7aed379d6bf43c5fac3a426954ffb 100644 (file)
@@ -27,7 +27,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
 
-import org.junit.Ignore;
 import org.junit.Test;
 
 import com.ibm.icu.text.DateFormat;
@@ -2077,16 +2076,15 @@ public class TestMessageFormat extends com.ibm.icu.dev.test.TestFmwk {
         assertTrue("many parts", pattern.countParts() > 10);
     }
 
-    // TODO(junit): turned off for failure - need to investigate
-    @Ignore
+    // This is mostly a code coverage test with verification minimized to what can be plausibly assumed: different
+    // hash values for distinctly different objects.
     @Test
     public void TestDateFormatHashCode() {
-        DateFormat testDF = DateFormat.getDateInstance(DateFormat.DEFAULT, ULocale.GERMAN);
-        NumberFormat testNF = testDF.getNumberFormat();
+        DateFormat testDF1 = DateFormat.getDateInstance(DateFormat.DEFAULT, ULocale.GERMAN);
+        DateFormat testDF2 = DateFormat.getDateInstance(DateFormat.DEFAULT, ULocale.FRENCH);
 
-        int expectedResult =
-                testNF.getMaximumIntegerDigits() * 37 + testNF.getMaximumFractionDigits();
-        int actualHashResult = testDF.hashCode();
-        assertEquals("DateFormat hashCode", expectedResult, actualHashResult);
+        int actualHashResult1 = testDF1.hashCode();
+        int actualHashResult2 = testDF2.hashCode();
+        assertNotEquals("DateFormat hashCode() test: really the same hashcode?", actualHashResult1, actualHashResult2);
     }
 }