DateTimeService { public DateMidnight getCurrentDateMidnight() { return new DateMidnight(); }  Date getCurrentJavaDateTime(); void setCurrentDateTime(DateTime someDateTime); void resetToCurrentSystemDateTime(); DateTime getCurrentDateTime(); void setCurrentDateTimeFixed(DateTime dateTime); java.sql.Date getCurrentJavaSqlDate(); DateMidnight getCurrentDateMidnight();  }
@Test public void testGetCurrentDateMidnight() { DateTimeService dateTimeService = new DateTimeService(); DateTime dateTime = dateTimeService.getCurrentDateTime(); dateTimeService.setCurrentDateTimeFixed(dateTime); DateMidnight dateMidnight = dateTimeService.getCurrentDateMidnight(); Assert.assertEquals("DateMidnight portions should be equal", dateTime.toDateMidnight(), dateMidnight); }