HerdDateUtils extends DateUtils { public static Timestamp addDays(Timestamp timestamp, int amount) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(timestamp.getTime()); return new Timestamp(addDays(calendar.getTime(), amount).getTime()); }  static Calendar getCurrentCalendarNoTime(); static String formatDuration(long duration); static XMLGregorianCalendar now(); static XMLGregorianCalendar getXMLGregorianCalendarValue(Date date); static Timestamp addDays(Timestamp timestamp, int amount); static Timestamp addMinutes(Timestamp timestamp, int amount); static Timestamp resetTimeToMidnight(XMLGregorianCalendar xmlGregorianCalendar); static Timestamp convertToTimestamp(XMLGregorianCalendar xmlGregorianCalendar); static Boolean containsTimePortion(XMLGregorianCalendar xmlGregorianCalendar);  }
@Test public void testAddDays() { Timestamp testTimestamp = Timestamp.valueOf("2015-12-21 10:34:11"); int daysDiff = 99; assertEquals(Timestamp.valueOf("2016-03-29 10:34:11"), HerdDateUtils.addDays(testTimestamp, daysDiff)); assertEquals(testTimestamp, HerdDateUtils.addDays(testTimestamp, 0)); assertEquals(Timestamp.valueOf("2015-09-13 10:34:11"), HerdDateUtils.addDays(testTimestamp, -daysDiff)); }