瀏覽代碼

[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>
tags/v5.5.0.201908280940-m3
Matthias Sohn 4 年之前
父節點
當前提交
3690f47b57
共有 1 個文件被更改,包括 8 次插入4 次删除
  1. 8
    4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateFormatterTest.java

+ 8
- 4
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
}
}

Loading…
取消
儲存