< prev index next >

test/jdk/java/time/tck/java/time/format/TCKOffsetPrinterParser.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -67,10 +67,11 @@
 import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatterBuilder;
 import java.time.format.TextStyle;
+import java.util.Locale;
 
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 

@@ -555,32 +556,32 @@
     public void test_print_localized(TextStyle style, LocalDateTime ldt, ZoneOffset offset, String expected) {
         OffsetDateTime odt = OffsetDateTime.of(ldt, offset);
         ZonedDateTime zdt = ldt.atZone(offset);
 
         DateTimeFormatter f = new DateTimeFormatterBuilder().appendLocalizedOffset(style)
-                                                            .toFormatter();
+                                                            .toFormatter(Locale.US);
         assertEquals(f.format(odt), expected);
         assertEquals(f.format(zdt), expected);
         assertEquals(f.parse(expected, ZoneOffset::from), offset);
 
         if (style == TextStyle.FULL) {
             f = new DateTimeFormatterBuilder().appendPattern("ZZZZ")
-                                              .toFormatter();
+                                              .toFormatter(Locale.US);
             assertEquals(f.format(odt), expected);
             assertEquals(f.format(zdt), expected);
             assertEquals(f.parse(expected, ZoneOffset::from), offset);
 
             f = new DateTimeFormatterBuilder().appendPattern("OOOO")
-                                              .toFormatter();
+                                              .toFormatter(Locale.US);
             assertEquals(f.format(odt), expected);
             assertEquals(f.format(zdt), expected);
             assertEquals(f.parse(expected, ZoneOffset::from), offset);
         }
 
         if (style == TextStyle.SHORT) {
             f = new DateTimeFormatterBuilder().appendPattern("O")
-                                              .toFormatter();
+                                              .toFormatter(Locale.US);
             assertEquals(f.format(odt), expected);
             assertEquals(f.format(zdt), expected);
             assertEquals(f.parse(expected, ZoneOffset::from), offset);
         }
     }
< prev index next >