DateTimeService { public java.sql.Date getCurrentJavaSqlDate() { return new java.sql.Date(new DateTime().getMillis()); }  Date getCurrentJavaDateTime(); void setCurrentDateTime(DateTime someDateTime); void resetToCurrentSystemDateTime(); DateTime getCurrentDateTime(); void setCurrentDateTimeFixed(DateTime dateTime); java.sql.Date getCurrentJavaSqlDate(); DateMidnight getCurrentDateMidnight();  }
@Test public void testGetCurrentJavaSqlDate() { DateTimeService dateTimeService = new DateTimeService(); DateTime dateTime = new DateTime(2008,1,1,12,0,0,0); dateTimeService.setCurrentDateTimeFixed(dateTime); DateTime javaSqlDateTime = new DateTime(dateTimeService.getCurrentJavaSqlDate().getTime()); Assert.assertEquals("Dates should be equal", dateTime.toLocalDate(), javaSqlDateTime.toLocalDate()); }