use of org.mapstruct.ap.test.builtin.bean.XmlGregorianCalendarProperty in project mapstruct by mapstruct.
the class BuiltInTest method shouldApplyBuiltInXmlGregCalToString.
@ProcessorTest
@WithClasses(XmlGregCalToStringMapper.class)
public void shouldApplyBuiltInXmlGregCalToString() throws DatatypeConfigurationException {
XmlGregorianCalendarProperty source = new XmlGregorianCalendarProperty();
source.setProp(createXmlCal(1999, 3, 2, 60));
source.publicProp = createXmlCal(2016, 3, 2, 60);
StringProperty target = XmlGregCalToStringMapper.INSTANCE.mapAndFormat(source);
assertThat(target).isNotNull();
assertThat(target.getProp()).isNotNull();
assertThat(target.getProp()).isEqualTo("02.03.1999");
assertThat(target.publicProp).isNotNull();
assertThat(target.publicProp).isEqualTo("02.03.2016");
source.setProp(createXmlCal(1999, 3, 2, 60));
source.publicProp = createXmlCal(2016, 3, 2, 60);
target = XmlGregCalToStringMapper.INSTANCE.map(source);
assertThat(target).isNotNull();
assertThat(target.getProp()).isNotNull();
assertThat(target.getProp()).isEqualTo("1999-03-02+01:00");
assertThat(target.publicProp).isNotNull();
assertThat(target.publicProp).isEqualTo("2016-03-02+01:00");
}
Aggregations