public class JPAEdmNameBuilderTest {
@SuppressWarnings("rawtypes")
@Test
public void testBuildJPAEdmComplexPropertyViewJPAEdmPropertyView() {
JPAEdmComplexPropertyView complexPropertyView = EasyMock.createMock(JPAEdmComplexPropertyView.class);
ComplexProperty complexProperty = new ComplexProperty();
EasyMock.expect(complexPropertyView.getEdmComplexProperty()).andStubReturn(complexProperty);
ODataJPAContextImpl oDataJPAContext = new ODataJPAContextImpl();
JPAEdmMappingModelService mappingModelService = new JPAEdmMappingModelService(oDataJPAContext);
EasyMock.expect(complexPropertyView.getJPAEdmMappingModelAccess()).andStubReturn(mappingModelService);
// Mocking EDMProperty
JPAEdmPropertyView propertyView = EasyMock.createMock(JPAEdmPropertyView.class);
JPAEdmEntityTypeView entityTypeView = EasyMock.createMock(JPAEdmEntityTypeView.class);
EasyMock.expect(entityTypeView.getJPAEntityType()).andStubReturn(new JEntityType());
EasyMock.replay(entityTypeView);
EasyMock.expect(propertyView.getJPAAttribute()).andStubReturn(new JAttribute());
EasyMock.expect(propertyView.getJPAEdmEntityTypeView()).andStubReturn(entityTypeView);
EasyMock.replay(complexPropertyView);
EasyMock.replay(propertyView);
JPAEdmNameBuilder.build(complexPropertyView, propertyView);
assertEquals("Id", complexPropertyView.getEdmComplexProperty().getName());
}