コード例 #1
0
  @Test
  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);
  }
コード例 #2
0
  @Test
  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);
  }
コード例 #3
0
  @Test
  public void shouldInvokeEnumMappingMethodForPropertyMapping() {
    OrderEntity order = new OrderEntity();
    order.setOrderType(OrderType.EXTRA);

    OrderDto orderDto = OrderMapper.INSTANCE.orderEntityToDto(order);
    assertThat(orderDto).isNotNull();
    assertThat(orderDto.getOrderType()).isEqualTo(ExternalOrderType.SPECIAL);
  }