< prev index next >

test/java/util/Calendar/Builder/BuilderTest.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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.

@@ -25,10 +25,11 @@
  * @test
  * @bug 4745761
  * @summary Unit test for Calendar.Builder.
  */
 
+import java.time.LocalDateTime;
 import java.util.*;
 import static java.util.Calendar.*;
 
 public class BuilderTest {
     private static final Locale jaJPJP = new Locale("ja", "JP", "JP");

@@ -130,11 +131,15 @@
             // Japanese Imperial calendar
             cal = builder().setCalendarType("japanese")
                 .setFields(YEAR, 1, DAY_OF_YEAR, 1).build();
             expected = Calendar.getInstance(jaJPJP);
             expected.clear();
+            if (LocalDateTime.now().isBefore(LocalDateTime.of(2019, 5, 1, 0, 0))) {
             expected.set(1, JANUARY, 8);
+            } else {
+                expected.set(1, MAY, 1);
+            }
             check(cal, expected);
             // setLocale
             calb = builder();
             cal = calb.setLocale(jaJPJP).setFields(YEAR, 1, DAY_OF_YEAR, 1).build();
             check(cal, expected);
< prev index next >