ExtDateTimeUtils { public static Date daysAfterWithoutTimeZone(Date dateInst, int numDays) { if ((numDays <= 0) || (dateInst == null)) { throw new IllegalArgumentException(); } final long daysInMillis = numDays * MILLIS_IN_DAY; return new Date(dateInst.getTime() + daysInMillis); } 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 public void testDaysAfterWithoutTimeZoneWithOneDay(){ long Dec10th2015 = 1449723600000L; long Dec11th2015 = 1449810000000L; assertEquals("Dec 10th + 1 day ",new Date(Dec11th2015) ,ExtDateTimeUtils.daysAfterWithoutTimeZone(new Date(Dec10th2015),1)); }
@Test(expected = IllegalArgumentException.class) public void testDaysAfterWithoutTimeZoneWithNegativeValue(){ assertEquals("-1 many days before ","",ExtDateTimeUtils.daysAfterWithoutTimeZone(new Date(),-1)); }
@Test(expected = IllegalArgumentException.class) public void testDaysAfterWithoutTimeZoneWithNullDate(){ assertEquals("-1 many days before ","",ExtDateTimeUtils.daysAfterWithoutTimeZone(null,1)); }