// ----------------------------------------------------------------------- public void testGetters() { DateTime test = new DateTime(); assertEquals(ISO_DEFAULT, test.getChronology()); assertEquals(LONDON, test.getZone()); assertEquals(TEST_TIME_NOW, test.getMillis()); assertEquals(1, test.getEra()); assertEquals(20, test.getCenturyOfEra()); assertEquals(2, test.getYearOfCentury()); assertEquals(2002, test.getYearOfEra()); assertEquals(2002, test.getYear()); assertEquals(6, test.getMonthOfYear()); assertEquals(9, test.getDayOfMonth()); assertEquals(2002, test.getWeekyear()); assertEquals(23, test.getWeekOfWeekyear()); assertEquals(7, test.getDayOfWeek()); assertEquals(160, test.getDayOfYear()); assertEquals(1, test.getHourOfDay()); assertEquals(0, test.getMinuteOfHour()); assertEquals(60, test.getMinuteOfDay()); assertEquals(0, test.getSecondOfMinute()); assertEquals(60 * 60, test.getSecondOfDay()); assertEquals(0, test.getMillisOfSecond()); assertEquals(60 * 60 * 1000, test.getMillisOfDay()); }
// ----------------------------------------------------------------------- private void check( DateTime test, int year, int month, int day, int hour, int min, int sec, int mil) { assertEquals(year, test.getYear()); assertEquals(month, test.getMonthOfYear()); assertEquals(day, test.getDayOfMonth()); assertEquals(hour, test.getHourOfDay()); assertEquals(min, test.getMinuteOfHour()); assertEquals(sec, test.getSecondOfMinute()); assertEquals(mil, test.getMillisOfSecond()); }