public void testGetNextNavigationProperty() {
JPAExpandCallBack callBack = getJPAExpandCallBackObject();
List<ArrayList<NavigationPropertySegment>> expandList = EdmMockUtil.getExpandList();
ArrayList<NavigationPropertySegment> expands = expandList.get(0);
expands.add(EdmMockUtil.mockThirdNavigationPropertySegment());
EdmNavigationProperty result = null;
try {
Field field = callBack.getClass().getDeclaredField("expandList");
field.setAccessible(true);
field.set(callBack, expandList);
Class<?>[] formalParams = { EdmEntityType.class, EdmNavigationProperty.class };
Object[] actualParams = { EdmMockUtil.mockSourceEdmEntityType(), EdmMockUtil.mockNavigationProperty() };
Method method = callBack.getClass().getDeclaredMethod("getNextNavigationProperty", formalParams);
method.setAccessible(true);
result = (EdmNavigationProperty) method.invoke(callBack, actualParams);
assertEquals("MaterialDetails", result.getName());
} catch (SecurityException e) {
fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
} catch (NoSuchFieldException e) {
fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);