]> source.dussan.org Git - jgit.git/commitdiff
[Java 9] Fix GitDateFormatterTest 04/144304/1
authorMatthias Sohn <matthias.sohn@sap.com>
Mon, 17 Jun 2019 23:48:10 +0000 (01:48 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Tue, 18 Jun 2019 00:22:42 +0000 (02:22 +0200)
In JDK 9 and later, the default locale data uses data derived from the
Unicode Consortium's Common Locale Data Repository (CLDR). So there are
changes with respect to some locales.

For example the short date-time format is ‹{1}, {0}› in the CLDR locale,
as opposed to {1} {0} in the JRE locale data.

See: https://bugs.openjdk.java.net/browse/JDK-8206961
See: https://www.unicode.org/cldr/charts/29/by_type/date_&_time.gregorian.html#1141bf54834c4261
Change-Id: I7535821e8ecd8702a95db8732cbbf3a4a7385eca
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateFormatterTest.java

index d52166f2bade885da95ef5955f49eedb648cfab8..59ff2adcdd1453a064be830972ed0dff8907a958 100644 (file)
@@ -44,6 +44,7 @@
 package org.eclipse.jgit.util;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import org.eclipse.jgit.junit.MockSystemReader;
 import org.eclipse.jgit.lib.PersonIdent;
@@ -120,13 +121,16 @@ public class GitDateFormatterTest {
 
        @Test
        public void LOCALE() {
-               assertEquals("Sep 20, 2011 7:09:25 PM -0400", new GitDateFormatter(
-                               Format.LOCALE).formatDate(ident));
+               String date = new GitDateFormatter(Format.LOCALE).formatDate(ident);
+               assertTrue("Sep 20, 2011 7:09:25 PM -0400".equals(date)
+                               || "Sep 20, 2011, 7:09:25 PM -0400".equals(date)); // JDK-8206961
        }
 
        @Test
        public void LOCALELOCAL() {
-               assertEquals("Sep 20, 2011 7:39:25 PM", new GitDateFormatter(
-                               Format.LOCALELOCAL).formatDate(ident));
+               String date = new GitDateFormatter(Format.LOCALELOCAL)
+                               .formatDate(ident);
+               assertTrue("Sep 20, 2011 7:39:25 PM".equals(date)
+                               || "Sep 20, 2011, 7:39:25 PM".equals(date)); // JDK-8206961
        }
 }