From 3690f47b5768d4b1d476bc0d8aab7bed82844799 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Tue, 18 Jun 2019 01:48:10 +0200 Subject: [PATCH] [Java 9] Fix GitDateFormatterTest MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- .../org/eclipse/jgit/util/GitDateFormatterTest.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateFormatterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateFormatterTest.java index d52166f2ba..59ff2adcdd 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateFormatterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateFormatterTest.java @@ -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 } } -- 2.39.5