### Question:
DCDate { public Date toDate() { if (calendar == null) { return null; } else { return calendar.getTime(); } } DCDate(Date date);  DCDate(int yyyy, int mm, int dd, int hh, int mn, int ss);  DCDate(String fromDC); int getYear(); int getMonth(); int getDay(); int getHour(); int getMinute(); int getSecond(); int getYearUTC(); int getMonthUTC(); int getDayUTC(); int getHourUTC(); int getMinuteUTC(); int getSecondUTC(); String toString(); Date toDate(); String displayDate(boolean showTime, boolean isLocalTime, Locale locale); String displayLocalDate(boolean showTime, Locale locale); String displayUTCDate(boolean showTime, Locale locale); static DCDate getCurrent(); static String getMonthName(int m, Locale locale);  }### Answer:
@Test public void testToDate() { dc = new DCDate((Date)null); assertThat("testToDate 0", dc.toDate(), nullValue()); c = new GregorianCalendar(2010,0,0); dc = new DCDate(c.getTime()); assertThat("testToDate 1", dc.toDate(), equalTo(c.getTime())); c = new GregorianCalendar(2010,4,0); dc = new DCDate(c.getTime()); assertThat("testToDate 2", dc.toDate(), equalTo(c.getTime())); c = new GregorianCalendar(2010,4,14); dc = new DCDate(c.getTime()); assertThat("testToDate 3", dc.toDate(), equalTo(c.getTime())); c = new GregorianCalendar(2010,4,14,0,0,1); dc = new DCDate(c.getTime()); assertThat("testToDate 4", dc.toDate(), equalTo(c.getTime())); }
@Test public void testToDate() { dc = new DCDate((Date) null); assertThat("testToDate 0", dc.toDate(), nullValue()); c = new GregorianCalendar(2010, 0, 0); dc = new DCDate(c.getTime()); assertThat("testToDate 1", dc.toDate(), equalTo(c.getTime())); c = new GregorianCalendar(2010, 4, 0); dc = new DCDate(c.getTime()); assertThat("testToDate 2", dc.toDate(), equalTo(c.getTime())); c = new GregorianCalendar(2010, 4, 14); dc = new DCDate(c.getTime()); assertThat("testToDate 3", dc.toDate(), equalTo(c.getTime())); c = new GregorianCalendar(2010, 4, 14, 0, 0, 1); dc = new DCDate(c.getTime()); assertThat("testToDate 4", dc.toDate(), equalTo(c.getTime())); }