Search in sources :

Example 1 with OrderShippingDetailsType

use of org.mapstruct.ap.test.selection.jaxb.test2.OrderShippingDetailsType in project mapstruct by mapstruct.

the class JaxbFactoryMethodSelectionTest method shouldMatchOnNameAndOrScope.

@Test
public void shouldMatchOnNameAndOrScope() {
    OrderType target = OrderMapper.INSTANCE.targetToSource(createSource());
    // qname and value should match for orderNumbers (distinct 1, 2)
    assertThat(target.getOrderNumber1().getValue()).isEqualTo(15L);
    assertThat(target.getOrderNumber1().getName()).isEqualTo(org.mapstruct.ap.test.selection.jaxb.test1.ObjectFactory.ORDER_TYPE_ORDER_NUMBER1_QNAME);
    assertThat(target.getOrderNumber2().getValue()).isEqualTo(31L);
    assertThat(target.getOrderNumber2().getName()).isEqualTo(org.mapstruct.ap.test.selection.jaxb.test1.ObjectFactory.ORDER_TYPE_ORDER_NUMBER2_QNAME);
    // qname should match for shipping details
    assertThat(target.getShippingDetails().getName()).isEqualTo(org.mapstruct.ap.test.selection.jaxb.test1.ObjectFactory.ORDER_TYPE_SHIPPING_DETAILS_QNAME);
    OrderShippingDetailsType shippingDetails = target.getShippingDetails().getValue();
    // qname and value should match (ObjectFactory = test2.ObjectFactory)
    assertThat(shippingDetails.getOrderShippedFrom().getValue()).isEqualTo("from");
    assertThat(shippingDetails.getOrderShippedFrom().getName()).isEqualTo(ObjectFactory.ORDER_SHIPPING_DETAILS_TYPE_ORDER_SHIPPED_FROM_QNAME);
    assertThat(shippingDetails.getOrderShippedTo().getValue()).isEqualTo("to");
    assertThat(shippingDetails.getOrderShippedTo().getName()).isEqualTo(ObjectFactory.ORDER_SHIPPING_DETAILS_TYPE_ORDER_SHIPPED_TO_QNAME);
}
Also used : OrderType(org.mapstruct.ap.test.selection.jaxb.test1.OrderType) OrderShippingDetailsType(org.mapstruct.ap.test.selection.jaxb.test2.OrderShippingDetailsType) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 OrderType (org.mapstruct.ap.test.selection.jaxb.test1.OrderType)1 OrderShippingDetailsType (org.mapstruct.ap.test.selection.jaxb.test2.OrderShippingDetailsType)1