ServiceDate implements Serializable, Comparable<ServiceDate> { public Date getAsDate() { return getAsDate(TimeZone.getDefault()); } ServiceDate(int year, int month, int day);  ServiceDate(ServiceDate o);  ServiceDate(Calendar calendar);  ServiceDate(Date date);  ServiceDate(); static ServiceDate parseString(String value); int getYear(); int getMonth(); int getDay(); Date getAsDate(); Calendar getAsCalendar(TimeZone timeZone); Date getAsDate(TimeZone timeZone); String getAsString(); ServiceDate next(); ServiceDate previous(); ServiceDate shift(int numberOfDays); long difference(ServiceDate serviceDate); @Override int compareTo(ServiceDate o); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static void moveCalendarToServiceDate(Calendar c);  }
@Test public void testGetAsDateWithTimezoneA() { ServiceDate serviceDateA = new ServiceDate(2010, 2, 16); TimeZone tzA = TimeZone.getTimeZone("America/Los_Angeles"); Date dateA = serviceDateA.getAsDate(tzA); assertEquals(date("2010-02-16 00:00 Pacific Standard Time"), dateA); TimeZone tzB = TimeZone.getTimeZone("America/Denver"); Date dateB = serviceDateA.getAsDate(tzB); assertEquals(date("2010-02-16 00:00 Mountain Standard Time"), dateB); }
@Test public void testGetAsDateWithTimezoneB() { ServiceDate serviceDateA = new ServiceDate(2010, 3, 14); TimeZone tzA = TimeZone.getTimeZone("America/Los_Angeles"); Date dateA = serviceDateA.getAsDate(tzA); assertEquals(date("2010-03-13 23:00 Pacific Standard Time"), dateA); TimeZone tzB = TimeZone.getTimeZone("America/Denver"); Date dateB = serviceDateA.getAsDate(tzB); assertEquals(date("2010-03-13 23:00 Mountain Standard Time"), dateB); }
@Test public void testGetAsDateWithTimezoneC() { ServiceDate serviceDateA = new ServiceDate(2010, 11, 7); TimeZone tzA = TimeZone.getTimeZone("America/Los_Angeles"); Date dateA = serviceDateA.getAsDate(tzA); assertEquals(date("2010-11-07 01:00 Pacific Daylight Time"), dateA); TimeZone tzB = TimeZone.getTimeZone("America/Denver"); Date dateB = serviceDateA.getAsDate(tzB); assertEquals(date("2010-11-07 01:00 Mountain Daylight Time"), dateB); }
@Test public void testGetAsDateDefault() { ServiceDate serviceDate = new ServiceDate(2010, 02, 11); Date dateA = serviceDate.getAsDate(); Date dateB = serviceDate.getAsDate(TimeZone.getDefault()); assertEquals(dateA, dateB); }