use of org.mapstruct.ap.test.builtin.java8time.bean.ZonedDateTimeProperty in project mapstruct by mapstruct.
the class BuiltInTest method shouldApplyBuiltInOnZonedDateTimeToCalendar.
@ProcessorTest
@WithClasses(ZonedDateTimeToCalendarMapper.class)
public void shouldApplyBuiltInOnZonedDateTimeToCalendar() throws ParseException {
assertThat(ZonedDateTimeToCalendarMapper.INSTANCE.map(null)).isNull();
ZonedDateTimeProperty source = new ZonedDateTimeProperty();
source.setProp(ZonedDateTime.of(1999, 3, 2, 0, 0, 0, 0, ZoneId.systemDefault()));
source.publicProp = ZonedDateTime.of(2016, 3, 2, 0, 0, 0, 0, ZoneId.systemDefault());
CalendarProperty target = ZonedDateTimeToCalendarMapper.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.java8time.bean.ZonedDateTimeProperty in project mapstruct by mapstruct.
the class BuiltInTest method shouldApplyBuiltInOnCalendarToZonedDateTime.
@ProcessorTest
@WithClasses(CalendarToZonedDateTimeMapper.class)
public void shouldApplyBuiltInOnCalendarToZonedDateTime() throws ParseException {
assertThat(CalendarToZonedDateTimeMapper.INSTANCE.map(null)).isNull();
CalendarProperty source = new CalendarProperty();
source.setProp(createCalendar("02.03.1999"));
source.publicProp = createCalendar("02.03.2016");
ZonedDateTimeProperty target = CalendarToZonedDateTimeMapper.INSTANCE.map(source);
assertThat(target).isNotNull();
assertThat(target.getProp()).isNotNull();
assertThat(target.getProp()).isEqualTo(ZonedDateTime.of(1999, 3, 2, 0, 0, 0, 0, ZoneId.systemDefault()));
assertThat(target.publicProp).isNotNull();
assertThat(target.publicProp).isEqualTo(ZonedDateTime.of(2016, 3, 2, 0, 0, 0, 0, ZoneId.systemDefault()));
}
Aggregations