8158880: java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java fail with zh_CN locale
authorbgopularam
Tue, 22 Nov 2016 08:22:57 +0000
changeset 42182 293b784c607e
parent 42181 fbd3dc141d3d
child 42183 6b4cdd4a4609
8158880: java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java fail with zh_CN locale Summary: Set locale explicitly in the test Reviewed-by: rriggs, naoto
jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java
--- a/jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java	Tue Nov 22 13:02:12 2016 +0530
+++ b/jdk/test/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java	Tue Nov 22 08:22:57 2016 +0000
@@ -594,7 +594,7 @@
     @Test(dataProvider = "formatGenericTimeZonePatterns")
     public void test_appendZoneText_formatGenericTimeZonePatterns(String pattern, String input, String expected) {
         ZonedDateTime zdt = ZonedDateTime.of(LocalDateTime.now(), ZoneId.of(input));
-        DateTimeFormatter df = DateTimeFormatter.ofPattern(pattern);
+        DateTimeFormatter df = DateTimeFormatter.ofPattern(pattern, Locale.US);
         assertEquals(zdt.format(df), expected);
     }
 
@@ -641,7 +641,7 @@
     @Test(dataProvider = "formatNonGenericTimeZonePatterns_1")
     public void test_appendZoneText_parseNonGenricTimeZonePatterns_1(String pattern, LocalDateTime ldt, String expected) {
         ZoneId  zId = ZoneId.of("America/Los_Angeles");
-        DateTimeFormatter df = new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter();
+        DateTimeFormatter df = new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter(Locale.US);
         ZonedDateTime zdt = ZonedDateTime.of(ldt, zId);
         String actual = df.format(zdt);
         assertEquals(actual, expected);
@@ -668,7 +668,7 @@
     @Test(dataProvider = "formatNonGenericTimeZonePatterns_2")
     public void test_appendZoneText_parseNonGenricTimeZonePatterns_2(String pattern, LocalDateTime ldt, String expected) {
         ZoneId  zId = ZoneId.of("America/Los_Angeles");
-        DateTimeFormatter df = DateTimeFormatter.ofPattern(pattern).withZone(zId);
+        DateTimeFormatter df = DateTimeFormatter.ofPattern(pattern, Locale.US).withZone(zId);
         String actual = df.format(ldt);
         assertEquals(actual, expected);
     }