### Question:
Second extends RegularTimePeriod implements Serializable { @Override public long getLastMillisecond() { return this.firstMillisecond + 999L; } Second();  Second(int second, Minute minute);  Second(int second, int minute, int hour,
                  int day, int month, int year);  Second(Date time);  Second(Date time, TimeZone zone, Locale locale); int getSecond(); Minute getMinute(); @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 int hashCode(); @Override int compareTo(TimePeriod o1); static Second parseSecond(String s); static final int FIRST_SECOND_IN_MINUTE; static final int LAST_SECOND_IN_MINUTE; }### Answer:
@Test public void testGetLastMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Second s = new Second(1, 1, 1, 1, 1, 1970); assertEquals(61999L, s.getLastMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
@Test public void testGetLastMillisecondWithTimeZone() { Second s = new Second(55, 1, 2, 7, 7, 1950); TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles"); Calendar c = new GregorianCalendar(zone); assertEquals(-614962684001L, s.getLastMillisecond(c)); try { s.getLastMillisecond(null); fail("NullPointerException should have been thrown on Null Parameter"); } catch (NullPointerException e) { } }
@Test public void testGetLastMillisecondWithCalendar() { Second s = new Second(50, 45, 21, 21, 4, 2001); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); assertEquals(987889550999L, s.getLastMillisecond(calendar)); try { s.getLastMillisecond(null); fail("NullPointerException should have been thrown on null parameter"); } catch (NullPointerException e) { } }