Search in sources :

Example 1 with ExternalOrderType

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

the class EnumToEnumMappingTest method shouldGenerateEnumMappingMethod.

@ProcessorTest
public void shouldGenerateEnumMappingMethod() {
    ExternalOrderType target = OrderMapper.INSTANCE.orderTypeToExternalOrderType(OrderType.B2B);
    assertThat(target).isEqualTo(ExternalOrderType.B2B);
    target = OrderMapper.INSTANCE.orderTypeToExternalOrderType(OrderType.RETAIL);
    assertThat(target).isEqualTo(ExternalOrderType.RETAIL);
}
Also used : ExternalOrderType(org.mapstruct.ap.test.value.ExternalOrderType) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Example 2 with ExternalOrderType

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

the class EnumToEnumMappingTest method shouldMapAnyRemainingToNullCorrectly.

@IssueKey("1091")
@ProcessorTest
public void shouldMapAnyRemainingToNullCorrectly() {
    ExternalOrderType externalOrderType = SpecialOrderMapper.INSTANCE.anyRemainingToNull(OrderType.RETAIL);
    assertThat(externalOrderType).isNotNull().isEqualTo(ExternalOrderType.RETAIL);
    externalOrderType = SpecialOrderMapper.INSTANCE.anyRemainingToNull(OrderType.B2B);
    assertThat(externalOrderType).isNotNull().isEqualTo(ExternalOrderType.B2B);
    externalOrderType = SpecialOrderMapper.INSTANCE.anyRemainingToNull(OrderType.EXTRA);
    assertThat(externalOrderType).isNull();
    externalOrderType = SpecialOrderMapper.INSTANCE.anyRemainingToNull(OrderType.STANDARD);
    assertThat(externalOrderType).isNull();
    externalOrderType = SpecialOrderMapper.INSTANCE.anyRemainingToNull(OrderType.NORMAL);
    assertThat(externalOrderType).isNull();
}
Also used : ExternalOrderType(org.mapstruct.ap.test.value.ExternalOrderType) IssueKey(org.mapstruct.ap.testutil.IssueKey) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Example 3 with ExternalOrderType

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

the class EnumToEnumMappingTest method shouldConsiderConstantMappings.

@ProcessorTest
public void shouldConsiderConstantMappings() {
    ExternalOrderType target = OrderMapper.INSTANCE.orderTypeToExternalOrderType(OrderType.EXTRA);
    assertThat(target).isEqualTo(ExternalOrderType.SPECIAL);
    target = OrderMapper.INSTANCE.orderTypeToExternalOrderType(OrderType.STANDARD);
    assertThat(target).isEqualTo(ExternalOrderType.DEFAULT);
    target = OrderMapper.INSTANCE.orderTypeToExternalOrderType(OrderType.NORMAL);
    assertThat(target).isEqualTo(ExternalOrderType.DEFAULT);
}
Also used : ExternalOrderType(org.mapstruct.ap.test.value.ExternalOrderType) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Aggregations

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