public static EdmNavigationProperty mockEdmNavigationProperty(final String navigationPropertyName,
final EdmMultiplicity multiplicity) throws EdmException {
EdmEntityType edmEntityType = mockEdmEntityType(JPARelatedTypeMock.ENTITY_NAME, false);
EdmNavigationProperty navigationProperty = EasyMock.createMock(EdmNavigationProperty.class);
EasyMock.expect(navigationProperty.getType()).andReturn(edmEntityType).anyTimes();
EasyMock.expect(navigationProperty.getMultiplicity()).andReturn(multiplicity);
EasyMock.expect(navigationProperty.getMapping()).andReturn(
(EdmMapping) mockEdmMapping(null, null, navigationPropertyName));
EasyMock.expect(navigationProperty.getToRole()).andReturn("TO");
EasyMock.expect(navigationProperty.getRelationship()).andReturn(mockEdmAssociation(navigationPropertyName));
if (multiplicity.equals(EdmMultiplicity.ONE)) {
EasyMock.expect(navigationProperty.getName()).andReturn(JPATypeMock.NAVIGATION_PROPERTY_X);
}
EasyMock.replay(navigationProperty);
return navigationProperty;