[Java 9] Fix GitDateFormatterTest

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>
This commit is contained in:
Matthias Sohn 2019-06-18 01:48:10 +02:00
parent 7607465006
commit 3690f47b57
1 changed files with 8 additions and 4 deletions

View 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 void RAW() {
@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
}
}