### Question:
Quarter extends RegularTimePeriod implements Serializable { @Override public long getFirstMillisecond() { return this.firstMillisecond; } Quarter();  Quarter(int quarter, int year);  Quarter(int quarter, Year year);  Quarter(Date time);  Quarter(Date time, TimeZone zone, Locale locale); int getQuarter(); Year getYear(); int getYearValue(); @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 o1); @Override String toString(); @Override long getFirstMillisecond(Calendar calendar); @Override long getLastMillisecond(Calendar calendar); static Quarter parseQuarter(String s); static final int FIRST_QUARTER; static final int LAST_QUARTER; static final int[] FIRST_MONTH_IN_QUARTER; static final int[] LAST_MONTH_IN_QUARTER; }### Answer:
@Test public void testGetFirstMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Quarter q = new Quarter(3, 1970); assertEquals(15634800000L, q.getFirstMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
@Test public void testGetFirstMillisecondWithTimeZone() { Quarter q = new Quarter(2, 1950); TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles"); Calendar c = new GregorianCalendar(zone); assertEquals(-623347200000L, q.getFirstMillisecond(c)); try { q.getFirstMillisecond(null); fail("NullPointerException should have been thrown on null parameter"); } catch (NullPointerException e) { } }
@Test public void testGetFirstMillisecondWithCalendar() { Quarter q = new Quarter(1, 2001); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); assertEquals(978307200000L, q.getFirstMillisecond(calendar)); try { q.getFirstMillisecond(null); fail("NullPointerException should have been thrown on null parameter"); } catch (NullPointerException e) { } }