### Question:
RegistrationDateAdapter extends XmlAdapter<String, XMLGregorianCalendar> { @Override public String marshal(XMLGregorianCalendar xmlGregorianCalendar) { return xmlGregorianCalendar.toGregorianCalendar().toInstant().toString(); }  @Override XMLGregorianCalendar unmarshal(String datetime); @Override String marshal(XMLGregorianCalendar xmlGregorianCalendar);  }### Answer:
@Test public void marshalTest() throws Exception { XMLGregorianCalendar calendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(); calendar.setYear(2020); calendar.setMonth(2); calendar.setDay(1); calendar.setHour(2); calendar.setMinute(59); calendar.setSecond(0); String calendarStringRepresentation = calendar.toGregorianCalendar().toInstant().toString(); RegistrationDateAdapter adapter = new RegistrationDateAdapter(); assertEquals(calendarStringRepresentation, adapter.marshal(calendar)); }