HerdDateUtils extends DateUtils { public static Timestamp resetTimeToMidnight(XMLGregorianCalendar xmlGregorianCalendar) { Date date = xmlGregorianCalendar.toGregorianCalendar().getTime(); return new Timestamp(DateUtils.truncate(date, Calendar.DATE).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 testResetTimeToMidnight() throws DatatypeConfigurationException { XMLGregorianCalendar gregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar("2015-12-21T21:32:52"); Timestamp result = HerdDateUtils.resetTimeToMidnight(gregorianCalendar); assertEquals(Timestamp.valueOf("2015-12-21 00:00:00.0"), result); }