### Question:
Hour extends RegularTimePeriod implements Serializable { @Override public RegularTimePeriod next() { Hour result; if (this.hour != LAST_HOUR_IN_DAY) { result = new Hour(this.hour + 1, this.day); } else { Day nextDay = (Day) this.day.next(); if (nextDay != null) { result = new Hour(FIRST_HOUR_IN_DAY, nextDay); } else { result = null; } } return result; } Hour();  Hour(int hour, Day day);  Hour(int hour, int day, int month, int year);  Hour(Date time);  Hour(Date time, TimeZone zone, Locale locale); int getHour(); Day getDay(); int getYear(); int getMonth(); int getDayOfMonth(); @Override long getFirstMillisecond(); @Override long getLastMillisecond(); @Override void peg(Calendar calendar); @Override RegularTimePeriod previous(); @Override RegularTimePeriod next(); @Override long getSerialIndex(); @Override long getFirstMillisecond(Calendar calendar); @Override long getLastMillisecond(Calendar calendar); @Override boolean equals(Object obj); @Override String toString(); @Override int hashCode(); @Override int compareTo(TimePeriod o1); static Hour parseHour(String s); static final int FIRST_HOUR_IN_DAY; static final int LAST_HOUR_IN_DAY; }### Answer:
@Test public void testLastHourNext() { Hour last = new Hour(23, new Day(31, MonthConstants.DECEMBER, 9999)); Hour next = (Hour) last.next(); assertNull(next); }
@Test public void testNext() { Hour h = new Hour(1, 12, 12, 2000); h = (Hour) h.next(); assertEquals(2000, h.getYear()); assertEquals(12, h.getMonth()); assertEquals(12, h.getDayOfMonth()); assertEquals(2, h.getHour()); h = new Hour(23, 31, 12, 9999); assertNull(h.next()); }