Search in sources :

Example 1 with OrderType

use of org.mapstruct.ap.test.value.OrderType in project mapstruct by mapstruct.

the class EnumToEnumMappingTest method shouldApplyReverseMappings.

@ProcessorTest
public void shouldApplyReverseMappings() {
    OrderType result = OrderMapper.INSTANCE.externalOrderTypeToOrderType(ExternalOrderType.SPECIAL);
    assertThat(result).isEqualTo(OrderType.EXTRA);
    result = OrderMapper.INSTANCE.externalOrderTypeToOrderType(ExternalOrderType.DEFAULT);
    assertThat(result).isEqualTo(OrderType.STANDARD);
    result = OrderMapper.INSTANCE.externalOrderTypeToOrderType(ExternalOrderType.RETAIL);
    assertThat(result).isEqualTo(OrderType.RETAIL);
    result = OrderMapper.INSTANCE.externalOrderTypeToOrderType(ExternalOrderType.B2B);
    assertThat(result).isEqualTo(OrderType.B2B);
}
Also used : OrderType(org.mapstruct.ap.test.value.OrderType) ExternalOrderType(org.mapstruct.ap.test.value.ExternalOrderType) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Example 2 with OrderType

use of org.mapstruct.ap.test.value.OrderType in project mapstruct by mapstruct.

the class EnumToEnumMappingTest method shouldApplyDefaultReverseMappings.

@ProcessorTest
public void shouldApplyDefaultReverseMappings() {
    OrderType result = SpecialOrderMapper.INSTANCE.externalOrderTypeToOrderType(ExternalOrderType.SPECIAL);
    assertThat(result).isEqualTo(OrderType.EXTRA);
    result = SpecialOrderMapper.INSTANCE.externalOrderTypeToOrderType(ExternalOrderType.DEFAULT);
    assertThat(result).isNull();
    result = SpecialOrderMapper.INSTANCE.externalOrderTypeToOrderType(ExternalOrderType.RETAIL);
    assertThat(result).isEqualTo(OrderType.RETAIL);
    result = SpecialOrderMapper.INSTANCE.externalOrderTypeToOrderType(ExternalOrderType.B2B);
    assertThat(result).isEqualTo(OrderType.B2B);
}
Also used : OrderType(org.mapstruct.ap.test.value.OrderType) ExternalOrderType(org.mapstruct.ap.test.value.ExternalOrderType) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Example 3 with OrderType

use of org.mapstruct.ap.test.value.OrderType 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);
}
Also used : OrderType(org.mapstruct.ap.test.value.OrderType) ExternalOrderType(org.mapstruct.ap.test.value.ExternalOrderType) IssueKey(org.mapstruct.ap.testutil.IssueKey) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest) WithClasses(org.mapstruct.ap.testutil.WithClasses)

Aggregations

ExternalOrderType (org.mapstruct.ap.test.value.ExternalOrderType)3 OrderType (org.mapstruct.ap.test.value.OrderType)3 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)3 IssueKey (org.mapstruct.ap.testutil.IssueKey)1 WithClasses (org.mapstruct.ap.testutil.WithClasses)1