HerdDateUtils extends DateUtils { public static XMLGregorianCalendar getXMLGregorianCalendarValue(Date date) { GregorianCalendar gregorianCalendar = new GregorianCalendar(); if (date != null) { gregorianCalendar.setTime(date); } try { return DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar); } catch (DatatypeConfigurationException ex) { throw new IllegalStateException("Failed to create a new instance of DataTypeFactory.", ex); } }  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 testGetXMLGregorianCalendarValue() { Calendar calendar = Calendar.getInstance(); XMLGregorianCalendar gregorianCalendar = HerdDateUtils.getXMLGregorianCalendarValue(calendar.getTime()); assertEquals(calendar.getTime(), gregorianCalendar.toGregorianCalendar().getTime()); }