return navigationProperty;
}
public static EdmProperty mockEdmProperty(final String entityName, final String propertyName) throws EdmException {
EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MINT) ||
propertyName.equals(JPATypeMock.PROPERTY_NAME_MSTRING) ||
propertyName.equals(JPATypeMock.PROPERTY_NAME_MDATETIME) ||
propertyName.equals(JPATypeMock.PROPERTY_NAME_MBLOB) ||
propertyName.equals(JPATypeMock.PROPERTY_NAME_CLOB) ||
propertyName.equals(JPATypeMock.PROPERTY_NAME_MCARRAY) ||
propertyName.equals(JPATypeMock.PROPERTY_NAME_MC) ||
propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHAR) ||
propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHARARRAY) ||
propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MSHORT) ||
propertyName.equals(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MFLOAT) ||
propertyName.equals(JPATypeMock.JPATypeEmbeddableMock2.PROPERTY_NAME_MUUID) ||
propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MLONG) ||
propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MBYTE) ||
propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE) ||
propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY)) {
EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class);
EasyMock.expect(edmProperty.getType()).andReturn(edmType).anyTimes();
EasyMock.expect(edmType.getKind()).andReturn(EdmTypeKind.SIMPLE).anyTimes();
if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MSTRING) ||
propertyName.equals(JPATypeMock.PROPERTY_NAME_MCARRAY) ||
propertyName.equals(JPATypeMock.PROPERTY_NAME_MC) ||
propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHAR) ||
propertyName.equals(JPATypeMock.PROPERTY_NAME_MCHARARRAY)) {
EasyMock.<Class<?>> expect(edmType.getDefaultType()).andReturn(String.class).anyTimes();
} else if (propertyName.equals(JPATypeMock.PROPERTY_NAME_MBLOB)) {
EasyMock.<Class<?>> expect(edmType.getDefaultType()).andReturn(Blob.class).anyTimes();
} else {
EasyMock.<Class<?>> expect(edmType.getDefaultType()).andReturn(Integer.class).anyTimes();
}
EasyMock.expect(edmType.isCompatible(EasyMock.isA(EdmSimpleType.class))).andReturn(true).anyTimes();
EasyMock.replay(edmType);
EasyMock.expect(edmProperty.getName()).andReturn(propertyName).anyTimes();
EasyMock.expect(edmProperty.getMapping()).andReturn((EdmMapping) mockEdmMapping(entityName, propertyName, null))
.anyTimes();
} else if (propertyName.equals(JPATypeMock.JPATypeEmbeddableMock.PROPERTY_NAME_MEMBEDDABLE) ||
propertyName.equals(JPATypeMock.PROPERTY_NAME_MCOMPLEXTYPE)) {
EdmComplexType complexType = mockComplexType(propertyName);
EasyMock.expect(edmProperty.getType()).andReturn(complexType).anyTimes();
EasyMock.expect(edmProperty.getName()).andReturn(propertyName).anyTimes();
EasyMock.expect(edmProperty.getMapping()).andReturn((EdmMapping) mockEdmMapping(null, propertyName, null))
.anyTimes();
}
EasyMock.replay(edmProperty);