Search in sources :

Example 6 with XmlGregorianCalendarProperty

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");
}
Also used : XmlGregorianCalendarProperty(org.mapstruct.ap.test.builtin.bean.XmlGregorianCalendarProperty) StringProperty(org.mapstruct.ap.test.builtin.bean.StringProperty) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest) WithClasses(org.mapstruct.ap.testutil.WithClasses)

Aggregations

XmlGregorianCalendarProperty (org.mapstruct.ap.test.builtin.bean.XmlGregorianCalendarProperty)6 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)6 WithClasses (org.mapstruct.ap.testutil.WithClasses)6 CalendarProperty (org.mapstruct.ap.test.builtin.bean.CalendarProperty)2 DateProperty (org.mapstruct.ap.test.builtin.bean.DateProperty)2 StringProperty (org.mapstruct.ap.test.builtin.bean.StringProperty)2