use of org.mapstruct.ap.testutil.IssueKey in project mapstruct by mapstruct.
the class EnumToEnumThrowExceptionMappingTest method shouldIgnoreThrowExceptionWhenInverseValueMappings.
@IssueKey("2339")
@ProcessorTest
@WithClasses({ OrderThrowExceptionMapper.class, OrderDto.class })
public void shouldIgnoreThrowExceptionWhenInverseValueMappings() {
OrderType target = OrderThrowExceptionMapper.INSTANCE.externalOrderTypeToOrderType(ExternalOrderType.B2B);
assertThat(target).isEqualTo(OrderType.B2B);
}
use of org.mapstruct.ap.testutil.IssueKey in project mapstruct by mapstruct.
the class AdderTest method testWildcardAdderTargetToSource.
@IssueKey("1170")
@ProcessorTest
public void testWildcardAdderTargetToSource() {
Target target = new Target();
target.addWithoutWildcard(2L);
target.addWildcardInTarget(2L);
target.getWildcardInSources().add(2L);
target.addWildcardInBoth(2L);
target.setWildcardAdderToSetters(Arrays.asList(2L));
Source source = AdderSourceTargetMapper.INSTANCE.toSource(target);
assertThat(source).isNotNull();
assertThat(source.getWithoutWildcards()).containsExactly("mouse");
((ListAssert<String>) assertThat(source.getWildcardInSources())).containsExactly("mouse");
assertThat(source.getWildcardInTargets()).containsExactly("mouse");
((ListAssert<String>) assertThat(source.getWildcardInBoths())).containsExactly("mouse");
((ListAssert<String>) assertThat(source.getWildcardAdderToSetters())).containsExactly("mouse");
}
use of org.mapstruct.ap.testutil.IssueKey in project mapstruct by mapstruct.
the class AdderTest method testWildcardAdder.
@IssueKey("1170")
@ProcessorTest
public void testWildcardAdder() {
Source source = new Source();
source.addWithoutWildcard("mouse");
source.addWildcardInTarget("mouse");
source.addWildcardInSource("mouse");
source.addWildcardInBoth("mouse");
source.addWildcardAdderToSetter("mouse");
Target target = AdderSourceTargetMapper.INSTANCE.toTarget(source);
assertThat(target).isNotNull();
assertThat(target.getWithoutWildcards()).containsExactly(2L);
assertThat(target.getWildcardInSources()).containsExactly(2L);
((ListAssert<Long>) assertThat(target.getWildcardInTargets())).containsExactly(2L);
((ListAssert<Long>) assertThat(target.getWildcardInBoths())).containsExactly(2L);
assertThat(target.getWildcardAdderToSetters()).containsExactly(2L);
}
use of org.mapstruct.ap.testutil.IssueKey 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.IssueKey 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();
}
Aggregations