### Question:
Hour extends RegularTimePeriod implements Serializable { @Override public long getLastMillisecond() { return this.lastMillisecond; } 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 testGetLastMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Hour h = new Hour(1, 1, 1, 1970); assertEquals(3599999L, h.getLastMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
@Test public void testGetLastMillisecondWithTimeZone() { Hour h = new Hour(2, 7, 7, 1950); TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles"); Calendar c = new GregorianCalendar(zone); assertEquals(-614959200001L, h.getLastMillisecond(c)); try { h.getLastMillisecond(null); fail("NullPointerException should have been thrown on null parameter"); } catch (NullPointerException e) { } }
@Test public void testGetLastMillisecondWithCalendar() { Hour h = new Hour(21, 21, 4, 2001); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); assertEquals(987890399999L, h.getLastMillisecond(calendar)); try { h.getLastMillisecond(null); fail("NullPointerExceptoin should have been thrown on null parameter"); } catch (NullPointerException e) { } }