ExtDateTimeUtils { public static Date startOfDayUsingOutputTimeZone(Date dateInst) throws AdeException { if (outputTimeZone == null) { final TimeZone outputTimezone = Ade.getAde().getConfigProperties().getOutputTimeZone(); outputTimeZone = DateTimeZone.forOffsetMillis(outputTimezone.getRawOffset()); } if (dateInst == null) { throw new IllegalArgumentException(); } DateTime startOFDay = new DateTime(dateInst); startOFDay = startOFDay.withZone(outputTimeZone); startOFDay = startOFDay.withTimeAtStartOfDay(); return startOFDay.toDate(); } private  ExtDateTimeUtils(); static String timestampToHumanDateAndTime(long timestamp); static String dateToHumanDateAndTime(Date date); static String dateToHuman(Date date); static Timestamp getCurrentTimeStamp(); static Date daysBefore(Date dateInst, int numDays); static Date daysBeforeNow(int numDays); static Date daysAfter(Date dateInst, int numDays); static Date daysAfterWithoutTimeZone(Date dateInst, int numDays); static Date daysAfterNow(int numDays); static Date startOfDay(Date dateInst); static Date endOfDay(Date dateInst); static Date startOfDayUsingOutputTimeZone(Date dateInst); static Date endOfDayUsingOutputTimeZone(Date dateInst); static final long MILLIS_IN_SECOND; static final long MILLIS_IN_MINUTE; static final long MILLIS_IN_HOUR; static final long MILLIS_IN_DAY; static final int LAST_HOUR_OF_DAY; static final int LAST_MINUTE; static final int LAST_SECOND; static final int LAST_MILLISECOND; }
@Test(expected = IllegalArgumentException.class) public void testStartOfDayUsingOutputTimeZoneWithNullDate() throws AdeException { ade = mock(Ade.class, RETURNS_DEEP_STUBS); when(ade.getConfigProperties().database().getDatabaseDriver()).thenReturn("derby"); when(ade.getConfigProperties().getOverrideVersionCheck()).thenReturn(true); when(ade.getDbVersion()).thenReturn(new Version(1, 0)); Ade.create(ade); assertEquals("StartOfDateUsingOutputTimeZone with null input ",null ,ExtDateTimeUtils.startOfDayUsingOutputTimeZone(null)); }
@Test public void testStartOfDayUsingOutputTimeZoneWithRealDate() throws AdeException { Date date = new Date(); date.setTime(0L); assertEquals("StartOfDateUsingOutputTimeZone with real input ",date ,ExtDateTimeUtils.startOfDayUsingOutputTimeZone(date)); }