/** * In GMT, the 4.55:59.123pm on 21 Mar 2002 is java.util.Date(1016729759123L). Use this to check * the Millisecond constructor. */ @Test public void testDateConstructor1() { TimeZone zone = TimeZone.getTimeZone("GMT"); Locale locale = Locale.getDefault(); // locale should not matter here Millisecond m1 = new Millisecond(new Date(1016729759122L), zone, locale); Millisecond m2 = new Millisecond(new Date(1016729759123L), zone, locale); assertEquals(122, m1.getMillisecond()); assertEquals(1016729759122L, m1.getLastMillisecond(zone)); assertEquals(123, m2.getMillisecond()); assertEquals(1016729759123L, m2.getFirstMillisecond(zone)); }
/** Some checks for the testNext() method. */ @Test public void testNext() { Millisecond m = new Millisecond(555, 55, 30, 1, 12, 12, 2000); m = (Millisecond) m.next(); assertEquals(2000, m.getSecond().getMinute().getHour().getYear()); assertEquals(12, m.getSecond().getMinute().getHour().getMonth()); assertEquals(12, m.getSecond().getMinute().getHour().getDayOfMonth()); assertEquals(1, m.getSecond().getMinute().getHour().getHour()); assertEquals(30, m.getSecond().getMinute().getMinute()); assertEquals(55, m.getSecond().getSecond()); assertEquals(556, m.getMillisecond()); m = new Millisecond(999, 59, 59, 23, 31, 12, 9999); assertNull(m.next()); }