@BeforeMethod(groups = {"tck"})
 public void setUp() {
   printEmptyContext =
       new DateTimePrintContext(EMPTY, Locale.ENGLISH, DateTimeFormatSymbols.STANDARD);
   ZonedDateTime zdt =
       LocalDateTime.of(2011, 6, 30, 12, 30, 40, 0).atZone(ZoneId.of("Europe/Paris"));
   printContext = new DateTimePrintContext(zdt, Locale.ENGLISH, DateTimeFormatSymbols.STANDARD);
   parseContext = new DateTimeParseContext(Locale.ENGLISH, DateTimeFormatSymbols.STANDARD);
   buf = new StringBuilder();
 }
예제 #2
0
 public void test_toLocalDateTime_variableOffset() {
   GregorianCalendar gcal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Paris"));
   gcal.set(2008, 0, 1, 0, 0, 0);
   gcal.set(Calendar.MILLISECOND, 0);
   for (int i = 0; i < 500; i++) {
     LocalDateTime test = gcal.toLocalDateTime();
     assertEquals(test.getYear(), gcal.get(Calendar.YEAR));
     assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1);
     assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE));
     assertEquals(test.toLocalTime().toNanoOfDay(), 0);
     assertEquals(test.getYear(), i < 366 ? 2008 : 2009);
     gcal.add(Calendar.DATE, 1);
   }
 }
예제 #3
0
 public void test_toLocalDateTime_endOfDay() {
   GregorianCalendar gcal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
   gcal.set(2008, 0, 1, 23, 59, 59);
   gcal.set(Calendar.MILLISECOND, 0);
   for (int i = 0; i < 500; i++) {
     LocalDateTime test = gcal.toLocalDateTime();
     assertEquals(test.getYear(), gcal.get(Calendar.YEAR));
     assertEquals(test.getMonthOfYear().getValue(), gcal.get(Calendar.MONTH) + 1);
     assertEquals(test.getDayOfMonth(), gcal.get(Calendar.DATE));
     assertEquals(test.toLocalTime().toNanoOfDay(), (24L * 60L * 60L - 1L) * 1000000000L);
     assertEquals(test.getYear(), i < 366 ? 2008 : 2009);
     gcal.add(Calendar.DATE, 1);
   }
 }
예제 #4
0
 public void test_getValue_Calendrical_dateTime() {
   Calendrical cal = LocalDateTime.of(2007, 6, 20, 12, 30);
   assertEquals(rule().getValue(cal), rule().field(2007));
 }