use of org.mapstruct.ap.test.builtin.bean.CalendarProperty in project mapstruct by mapstruct.
the class BuiltInTest method shouldApplyBuiltInOnCalendarToXmlGregCal.
@ProcessorTest
@WithClasses(CalendarToXmlGregCalMapper.class)
public void shouldApplyBuiltInOnCalendarToXmlGregCal() throws ParseException {
CalendarProperty source = new CalendarProperty();
source.setProp(createCalendar("02.03.1999"));
source.publicProp = createCalendar("02.03.2016");
XmlGregorianCalendarProperty target = CalendarToXmlGregCalMapper.INSTANCE.map(source);
assertThat(target).isNotNull();
assertThat(target.getProp()).isNotNull();
assertThat(target.getProp().toString()).isEqualTo("1999-03-02T00:00:00.000+01:00");
assertThat(target.publicProp).isNotNull();
assertThat(target.publicProp.toString()).isEqualTo("2016-03-02T00:00:00.000+01:00");
}
use of org.mapstruct.ap.test.builtin.bean.CalendarProperty in project mapstruct by mapstruct.
the class BuiltInTest method shouldApplyBuiltInOnCalendarToString.
@ProcessorTest
@WithClasses(CalendarToStringMapper.class)
public void shouldApplyBuiltInOnCalendarToString() throws ParseException {
CalendarProperty source = new CalendarProperty();
source.setProp(createCalendar("02.03.1999"));
source.publicProp = createCalendar("02.03.2016");
StringProperty target = CalendarToStringMapper.INSTANCE.map(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");
}
use of org.mapstruct.ap.test.builtin.bean.CalendarProperty in project mapstruct by mapstruct.
the class BuiltInTest method shouldApplyBuiltInOnDateToCalendar.
@ProcessorTest
@WithClasses(DateToCalendarMapper.class)
public void shouldApplyBuiltInOnDateToCalendar() throws ParseException {
DateProperty source = new DateProperty();
source.setProp(new SimpleDateFormat("dd.MM.yyyy").parse("02.03.1999"));
source.publicProp = new SimpleDateFormat("dd.MM.yyyy").parse("02.03.2016");
CalendarProperty target = DateToCalendarMapper.INSTANCE.map(source);
assertThat(target).isNotNull();
assertThat(target.getProp()).isNotNull();
assertThat(target.getProp()).isEqualTo(createCalendar("02.03.1999"));
assertThat(target.publicProp).isNotNull();
assertThat(target.publicProp).isEqualTo(createCalendar("02.03.2016"));
}
use of org.mapstruct.ap.test.builtin.bean.CalendarProperty in project mapstruct by mapstruct.
the class BuiltInTest method shouldApplyBuiltInOnStringToCalendar.
@ProcessorTest
@WithClasses(StringToCalendarMapper.class)
public void shouldApplyBuiltInOnStringToCalendar() throws ParseException {
StringProperty source = new StringProperty();
source.setProp("02.03.1999");
source.publicProp = "02.03.2016";
CalendarProperty target = StringToCalendarMapper.INSTANCE.map(source);
assertThat(target).isNotNull();
assertThat(target.getProp()).isNotNull();
assertThat(target.getProp()).isEqualTo(createCalendar("02.03.1999"));
assertThat(target.publicProp).isNotNull();
assertThat(target.publicProp).isEqualTo(createCalendar("02.03.2016"));
}
Aggregations