use of org.mapstruct.ap.test.conversion.java8time.localdatetoxmlgregoriancalendarconversion.Target in project mapstruct by mapstruct.
the class LocalDateToXMLGregorianCalendarConversionTest method shouldNullCheckOnBuiltinAndConversion.
@ProcessorTest
public void shouldNullCheckOnBuiltinAndConversion() {
Target target = SourceTargetMapper.INSTANCE.toTarget(new Source());
assertThat(target).isNotNull();
assertThat(target.getDate()).isNull();
Source source = SourceTargetMapper.INSTANCE.toSource(new Target());
assertThat(source).isNotNull();
assertThat(source.getDate()).isNull();
}
use of org.mapstruct.ap.test.conversion.java8time.localdatetoxmlgregoriancalendarconversion.Target in project mapstruct by mapstruct.
the class LocalDateToXMLGregorianCalendarConversionTest method shouldMapCorrectlyOnBuiltinAndConversion.
@ProcessorTest
public void shouldMapCorrectlyOnBuiltinAndConversion() throws Exception {
XMLGregorianCalendar calendarDate = DatatypeFactory.newInstance().newXMLGregorianCalendarDate(2007, 11, 14, DatatypeConstants.FIELD_UNDEFINED);
LocalDate localDate = LocalDate.of(2007, 11, 14);
Source s1 = new Source();
s1.setDate(calendarDate);
Target target = SourceTargetMapper.INSTANCE.toTarget(s1);
assertThat(target).isNotNull();
assertThat(target.getDate()).isEqualTo(localDate);
Target t1 = new Target();
t1.setDate(localDate);
Source source = SourceTargetMapper.INSTANCE.toSource(t1);
assertThat(source).isNotNull();
assertThat(source.getDate()).isEqualTo(calendarDate);
}
Aggregations