use of org.mapstruct.ap.testutil.ProcessorTest 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.testutil.ProcessorTest in project mapstruct by mapstruct.
the class BuiltInTest method shouldApplyBuiltInOnJAXBElementList.
@ProcessorTest
@WithClasses({ JaxbListMapper.class, JaxbElementListProperty.class })
@WithJavaxJaxb
@IssueKey("141")
public void shouldApplyBuiltInOnJAXBElementList() {
JaxbElementListProperty source = new JaxbElementListProperty();
source.setProp(createJaxbList("TEST2"));
source.publicProp = createJaxbList("PUBLIC TEST2");
StringListProperty target = JaxbListMapper.INSTANCE.map(source);
assertThat(target).isNotNull();
assertThat(target.getProp().get(0)).isEqualTo("TEST2");
assertThat(target.publicProp.get(0)).isEqualTo("PUBLIC TEST2");
}
use of org.mapstruct.ap.testutil.ProcessorTest in project mapstruct by mapstruct.
the class BuiltInTest method shouldApplyBuiltInOnJAXBElementExtra.
@ProcessorTest
@WithClasses({ JaxbMapper.class, JaxbElementProperty.class })
@WithJavaxJaxb
@IssueKey("1698")
public void shouldApplyBuiltInOnJAXBElementExtra() {
JaxbElementProperty source = new JaxbElementProperty();
source.setProp(createJaxb("5"));
source.publicProp = createJaxb("5");
BigDecimalProperty target = JaxbMapper.INSTANCE.mapBD(source);
assertThat(target).isNotNull();
assertThat(target.getProp()).isEqualTo(new BigDecimal("5"));
assertThat(target.publicProp).isEqualTo(new BigDecimal("5"));
JaxbElementProperty source2 = new JaxbElementProperty();
source2.setProp(createJaxb("5"));
source2.publicProp = createJaxb("5");
SomeTypeProperty target2 = JaxbMapper.INSTANCE.mapSomeType(source2);
assertThat(target2).isNotNull();
assertThat(target2.publicProp).isNotNull();
assertThat(target2.getProp()).isNotNull();
}
use of org.mapstruct.ap.testutil.ProcessorTest in project mapstruct by mapstruct.
the class BuiltInTest method shouldApplyBuiltInOnCalendarToDate.
@ProcessorTest
@WithClasses(CalendarToDateMapper.class)
public void shouldApplyBuiltInOnCalendarToDate() throws ParseException {
CalendarProperty source = new CalendarProperty();
source.setProp(createCalendar("02.03.1999"));
source.publicProp = createCalendar("02.03.2016");
DateProperty target = CalendarToDateMapper.INSTANCE.map(source);
assertThat(target).isNotNull();
assertThat(target.getProp()).isNotNull();
assertThat(target.getProp()).isEqualTo(createCalendar("02.03.1999").getTime());
assertThat(target.publicProp).isNotNull();
assertThat(target.publicProp).isEqualTo(createCalendar("02.03.2016").getTime());
}
use of org.mapstruct.ap.testutil.ProcessorTest in project mapstruct by mapstruct.
the class BuiltInTest method shouldApplyBuiltInOnJAXBElement.
@ProcessorTest
@WithClasses({ JaxbMapper.class, JaxbElementProperty.class })
@WithJavaxJaxb
public void shouldApplyBuiltInOnJAXBElement() {
JaxbElementProperty source = new JaxbElementProperty();
source.setProp(createJaxb("TEST"));
source.publicProp = createJaxb("PUBLIC TEST");
StringProperty target = JaxbMapper.INSTANCE.map(source);
assertThat(target).isNotNull();
assertThat(target.getProp()).isEqualTo("TEST");
assertThat(target.publicProp).isEqualTo("PUBLIC TEST");
}
Aggregations