use of io.atlasmap.java.test.SourceParentOrder in project atlasmap by atlasmap.
the class ClassHelperTest method testParentObjectForPathGrandParent.
@Test
public void testParentObjectForPathGrandParent() throws Exception {
SourceAddress sourceAddress = new SourceAddress();
SourceOrder sourceOrder = new SourceOrder();
sourceOrder.setAddress(sourceAddress);
SourceParentOrder sourceParentOrder = new SourceParentOrder();
sourceParentOrder.setOrder(sourceOrder);
Object parentObject = ClassHelper.parentObjectForPath(sourceParentOrder, new AtlasPath("/order/address/city"), true);
assertNotNull(parentObject);
assertTrue(parentObject instanceof SourceAddress);
assertEquals(sourceAddress, parentObject);
}
use of io.atlasmap.java.test.SourceParentOrder in project atlasmap by atlasmap.
the class JavaConstructServiceComplexTest method testConstructSourceParentOrder.
@Test
public void testConstructSourceParentOrder() throws Exception {
JavaClass javaClass = generateParentOrder("Source");
Object targetObject = constructService.constructClass(javaClass, null);
assertNotNull(targetObject);
assertTrue(targetObject instanceof SourceParentOrder);
SourceParentOrder parentOrder = (SourceParentOrder) targetObject;
assertNotNull(parentOrder.getOrder());
SourceOrder order = (SourceOrder) parentOrder.getOrder();
assertNotNull(order.getAddress());
assertTrue(order.getAddress() instanceof SourceAddress);
SourceAddress address = (SourceAddress) order.getAddress();
assertNull(address.getAddressLine1());
assertNull(address.getAddressLine2());
assertNull(address.getCity());
assertNull(address.getState());
assertNull(address.getZipCode());
assertNotNull(order.getContact());
assertTrue(order.getContact() instanceof SourceContact);
SourceContact contact = (SourceContact) order.getContact();
assertNull(contact.getFirstName());
assertNull(contact.getLastName());
assertNull(contact.getPhoneNumber());
assertNull(contact.getZipCode());
}
Aggregations