Пример #1
0
 public void test_toLocalTime_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++) {
     LocalTime test = gcal.toLocalTime();
     assertEquals(test.toNanoOfDay(), 0);
     gcal.add(Calendar.DATE, 1);
   }
 }
Пример #2
0
 public void test_toLocalTime_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++) {
     LocalTime test = gcal.toLocalTime();
     assertEquals(test.toNanoOfDay(), (24L * 60L * 60L - 1L) * 1000000000L);
     gcal.add(Calendar.DATE, 1);
   }
 }
Пример #3
0
 // -----------------------------------------------------------------------
 public void test_toLocalTime() {
   GregorianCalendar gcal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
   gcal.set(2008, 0, 1, 0, 0, 0);
   gcal.set(Calendar.MILLISECOND, 0);
   for (int i = 0; i < 500; i++) {
     LocalTime test = gcal.toLocalTime();
     assertEquals(test.getHourOfDay(), gcal.get(Calendar.HOUR_OF_DAY));
     assertEquals(test.getMinuteOfHour(), gcal.get(Calendar.MINUTE));
     assertEquals(test.getSecondOfMinute(), gcal.get(Calendar.SECOND));
     assertEquals(test.getNanoOfSecond(), gcal.get(Calendar.MILLISECOND) * 1000000);
     assertEquals(test.toNanoOfDay(), 0);
     gcal.add(Calendar.DATE, 1);
   }
 }
Пример #4
0
 public void testGetUnsupported() throws Exception {
   assertEquals(testDate.get(LocalTime.rule()), null);
 }