### Question:
Millisecond extends RegularTimePeriod implements Serializable, 
        Comparable<TimePeriod> { @Override public long getFirstMillisecond() { return this.firstMillisecond; } Millisecond();  Millisecond(int millisecond, Second second);  Millisecond(int millisecond, int second, int minute, int hour,
                       int day, int month, int year);  Millisecond(Date time);  Millisecond(Date time, TimeZone zone, Locale locale); Second getSecond(); long getMillisecond(); @Override long getFirstMillisecond(); @Override long getLastMillisecond(); @Override void peg(Calendar calendar); @Override RegularTimePeriod previous(); @Override RegularTimePeriod next(); @Override long getSerialIndex(); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(TimePeriod obj); @Override long getFirstMillisecond(Calendar calendar); @Override long getLastMillisecond(Calendar calendar); static final int FIRST_MILLISECOND_IN_SECOND; static final int LAST_MILLISECOND_IN_SECOND; }### Answer:
@Test public void testGetFirstMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Millisecond m = new Millisecond(500, 15, 43, 15, 1, 4, 2006); assertEquals(1143902595500L, m.getFirstMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
@Test public void testGetFirstMillisecondWithTimeZone() { Millisecond m = new Millisecond(500, 50, 59, 15, 1, 4, 1950); TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles"); Calendar c = new GregorianCalendar(zone); assertEquals(-623289609500L, m.getFirstMillisecond(c)); try { m.getFirstMillisecond(null); fail("NullPointerException should have been thrown"); } catch (NullPointerException e) { } }
@Test public void testGetFirstMillisecondWithCalendar() { Millisecond m = new Millisecond(500, 55, 40, 2, 15, 4, 2000); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); assertEquals(955766455500L, m.getFirstMillisecond(calendar)); try { m.getFirstMillisecond(null); fail("NullPointerException should have been thrown"); } catch (NullPointerException e) { } }