You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by tb...@apache.org on 2014/01/02 13:47:11 UTC

[24/47] [OLINGO-99] Re-factor Package Names. Following are the changes

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAResponseBuilderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAResponseBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAResponseBuilderTest.java
new file mode 100644
index 0000000..f4cc3f0
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAResponseBuilderTest.java
@@ -0,0 +1,567 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.commons.InlineCount;
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmLiteralKind;
+import org.apache.olingo.odata2.api.edm.EdmMapping;
+import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+import org.apache.olingo.odata2.api.edm.EdmSimpleType;
+import org.apache.olingo.odata2.api.edm.EdmSimpleTypeException;
+import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.api.edm.EdmTypeKind;
+import org.apache.olingo.odata2.api.edm.provider.EntityType;
+import org.apache.olingo.odata2.api.edm.provider.Facets;
+import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.exception.ODataNotFoundException;
+import org.apache.olingo.odata2.api.processor.ODataContext;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.uri.NavigationPropertySegment;
+import org.apache.olingo.odata2.api.uri.PathInfo;
+import org.apache.olingo.odata2.api.uri.SelectItem;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+import org.apache.olingo.odata2.jpa.processor.core.ODataJPAResponseBuilder;
+import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmTestModelView;
+import org.easymock.EasyMock;
+import org.junit.Test;
+
+public class ODataJPAResponseBuilderTest extends JPAEdmTestModelView {
+
+  /*
+   * This Unit is supposed to test the building of Entity Provider Properties for query with $expand
+   */
+  @Test
+  public void testGetEntityProviderPropertiesQuery() {
+    GetEntitySetUriInfo getEntitySetUriInfo = mockEntitySetUriInfoForExpand();
+    ODataJPAContext oDataJPAContext = getODataJPAContext();
+    // Building the edm entity
+    List<Map<String, Object>> edmEntityList = new ArrayList<Map<String, Object>>();
+    Map<String, Object> edmEntity = new HashMap<String, Object>();
+    edmEntity.put("ID", 1);
+    edmEntityList.add(edmEntity);
+    // Invoking the private static method using reflection
+    Class<?> clazz = ODataJPAResponseBuilder.class;
+    Object[] actualParameters = { oDataJPAContext, getEntitySetUriInfo, edmEntityList };
+    Class<?>[] formalParameters = { ODataJPAContext.class, GetEntitySetUriInfo.class, List.class };
+    EntityProviderWriteProperties providerProperties = null;
+    try {
+      ODataJPAResponseBuilder responseBuilder = (ODataJPAResponseBuilder) clazz.newInstance();
+      Method method = clazz.getDeclaredMethod("getEntityProviderProperties", formalParameters);
+      method.setAccessible(true);
+      providerProperties = (EntityProviderWriteProperties) method.invoke(responseBuilder, actualParameters);
+      assertEquals(1, providerProperties.getExpandSelectTree().getLinks().size());
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (IllegalArgumentException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (IllegalAccessException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (InvocationTargetException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (InstantiationException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  /*
+   * This Unit is supposed to test the building of Entity Provider Properties for read with $expand
+   */
+  @Test
+  public void testGetEntityProviderPropertiesRead() {
+
+    // Getting the EntityUriInfo
+    GetEntityUriInfo getEntityUriInfo = mockEntityUriInfoForExpand();
+    ODataJPAContext oDataJPAContext = getODataJPAContext();
+    Class<?> clazz = ODataJPAResponseBuilder.class;
+    Object[] actualParameters = { oDataJPAContext, getEntityUriInfo };
+    Class<?>[] formalParameters = { ODataJPAContext.class, GetEntityUriInfo.class };
+    EntityProviderWriteProperties providerProperties = null;
+    try {
+      ODataJPAResponseBuilder responseBuilder = (ODataJPAResponseBuilder) clazz.newInstance();
+      Method method = clazz.getDeclaredMethod("getEntityProviderProperties", formalParameters);
+      method.setAccessible(true);
+      providerProperties = (EntityProviderWriteProperties) method.invoke(responseBuilder, actualParameters);
+      assertEquals(1, providerProperties.getExpandSelectTree().getLinks().size());
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (IllegalArgumentException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (IllegalAccessException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (InvocationTargetException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (InstantiationException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+  }
+
+  @SuppressWarnings("unchecked")
+  @Test
+  public void testConstructListofNavProperty() {
+    List<ArrayList<NavigationPropertySegment>> expand = new ArrayList<ArrayList<NavigationPropertySegment>>();
+    ArrayList<NavigationPropertySegment> navPropList1 = new ArrayList<NavigationPropertySegment>();
+    navPropList1.add(getNavigationPropertySegment("DemoNavigationProperties11"));
+    navPropList1.add(getNavigationPropertySegment("DemoNavigationProperties12"));
+    expand.add(navPropList1);
+    ArrayList<NavigationPropertySegment> navPropList2 = new ArrayList<NavigationPropertySegment>();
+    navPropList2.add(getNavigationPropertySegment("DemoNavigationProperties21"));
+    navPropList2.add(getNavigationPropertySegment("DemoNavigationProperties22"));
+    expand.add(navPropList2);
+    Class<?> clazz = ODataJPAResponseBuilder.class;
+    Object[] actualParameters = { expand };
+    Class<?>[] formalParameters = { List.class };
+    List<EdmNavigationProperty> navigationProperties = null;
+    try {
+      ODataJPAResponseBuilder responseBuilder = (ODataJPAResponseBuilder) clazz.newInstance();
+      Method method = clazz.getDeclaredMethod("constructListofNavProperty", formalParameters);
+      method.setAccessible(true);
+      navigationProperties = (List<EdmNavigationProperty>) method.invoke(responseBuilder, actualParameters);
+      assertEquals("DemoNavigationProperties21", navigationProperties.get(1).getName());
+      assertEquals("DemoNavigationProperties11", navigationProperties.get(0).getName());
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (IllegalArgumentException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (IllegalAccessException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (InvocationTargetException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (InstantiationException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+  }
+
+  @Test
+  public void testBuildListOfTGetEntitySetUriInfoStringODataJPAContext() {
+    try {
+      assertNotNull(ODataJPAResponseBuilder.build(getJPAEntities(), getResultsView(), "application/xml",
+          getODataJPAContext()));
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+  }
+
+  @Test
+  public void testBuildNegatives() {// Bad content type
+    try {
+      EntityType entity = new EntityType();
+      entity.setName("SalesOrderHeader");
+      try {
+        assertNotNull(ODataJPAResponseBuilder.build(getEntity(), getLocalGetURIInfo(), "xml", getODataJPAContext()));
+      } catch (ODataNotFoundException e) {
+        assertTrue(true);
+      }
+    } catch (ODataJPARuntimeException e) {
+      assertTrue(true);// Nothing to do, Expected.
+    }
+    try {// Bad content type
+      assertNotNull(ODataJPAResponseBuilder.build(getJPAEntities(), getResultsView(), "xml", getODataJPAContext()));
+    } catch (ODataJPARuntimeException e) {
+      assertTrue(true);// Nothing to do, Expected.
+    }
+
+  }
+
+  @Test
+  public void testBuildObjectGetEntityUriInfoStringODataJPAContext() throws ODataNotFoundException {
+    try {
+      assertNotNull(ODataJPAResponseBuilder.build(new SalesOrderHeader(2, 10), getLocalGetURIInfo(), "application/xml",
+          getODataJPAContext()));
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testBuildNullSelects() {// Bad content type
+    try {
+      ODataJPAResponseBuilder.build(getJPAEntities(), getResultsViewWithNullSelects(), "xml", getODataJPAContext());
+    } catch (ODataJPARuntimeException e) {
+      assertTrue(true);// Nothing to do, Expected.
+    } catch (Exception e) {
+      assertTrue(true);
+    }
+  }
+
+  @Test
+  public void testBuildGetCount() {
+    ODataResponse objODataResponse = null;
+    try {
+      objODataResponse = ODataJPAResponseBuilder.build(1, getODataJPAContext());
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    assertNotNull(objODataResponse);
+  }
+
+  private ODataJPAContext getODataJPAContext() {
+    ODataJPAContext objODataJPAContext = EasyMock.createMock(ODataJPAContext.class);
+    EasyMock.expect(objODataJPAContext.getODataContext()).andStubReturn(getLocalODataContext());
+    EasyMock.replay(objODataJPAContext);
+    return objODataJPAContext;
+  }
+
+  private ODataContext getLocalODataContext() {
+    ODataContext objODataContext = EasyMock.createMock(ODataContext.class);
+    try {
+      EasyMock.expect(objODataContext.getPathInfo()).andStubReturn(getLocalPathInfo());
+    } catch (ODataException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(objODataContext);
+    return objODataContext;
+  }
+
+  private PathInfo getLocalPathInfo() {
+    PathInfo pathInfo = EasyMock.createMock(PathInfo.class);
+    EasyMock.expect(pathInfo.getServiceRoot()).andStubReturn(getLocalURI());
+    EasyMock.replay(pathInfo);
+    return pathInfo;
+  }
+
+  private URI getLocalURI() {
+    URI uri = null;
+    try {
+      uri = new URI("http://localhost:8080/org.apache.olingo.odata2.processor.ref.web/");
+    } catch (URISyntaxException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    return uri;
+  }
+
+  private GetEntitySetUriInfo getResultsView() {
+    GetEntitySetUriInfo objGetEntitySetUriInfo = EasyMock.createMock(GetEntitySetUriInfo.class);
+    EasyMock.expect(objGetEntitySetUriInfo.getInlineCount()).andStubReturn(getLocalInlineCount());
+    EasyMock.expect(objGetEntitySetUriInfo.getTargetEntitySet()).andStubReturn(getLocalTargetEntitySet());
+    EasyMock.expect(objGetEntitySetUriInfo.getSelect()).andStubReturn(getSelectItemList());
+    EasyMock.expect(objGetEntitySetUriInfo.getExpand()).andStubReturn(getExpandList());
+    EasyMock.expect(objGetEntitySetUriInfo.getSkip()).andStubReturn(new Integer(1));
+    EasyMock.replay(objGetEntitySetUriInfo);
+    return objGetEntitySetUriInfo;
+  }
+
+  private List<ArrayList<NavigationPropertySegment>> getExpandList() {
+    List<ArrayList<NavigationPropertySegment>> expandList = new ArrayList<ArrayList<NavigationPropertySegment>>();
+    return expandList;
+  }
+
+  private GetEntitySetUriInfo getResultsViewWithNullSelects() {
+    GetEntitySetUriInfo objGetEntitySetUriInfo = EasyMock.createMock(GetEntitySetUriInfo.class);
+    EasyMock.expect(objGetEntitySetUriInfo.getInlineCount()).andStubReturn(getLocalInlineCount());
+    EasyMock.expect(objGetEntitySetUriInfo.getTargetEntitySet()).andStubReturn(getLocalTargetEntitySet());
+    EasyMock.expect(objGetEntitySetUriInfo.getSelect()).andStubReturn(null);
+    EasyMock.expect(objGetEntitySetUriInfo.getExpand()).andStubReturn(null);
+    EasyMock.expect(objGetEntitySetUriInfo.getSkip()).andStubReturn(new Integer(1));
+
+    EasyMock.replay(objGetEntitySetUriInfo);
+    return objGetEntitySetUriInfo;
+  }
+
+  private GetEntityUriInfo getLocalGetURIInfo() {
+    GetEntityUriInfo objGetEntityUriInfo = EasyMock.createMock(GetEntityUriInfo.class);
+    EasyMock.expect(objGetEntityUriInfo.getSelect()).andStubReturn(getSelectItemList());
+    EasyMock.expect(objGetEntityUriInfo.getTargetEntitySet()).andStubReturn(getLocalTargetEntitySet());
+    EasyMock.expect(objGetEntityUriInfo.getExpand()).andStubReturn(getExpandList());
+    EasyMock.replay(objGetEntityUriInfo);
+    return objGetEntityUriInfo;
+  }
+
+  private List<SelectItem> getSelectItemList() {
+    List<SelectItem> selectItems = new ArrayList<SelectItem>();
+    selectItems.add(getSelectItem());
+    return selectItems;
+  }
+
+  private SelectItem getSelectItem() {
+    SelectItem selectItem = EasyMock.createMock(SelectItem.class);
+    EasyMock.expect(selectItem.getProperty()).andStubReturn(getEdmPropertyForSelect());
+    List<NavigationPropertySegment> navigationSegmentList = new ArrayList<NavigationPropertySegment>();
+    EasyMock.expect(selectItem.getNavigationPropertySegments()).andStubReturn(navigationSegmentList);
+    EasyMock.replay(selectItem);
+    return selectItem;
+  }
+
+  private EdmProperty getEdmPropertyForSelect() {
+    EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class);
+    EasyMock.expect(edmType.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
+    Facets facets = new Facets().setNullable(false);
+    try {
+      EasyMock.expect(edmType.valueToString(new Integer(2), EdmLiteralKind.URI, facets)).andStubReturn("2");
+      EasyMock.expect(edmType.valueToString(new Integer(2), EdmLiteralKind.DEFAULT, facets)).andStubReturn("2");
+    } catch (EdmSimpleTypeException e1) {
+      fail("There is an exception in mocking EdmType object " + e1.getMessage());
+    }
+    EasyMock.replay(edmType);
+    EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
+    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
+    EasyMock.expect(edmMapping.getInternalName()).andStubReturn("soId");
+    EasyMock.expect(edmMapping.getMimeType()).andReturn(null);
+    EasyMock.replay(edmMapping);
+    try {
+      EasyMock.expect(edmProperty.getName()).andStubReturn("ID");
+      EasyMock.expect(edmProperty.getType()).andStubReturn(edmType);
+      EasyMock.expect(edmProperty.getMapping()).andStubReturn(edmMapping);
+      EasyMock.expect(edmProperty.getFacets()).andStubReturn(facets);
+      EasyMock.expect(edmProperty.getCustomizableFeedMappings()).andStubReturn(null);
+      EasyMock.expect(edmProperty.getMimeType()).andStubReturn(null);
+      EasyMock.replay(edmProperty);
+
+    } catch (EdmException e) {
+      fail("There is an exception in mocking some object " + e.getMessage());
+    }
+
+    return edmProperty;
+
+  }
+
+  private EdmEntitySet getLocalTargetEntitySet() {
+    EdmEntitySet objEdmEntitySet = EasyMock.createMock(EdmEntitySet.class);
+    try {
+      EasyMock.expect(objEdmEntitySet.getEntityType()).andStubReturn(getLocalEdmEntityType());
+      EasyMock.expect(objEdmEntitySet.getName()).andStubReturn("SalesOderHeaders");
+      EasyMock.expect(objEdmEntitySet.getEntityContainer()).andStubReturn(getLocalEdmEntityContainer());
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+    EasyMock.replay(objEdmEntitySet);
+    return objEdmEntitySet;
+  }
+
+  private EdmEntityContainer getLocalEdmEntityContainer() {
+    EdmEntityContainer edmEntityContainer = EasyMock.createMock(EdmEntityContainer.class);
+    EasyMock.expect(edmEntityContainer.isDefaultEntityContainer()).andStubReturn(true);
+    try {
+      EasyMock.expect(edmEntityContainer.getName()).andStubReturn("salesorderprocessingContainer");
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+    EasyMock.replay(edmEntityContainer);
+    return edmEntityContainer;
+  }
+
+  private EdmEntityType getLocalEdmEntityType() {
+    EdmEntityType objEdmEntityType = EasyMock.createMock(EdmEntityType.class);
+    try {
+      EasyMock.expect(objEdmEntityType.getName()).andStubReturn("SalesOderHeaders");
+      EasyMock.expect(objEdmEntityType.getNamespace()).andStubReturn("SalesOderHeaders");
+      EasyMock.expect(objEdmEntityType.hasStream()).andStubReturn(false);
+      EasyMock.expect(objEdmEntityType.hasStream()).andStubReturn(false);
+      ArrayList<String> propertyNames = new ArrayList<String>();
+      propertyNames.add("ID");
+      EasyMock.expect(objEdmEntityType.getProperty("ID")).andStubReturn(getEdmPropertyForSelect());
+      EasyMock.expect(objEdmEntityType.getPropertyNames()).andStubReturn(propertyNames);
+      EasyMock.expect(objEdmEntityType.getNavigationPropertyNames()).andStubReturn(new ArrayList<String>());
+      EasyMock.expect(objEdmEntityType.getKeyPropertyNames()).andStubReturn(propertyNames);
+      EasyMock.expect(objEdmEntityType.getKeyProperties()).andStubReturn(getKeyProperties());
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(objEdmEntityType);
+    return objEdmEntityType;
+  }
+
+  private List<EdmProperty> getKeyProperties() {
+    List<EdmProperty> edmProperties = new ArrayList<EdmProperty>();
+    EdmType edmType = EasyMock.createMock(EdmType.class);
+    EasyMock.expect(edmType.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
+    EasyMock.replay(edmType);
+    EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
+    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
+    EasyMock.expect(edmMapping.getInternalName()).andStubReturn("soId");
+    EasyMock.replay(edmMapping);
+    try {
+      EasyMock.expect(edmProperty.getName()).andStubReturn("ID");
+      EasyMock.expect(edmProperty.getType()).andStubReturn(edmType);
+      EasyMock.expect(edmProperty.getMapping()).andStubReturn(edmMapping);
+      EasyMock.replay(edmProperty);
+    } catch (EdmException e) {
+      fail("There is an exception is mocking some object " + e.getMessage());
+    }
+
+    edmProperties.add(edmProperty);
+    return edmProperties;
+  }
+
+  private InlineCount getLocalInlineCount() {
+    return InlineCount.NONE;
+  }
+
+  class SalesOrderHeader {
+    private int soId;
+    private int Field1;
+
+    public SalesOrderHeader(final int soId, final int field) {
+      this.soId = soId;
+      Field1 = field;
+    }
+
+    public int getField1() {
+      return Field1;
+    }
+
+    public void setField1(final int field1) {
+      Field1 = field1;
+    }
+
+    public int getSoId() {
+      return soId;
+    }
+
+    public void setSoId(final int soId) {
+      this.soId = soId;
+    }
+
+  }
+
+  private List<Object> getJPAEntities() {
+    List<Object> listJPAEntities = new ArrayList<Object>();
+    SalesOrderHeader entity;
+    entity = new SalesOrderHeader(2, 10);
+    listJPAEntities.add(entity);
+    return listJPAEntities;
+  }
+
+  private Object getEntity() {
+    SalesOrderHeader sHeader = new SalesOrderHeader(10, 34);
+    return sHeader;
+  }
+
+  private GetEntityUriInfo mockEntityUriInfoForExpand() {
+
+    List<SelectItem> selectItemList = new ArrayList<SelectItem>();
+    List<ArrayList<NavigationPropertySegment>> expandList = new ArrayList<ArrayList<NavigationPropertySegment>>();
+    ArrayList<NavigationPropertySegment> navigationPropertyList = new ArrayList<NavigationPropertySegment>();
+    // Mocking the navigation property
+    EdmNavigationProperty navigationProperty = EasyMock.createMock(EdmNavigationProperty.class);
+    try {
+      EasyMock.expect(navigationProperty.getName()).andStubReturn("SalesOrderItemDetails");
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(navigationProperty);
+    // Mocking the navigation property segments and adding to expand list
+    NavigationPropertySegment navigationPropertySegment = EasyMock.createMock(NavigationPropertySegment.class);
+    EasyMock.expect(navigationPropertySegment.getNavigationProperty()).andStubReturn(navigationProperty);
+    EasyMock.expect(navigationPropertySegment.getTargetEntitySet()).andStubReturn(getTargetEntitySetForExpand());
+    EasyMock.replay(navigationPropertySegment);
+    navigationPropertyList.add(navigationPropertySegment);
+    expandList.add(navigationPropertyList);
+    // Mocking EntityUriInfo
+    GetEntityUriInfo entityUriInfo = EasyMock.createMock(GetEntityUriInfo.class);
+    EasyMock.expect(entityUriInfo.getSelect()).andStubReturn(selectItemList);
+    EasyMock.expect(entityUriInfo.getExpand()).andStubReturn(expandList);
+    EasyMock.replay(entityUriInfo);
+    return entityUriInfo;
+  }
+
+  private GetEntitySetUriInfo mockEntitySetUriInfoForExpand() {
+
+    List<SelectItem> selectItemList = new ArrayList<SelectItem>();
+    List<ArrayList<NavigationPropertySegment>> expandList = new ArrayList<ArrayList<NavigationPropertySegment>>();
+    ArrayList<NavigationPropertySegment> navigationPropertyList = new ArrayList<NavigationPropertySegment>();
+    // Mocking the navigation property
+    EdmNavigationProperty navigationProperty = EasyMock.createMock(EdmNavigationProperty.class);
+    try {
+      EasyMock.expect(navigationProperty.getName()).andStubReturn("SalesOrderItemDetails");
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(navigationProperty);
+    // Mocking the navigation property segments and adding to expand list
+    NavigationPropertySegment navigationPropertySegment = EasyMock.createMock(NavigationPropertySegment.class);
+    EasyMock.expect(navigationPropertySegment.getNavigationProperty()).andStubReturn(navigationProperty);
+    EasyMock.expect(navigationPropertySegment.getTargetEntitySet()).andStubReturn(getTargetEntitySetForExpand());
+    EasyMock.replay(navigationPropertySegment);
+    navigationPropertyList.add(navigationPropertySegment);
+    expandList.add(navigationPropertyList);
+    // Mocking EntityUriInfo
+    GetEntitySetUriInfo entitySetUriInfo = EasyMock.createMock(GetEntitySetUriInfo.class);
+    EasyMock.expect(entitySetUriInfo.getSelect()).andStubReturn(selectItemList);
+    EasyMock.expect(entitySetUriInfo.getExpand()).andStubReturn(expandList);
+    EasyMock.expect(entitySetUriInfo.getInlineCount()).andStubReturn(InlineCount.ALLPAGES);
+    EasyMock.expect(entitySetUriInfo.getSkip()).andStubReturn(new Integer(1));
+    EasyMock.expect(entitySetUriInfo.getTop()).andStubReturn(new Integer(2));
+    EasyMock.replay(entitySetUriInfo);
+    return entitySetUriInfo;
+  }
+
+  private EdmEntitySet getTargetEntitySetForExpand() {
+    EdmEntitySet entitySet = EasyMock.createMock(EdmEntitySet.class);
+    try {
+      EasyMock.expect(entitySet.getName()).andStubReturn("SalesOrderHeaders");
+      EasyMock.expect(entitySet.getEntityType()).andStubReturn(null);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(entitySet);
+    return entitySet;
+  }
+
+  private NavigationPropertySegment getNavigationPropertySegment(final String navPropertyName) {
+    EdmNavigationProperty navigationProperty = EasyMock.createMock(EdmNavigationProperty.class);
+    try {
+      EasyMock.expect(navigationProperty.getName()).andStubReturn(navPropertyName);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(navigationProperty);
+    NavigationPropertySegment navPropertySegment = EasyMock.createMock(NavigationPropertySegment.class);
+    EasyMock.expect(navPropertySegment.getNavigationProperty()).andStubReturn(navigationProperty);
+    EasyMock.replay(navPropertySegment);
+    return navPropertySegment;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTest.java
new file mode 100644
index 0000000..213b51b
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTest.java
@@ -0,0 +1,600 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.core.access.data;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmMapping;
+import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+import org.apache.olingo.odata2.api.edm.EdmStructuralType;
+import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.api.edm.EdmTypeKind;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAEntityParser;
+import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.easymock.EasyMock;
+import org.junit.Test;
+
+public class JPAEntityParserTest {
+  /*
+   * TestCase - JPAResultParser is a singleton class Check if the same
+   * instance is returned when create method is called
+   */
+  @Test
+  public void testCreate() {
+    JPAEntityParser resultParser1 = new JPAEntityParser();
+    JPAEntityParser resultParser2 = new JPAEntityParser();
+
+    if (resultParser1.equals(resultParser2)) {
+      fail();
+    }
+  }
+
+  @Test
+  public void testparse2EdmPropertyValueMap() {
+    JPAEntityParser resultParser = new JPAEntityParser();
+    Object jpaEntity = new demoItem("abc", 10);
+    EdmStructuralType structuralType = EasyMock.createMock(EdmStructuralType.class);
+    EdmProperty edmTyped = EasyMock.createMock(EdmProperty.class);
+    EdmType edmType = EasyMock.createMock(EdmType.class);
+    EdmProperty edmTyped01 = EasyMock.createMock(EdmProperty.class);
+    EdmType edmType01 = EasyMock.createMock(EdmType.class);
+    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
+    EdmMapping edmMapping01 = EasyMock.createMock(EdmMapping.class);
+
+    try {
+      EasyMock.expect(edmType.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
+      EasyMock.expect(edmTyped.getName()).andStubReturn("identifier");
+      EasyMock.replay(edmType);
+      EasyMock.expect(edmMapping.getInternalName()).andStubReturn("id");
+      EasyMock.replay(edmMapping);
+      EasyMock.expect(edmTyped.getType()).andStubReturn(edmType);
+      EasyMock.expect(edmTyped.getMapping()).andStubReturn(edmMapping);
+      EasyMock.replay(edmTyped);
+      EasyMock.expect(structuralType.getProperty("identifier")).andStubReturn(edmTyped);
+
+      EasyMock.expect(edmType01.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
+      EasyMock.expect(edmTyped01.getName()).andStubReturn("Value");
+      EasyMock.replay(edmType01);
+      EasyMock.expect(edmMapping01.getInternalName()).andStubReturn("value");
+      EasyMock.replay(edmMapping01);
+      EasyMock.expect(edmTyped01.getType()).andStubReturn(edmType01);
+      EasyMock.expect(edmTyped01.getMapping()).andStubReturn(edmMapping01);
+      EasyMock.replay(edmTyped01);
+      EasyMock.expect(structuralType.getProperty("value")).andStubReturn(edmTyped01);
+
+      List<String> propNames = new ArrayList<String>();
+      propNames.add("identifier");
+      propNames.add("value");
+      EasyMock.expect(structuralType.getPropertyNames()).andReturn(propNames);
+      EasyMock.replay(structuralType);
+
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+    try {
+      Map<String, Object> result = resultParser.parse2EdmPropertyValueMap(jpaEntity, structuralType);
+      assertEquals(2, result.size());
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+  }
+
+  @Test
+  public void testparse2EdmPropertyValueMapEdmExcep() {
+    JPAEntityParser resultParser = new JPAEntityParser();
+    Object jpaEntity = new demoItem("abc", 10);
+    EdmStructuralType structuralType = EasyMock
+        .createMock(EdmStructuralType.class);
+    EdmProperty edmTyped = EasyMock.createMock(EdmProperty.class);
+    EdmType edmType = EasyMock.createMock(EdmType.class);
+    EdmProperty edmTyped01 = EasyMock.createMock(EdmProperty.class);
+    EdmType edmType01 = EasyMock.createMock(EdmType.class);
+    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
+    EdmMapping edmMapping01 = EasyMock.createMock(EdmMapping.class);
+
+    try {
+      EasyMock.expect(edmType.getKind())
+          .andStubReturn(EdmTypeKind.SIMPLE);
+      EasyMock.expect(edmType.getName()).andReturn("identifier");
+      EasyMock.replay(edmType);
+      EasyMock.expect(edmMapping.getInternalName()).andStubReturn("id");
+      EasyMock.replay(edmMapping);
+      EasyMock.expect(edmTyped.getType()).andStubThrow(
+          new EdmException(null));
+      EasyMock.expect(edmTyped.getMapping()).andStubReturn(edmMapping);
+      EasyMock.expect(edmTyped.getName()).andReturn("identifier");
+      EasyMock.replay(edmTyped);
+      EasyMock.expect(structuralType.getProperty("identifier"))
+          .andStubReturn(edmTyped);
+
+      EasyMock.expect(edmType01.getKind()).andStubReturn(
+          EdmTypeKind.SIMPLE);
+      EasyMock.expect(edmType01.getName()).andStubReturn("value");
+      EasyMock.replay(edmType01);
+      EasyMock.expect(edmMapping01.getInternalName()).andStubReturn(
+          "value");
+      EasyMock.replay(edmMapping01);
+      EasyMock.expect(edmTyped01.getName()).andReturn("value");
+      EasyMock.expect(edmTyped01.getType()).andStubReturn(edmType01);
+      EasyMock.expect(edmTyped01.getMapping())
+          .andStubReturn(edmMapping01);
+      EasyMock.replay(edmTyped01);
+      EasyMock.expect(structuralType.getProperty("value")).andStubReturn(
+          edmTyped01);
+
+      List<String> propNames = new ArrayList<String>();
+      propNames.add("identifier");
+      propNames.add("value");
+      EasyMock.expect(structuralType.getPropertyNames()).andReturn(
+          propNames);
+      EasyMock.replay(structuralType);
+
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2); // assertTrue(false);
+    }
+
+    try {
+      resultParser.parse2EdmPropertyValueMap(jpaEntity, structuralType);
+    } catch (ODataJPARuntimeException e) {
+      assertTrue(true);
+    }
+
+  }
+
+  @Test
+  public void testparse2EdmPropertyListMap() {
+    JPAEntityParser resultParser = new JPAEntityParser();
+    Map<String, Object> edmEntity = new HashMap<String, Object>();
+    edmEntity.put("SoId", 1);
+    DemoRelatedEntity relatedEntity = new DemoRelatedEntity("NewOrder");
+    demoItem jpaEntity = new demoItem("laptop", 1);
+    jpaEntity.setRelatedEntity(relatedEntity);
+    List<EdmNavigationProperty> navigationPropertyList = new ArrayList<EdmNavigationProperty>();
+    // Mocking a navigation property and its mapping object
+    EdmNavigationProperty navigationProperty = EasyMock.createMock(EdmNavigationProperty.class);
+    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
+    try {
+      EasyMock.expect(edmMapping.getInternalName()).andStubReturn("relatedEntity");
+      EasyMock.replay(edmMapping);
+      EasyMock.expect(navigationProperty.getName()).andStubReturn("RelatedEntities");
+      EasyMock.expect(navigationProperty.getMapping()).andStubReturn(edmMapping);
+      EasyMock.replay(navigationProperty);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+    navigationPropertyList.add(navigationProperty);
+    try {
+      HashMap<String, Object> result = resultParser.parse2EdmNavigationValueMap(jpaEntity, navigationPropertyList);
+      assertEquals(relatedEntity, result.get("RelatedEntities"));
+
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testparse2EdmPropertyValueMapFromList() {
+    JPAEntityParser resultParser = new JPAEntityParser();
+    demoItem jpaEntity = new demoItem("laptop", 1);
+    DemoRelatedEntity relatedEntity = new DemoRelatedEntity("DemoOrder");
+    jpaEntity.setRelatedEntity(relatedEntity);
+    List<EdmProperty> selectPropertyList = new ArrayList<EdmProperty>();
+    // Mocking EdmProperties
+    EdmProperty edmProperty1 = EasyMock.createMock(EdmProperty.class);
+    EdmProperty edmProperty2 = EasyMock.createMock(EdmProperty.class);
+    EdmType edmType1 = EasyMock.createMock(EdmType.class);
+    EdmType edmType2 = EasyMock.createMock(EdmType.class);
+    EdmMapping mapping1 = EasyMock.createMock(EdmMapping.class);
+    EdmMapping mapping2 = EasyMock.createMock(EdmMapping.class);
+    try {
+      EasyMock.expect(edmType1.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
+      EasyMock.replay(edmType1);
+      EasyMock.expect(mapping1.getInternalName()).andStubReturn("id");
+      EasyMock.replay(mapping1);
+      EasyMock.expect(edmProperty1.getName()).andStubReturn("Id");
+      EasyMock.expect(edmProperty1.getMapping()).andStubReturn(mapping1);
+      EasyMock.expect(edmProperty1.getType()).andStubReturn(edmType1);
+      EasyMock.replay(edmProperty1);
+      EasyMock.expect(edmType2.getKind()).andStubReturn(EdmTypeKind.COMPLEX);
+      EasyMock.replay(edmType2);
+      EasyMock.expect(mapping2.getInternalName()).andStubReturn("relatedEntity.order");
+      EasyMock.replay(mapping2);
+      EasyMock.expect(edmProperty2.getName()).andStubReturn("Order");
+      EasyMock.expect(edmProperty2.getMapping()).andStubReturn(mapping2);
+      EasyMock.expect(edmProperty2.getType()).andStubReturn(edmType2);
+      EasyMock.replay(edmProperty2);
+
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    selectPropertyList.add(edmProperty1);
+    selectPropertyList.add(edmProperty2);
+    try {
+      Map<String, Object> result = resultParser.parse2EdmPropertyValueMap(jpaEntity, selectPropertyList);
+      assertEquals("DemoOrder", result.get("Order"));
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+  }
+
+  // This unit tests when there is a complex type in the select list
+  @SuppressWarnings("unchecked")
+  @Test
+  public void testparse2EdmPropertyValueMapFromListComplex() {
+    JPAEntityParser resultParser = new JPAEntityParser();
+    demoItem jpaEntity = new demoItem("laptop", 1);
+    DemoRelatedEntity relatedEntity = new DemoRelatedEntity("DemoOrder");
+    jpaEntity.setRelatedEntity(relatedEntity);
+    List<EdmProperty> selectPropertyList = new ArrayList<EdmProperty>();
+    // Mocking EdmProperties
+    EdmProperty edmProperty1 = EasyMock.createMock(EdmProperty.class);
+    EdmProperty edmProperty2 = EasyMock.createMock(EdmProperty.class);
+    EdmProperty edmComplexProperty = EasyMock.createMock(EdmProperty.class);
+    EdmType edmType1 = EasyMock.createMock(EdmType.class);
+    EdmStructuralType edmType2 = EasyMock.createMock(EdmStructuralType.class);
+    EdmType edmComplexType = EasyMock.createMock(EdmType.class);
+    EdmMapping mapping1 = EasyMock.createMock(EdmMapping.class);
+    EdmMapping mapping2 = EasyMock.createMock(EdmMapping.class);
+    EdmMapping complexMapping = EasyMock.createMock(EdmMapping.class);
+    try {
+      EasyMock.expect(edmType1.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
+      EasyMock.replay(edmType1);
+      EasyMock.expect(mapping1.getInternalName()).andStubReturn("id");
+      EasyMock.replay(mapping1);
+      EasyMock.expect(edmProperty1.getName()).andStubReturn("Id");
+      EasyMock.expect(edmProperty1.getMapping()).andStubReturn(mapping1);
+      EasyMock.expect(edmProperty1.getType()).andStubReturn(edmType1);
+      EasyMock.replay(edmProperty1);
+      // Mocking the complex properties
+      EasyMock.expect(edmComplexType.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
+      EasyMock.replay(edmComplexType);
+      EasyMock.expect(complexMapping.getInternalName()).andStubReturn("order");
+      EasyMock.replay(complexMapping);
+      EasyMock.expect(edmComplexProperty.getName()).andStubReturn("OrderName");
+      EasyMock.expect(edmComplexProperty.getMapping()).andStubReturn(complexMapping);
+      EasyMock.expect(edmComplexProperty.getType()).andStubReturn(edmComplexType);
+      EasyMock.replay(edmComplexProperty);
+      EasyMock.expect(edmType2.getKind()).andStubReturn(EdmTypeKind.COMPLEX);
+      EasyMock.expect(edmType2.getProperty("OrderName")).andStubReturn(edmComplexProperty);
+      List<String> propertyNames = new ArrayList<String>();
+      propertyNames.add("OrderName");
+      EasyMock.expect(edmType2.getPropertyNames()).andStubReturn(propertyNames);
+      EasyMock.replay(edmType2);
+      EasyMock.expect(mapping2.getInternalName()).andStubReturn("relatedEntity");
+      EasyMock.replay(mapping2);
+      EasyMock.expect(edmProperty2.getName()).andStubReturn("Order");
+      EasyMock.expect(edmProperty2.getMapping()).andStubReturn(mapping2);
+      EasyMock.expect(edmProperty2.getType()).andStubReturn(edmType2);
+      EasyMock.replay(edmProperty2);
+
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    selectPropertyList.add(edmProperty1);
+    selectPropertyList.add(edmProperty2);
+    try {
+      Map<String, Object> result = resultParser.parse2EdmPropertyValueMap(jpaEntity, selectPropertyList);
+      assertEquals(1, ((HashMap<String, Object>) result.get("Order")).size());
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+  }
+
+  /*
+   * TestCase - getGetterName is a private method in JPAResultParser. The
+   * method is uses reflection to derive the property access methods from
+   * EdmProperty
+   */
+  @Test
+  public void testGetGettersWithOutMapping() {
+    JPAEntityParser resultParser = new JPAEntityParser();
+    try {
+
+      /*
+       * Case 1 - Property having No mapping
+       */
+      Class<?>[] pars = { String.class, EdmMapping.class, String.class };
+      Object[] params = { "Field1", null, "get" };
+      Method getGetterName = resultParser.getClass().getDeclaredMethod("getAccessModifierName", pars);
+      getGetterName.setAccessible(true);
+      String name = (String) getGetterName.invoke(resultParser, params);
+
+      assertEquals("getField1", name);
+
+    } catch (IllegalAccessException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (IllegalArgumentException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (InvocationTargetException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+
+    }
+  }
+
+  @Test
+  public void testGetGettersWithNullPropname() {
+    JPAEntityParser resultParser = new JPAEntityParser();
+    try {
+
+      /*
+       * Case 1 - Property having No mapping and no name
+       */
+      Class<?>[] pars = { String.class, EdmMapping.class, String.class };
+      Object[] params = { null, null, null };
+      Method getGetterName = resultParser.getClass().getDeclaredMethod("getAccessModifierName", pars);
+      getGetterName.setAccessible(true);
+
+      String name = (String) getGetterName.invoke(resultParser, params);
+      assertNull(name);
+
+    } catch (IllegalAccessException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (IllegalArgumentException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (InvocationTargetException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+
+    }
+  }
+
+  /*
+   * TestCase - getGetterName is a private method in JPAResultParser. The
+   * method is uses reflection to derive the property access methods from
+   * EdmProperty
+   * 
+   * EdmProperty name could have been modified. Then mapping object of
+   * EdmProperty should be used for deriving the name
+   */
+  @Test
+  public void testGetGettersWithMapping() {
+    JPAEntityParser resultParser = new JPAEntityParser();
+    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
+    EasyMock.expect(edmMapping.getInternalName()).andStubReturn("field1");
+    EasyMock.replay(edmMapping);
+    try {
+
+      Class<?>[] pars = { String.class, EdmMapping.class, String.class };
+      Object[] params = { "myField", edmMapping, "get" };
+      Method getGetterName = resultParser.getClass().getDeclaredMethod("getAccessModifierName", pars);
+      getGetterName.setAccessible(true);
+
+      String name = (String) getGetterName.invoke(resultParser, params);
+      assertEquals("getField1", name);
+
+    } catch (IllegalAccessException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (IllegalArgumentException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (InvocationTargetException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+
+    }
+  }
+
+  @Test
+  public void testGetGettersNoSuchMethodException() {
+    JPAEntityParser resultParser = new JPAEntityParser();
+    try {
+
+      Method getGetterName = resultParser.getClass().getDeclaredMethod("getGetterName1", EdmProperty.class);
+      getGetterName.setAccessible(true);
+
+    } catch (NoSuchMethodException e) {
+      assertEquals(
+          "org.apache.olingo.odata2.jpa.processor.core.access.data.JPAEntityParser.getGetterName1" +
+              "(org.apache.olingo.odata2.api.edm.EdmProperty)",
+          e.getMessage());
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+
+    }
+  }
+
+  @Test
+  public void testParse2EdmPropertyValueMap() {
+    JPAEntityParser resultParser = new JPAEntityParser();
+    Object jpaEntity = new DemoItem2("abc");
+    try {
+      resultParser.parse2EdmPropertyValueMap(jpaEntity, getEdmPropertyList());
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetGetterEdmException() {
+    JPAEntityParser resultParser = new JPAEntityParser();
+    Object jpaEntity = new demoItem("abc", 10);
+    EdmStructuralType structuralType = EasyMock.createMock(EdmStructuralType.class);
+    try {
+      EasyMock.expect(structuralType.getPropertyNames()).andStubThrow(new EdmException(null));
+      EasyMock.replay(structuralType);
+      Method getGetters =
+          resultParser.getClass().getDeclaredMethod("getGetters", Object.class, EdmStructuralType.class);
+      getGetters.setAccessible(true);
+      try {
+        getGetters.invoke(resultParser, jpaEntity, structuralType);
+      } catch (IllegalAccessException e) {
+        fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+      } catch (IllegalArgumentException e) {
+        fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+      } catch (InvocationTargetException e) {
+        assertTrue(true);
+      }
+    } catch (NoSuchMethodException e) {
+      assertEquals(
+          "org.apache.olingo.odata2.jpa.processor.core.access.data.JPAEntityParser.getGetters(java.lang.Object, " +
+              "org.apache.olingo.odata2.api.edm.EdmStructuralType)",
+          e.getMessage());
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testForNullJPAEntity() {
+    JPAEntityParser resultParser = new JPAEntityParser();
+    EdmStructuralType structuralType = EasyMock.createMock(EdmStructuralType.class);
+    Object map;
+    try {
+      map = resultParser.parse2EdmPropertyValueMap(null, structuralType);
+      assertNull(map);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  class demoItem {
+    private String id;
+    private int value;
+    private DemoRelatedEntity relatedEntity;
+
+    public String getId() {
+      return id;
+    }
+
+    public void setId(final String id) {
+      this.id = id;
+    }
+
+    public DemoRelatedEntity getRelatedEntity() {
+      return relatedEntity;
+    }
+
+    public void setRelatedEntity(final DemoRelatedEntity relatedEntity) {
+      this.relatedEntity = relatedEntity;
+    }
+
+    public int getValue() {
+      return value;
+    }
+
+    public void setValue(final int value) {
+      this.value = value;
+    }
+
+    demoItem(final String id, final int value) {
+      this.id = id;
+      this.value = value;
+    }
+
+  }
+
+  class DemoRelatedEntity {
+    String order;
+
+    public String getOrder() {
+      return order;
+    }
+
+    public void setOrder(final String order) {
+      this.order = order;
+    }
+
+    public DemoRelatedEntity(final String order) {
+      super();
+      this.order = order;
+    }
+
+  }
+
+  private List<EdmProperty> getEdmPropertyList() {
+    List<EdmProperty> properties = new ArrayList<EdmProperty>();
+    properties.add(getEdmProperty());
+    return properties;
+  }
+
+  class DemoItem2 {
+    private String field1;
+
+    public String getField1() {
+      return field1;
+    }
+
+    public void setField1(final String field) {
+      field1 = field;
+    }
+
+    public DemoItem2(final String field) {
+      field1 = field;
+    }
+
+  }
+
+  private EdmProperty getEdmProperty() {
+    EdmProperty edmTyped = EasyMock.createMock(EdmProperty.class);
+
+    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
+    EasyMock.expect(edmMapping.getInternalName()).andStubReturn("Field1");
+    EasyMock.replay(edmMapping);
+
+    EdmType edmType = EasyMock.createMock(EdmType.class);
+
+    try {
+      EasyMock.expect(edmType.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
+      EasyMock.expect(edmType.getName()).andStubReturn("identifier");
+      EasyMock.expect(edmTyped.getName()).andStubReturn("SalesOrderHeader");
+      EasyMock.expect(edmTyped.getMapping()).andStubReturn(edmMapping);
+
+      EasyMock.expect(edmTyped.getType()).andStubReturn(edmType);
+      EasyMock.expect(edmTyped.getMapping()).andStubReturn(edmMapping);
+
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    EasyMock.replay(edmType);
+    EasyMock.replay(edmTyped);
+    return edmTyped;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
new file mode 100644
index 0000000..d87d2c1
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
@@ -0,0 +1,252 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.core.access.data;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.lang.reflect.Method;
+
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAEntityParser;
+import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.junit.Test;
+
+public class JPAEntityParserTestForStaticMethods {
+
+  @Test
+  public void testToStringDefault() {
+
+    Character[] input = new Character[] { 'A', 'B' };
+    assertEquals("AB", JPAEntityParser.toString(input));
+
+  }
+
+  @Test
+  public void testToStringNull() {
+    Character[] input = null;
+    assertNull(JPAEntityParser.toString(input));
+  }
+
+  @Test
+  public void testToStringPartialNull() {
+    Character[] input = new Character[] { 'A', null };
+    assertEquals("A", JPAEntityParser.toString(input));
+  }
+
+  @Test
+  public void testToCharacterArrayDefault() {
+    String input = new String("AB");
+    Character[] ch = JPAEntityParser.toCharacterArray(input);
+
+    assertEquals(2, ch.length);
+    assertTrue(ch[0].equals('A'));
+    assertTrue(ch[1].equals('B'));
+  }
+
+  @Test
+  public void testToCharacterArrayNull() {
+    String input = null;
+    Character[] ch = JPAEntityParser.toCharacterArray(input);
+
+    assertNull(ch);
+  }
+
+  @Test
+  public void testGetPropertyCharacter() {
+    try {
+      Method method = JPAEntityParserTestForStaticMethods.class.getMethod("getCharacter", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getProperty(method, this);
+      assertEquals("A", output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyCharacterNull() {
+    try {
+      Method method = JPAEntityParserTestForStaticMethods.class.getMethod("getCharacterNull", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getProperty(method, this);
+      assertNull(output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyCharacterArray() {
+    try {
+      Method method = JPAEntityParserTestForStaticMethods.class.getMethod("getCharacterArray", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getProperty(method, this);
+      assertEquals("AB", output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyCharacterArrayNull() {
+    try {
+      Method method = JPAEntityParserTestForStaticMethods.class.getMethod("getCharacterArrayNull", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getProperty(method, this);
+      assertNull(output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyChar() {
+    try {
+      Method method = JPAEntityParserTestForStaticMethods.class.getMethod("getChar", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getProperty(method, this);
+      assertEquals("A", output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyCharNull() {
+    try {
+      Method method = JPAEntityParserTestForStaticMethods.class.getMethod("getCharNull", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getProperty(method, this);
+      assertNull(output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyCharArray() {
+    try {
+      Method method = JPAEntityParserTestForStaticMethods.class.getMethod("getCharArray", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getProperty(method, this);
+      assertEquals("AB", output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyCharArrayNull() {
+    try {
+      Method method = JPAEntityParserTestForStaticMethods.class.getMethod("getCharArrayNull", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getProperty(method, this);
+      assertNull(output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetPropertyCharArrayValueNull() {
+    try {
+      Method method = JPAEntityParserTestForStaticMethods.class.getMethod("getCharArrayValueNull", (Class<?>[]) null);
+      String output = (String) JPAEntityParser.getProperty(method, this);
+      assertEquals("A\u0000", output);
+
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (SecurityException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  public Character getCharacter() {
+    return new Character('A');
+  }
+
+  public Character getCharacterNull() {
+    return null;
+  }
+
+  public Character[] getCharacterArray() {
+    return new Character[] { 'A', 'B' };
+  }
+
+  public Character[] getCharacterArrayNull() {
+    return null;
+  }
+
+  public char getChar() {
+    return 'A';
+  }
+
+  public char getCharNull() {
+    return '\u0000';
+  }
+
+  public char[] getCharArray() {
+    return new char[] { 'A', 'B' };
+  }
+
+  public char[] getCharArrayNull() {
+    return null;
+  }
+
+  public char[] getCharArrayValueNull() {
+    return new char[] { 'A', '\u0000' };
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
new file mode 100644
index 0000000..a93c4e0
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.core.access.data;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAEntity;
+import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.EdmMockUtilV2;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.ODataEntryMockUtil;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock.JPARelatedTypeMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock.JPATypeEmbeddableMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock.JPATypeEmbeddableMock2;
+import org.junit.Test;
+
+public class JPAEntityTest {
+
+  private JPAEntity jpaEntity = null;
+
+  @Test
+  public void testCreateODataEntryWithComplexType() {
+    try {
+      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, true);
+      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet);
+      jpaEntity.create(ODataEntryMockUtil.mockODataEntryWithComplexType(JPATypeMock.ENTITY_NAME));
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
+    assertEquals(jpaTypeMock.getMInt(), ODataEntryMockUtil.VALUE_MINT);
+    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
+    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
+    JPATypeEmbeddableMock jpaEmbeddableMock = jpaTypeMock.getComplexType();
+    assertNotNull(jpaEmbeddableMock);
+
+    assertEquals(jpaEmbeddableMock.getMShort(), ODataEntryMockUtil.VALUE_SHORT);
+    JPATypeEmbeddableMock2 jpaEmbeddableMock2 = jpaEmbeddableMock.getMEmbeddable();
+    assertNotNull(jpaEmbeddableMock2);
+    assertEquals(jpaEmbeddableMock2.getMFloat(), ODataEntryMockUtil.VALUE_MFLOAT, 1);
+    assertEquals(jpaEmbeddableMock2.getMUUID(), ODataEntryMockUtil.VALUE_UUID);
+  }
+
+  @Test
+  public void testCreateODataEntry() {
+    try {
+      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
+      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet);
+      jpaEntity.create(ODataEntryMockUtil.mockODataEntry(JPATypeMock.ENTITY_NAME));
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
+    assertEquals(jpaTypeMock.getMInt(), ODataEntryMockUtil.VALUE_MINT);
+    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
+    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
+  }
+
+  @Test
+  public void testCreateODataEntryWithInline() {
+    try {
+      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
+      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet);
+      jpaEntity.create(ODataEntryMockUtil.mockODataEntryWithInline(JPATypeMock.ENTITY_NAME));
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
+    assertEquals(jpaTypeMock.getMInt(), ODataEntryMockUtil.VALUE_MINT);
+    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
+    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
+
+    JPARelatedTypeMock relatedType = jpaTypeMock.getMRelatedEntity();
+    assertNotNull(jpaTypeMock.getMRelatedEntity());
+    assertEquals(relatedType.getMByte(), ODataEntryMockUtil.VALUE_MBYTE);
+    assertEquals(relatedType.getMByteArray(), ODataEntryMockUtil.VALUE_MBYTEARRAY);
+    assertEquals(relatedType.getMDouble(), ODataEntryMockUtil.VALUE_MDOUBLE, 0.0);
+    assertEquals(relatedType.getMLong(), ODataEntryMockUtil.VALUE_MLONG);
+  }
+
+  @Test
+  public void testCreateODataEntryProperty() {
+    try {
+      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
+      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet);
+      jpaEntity.create(ODataEntryMockUtil.mockODataEntryProperties(JPATypeMock.ENTITY_NAME));
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
+    assertEquals(jpaTypeMock.getMInt(), ODataEntryMockUtil.VALUE_MINT);
+    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
+    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
+  }
+
+  @Test
+  public void testUpdateODataEntry() {
+    try {
+      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
+      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet);
+      JPATypeMock jpaTypeMock = new JPATypeMock();
+      jpaEntity.setJPAEntity(jpaTypeMock);
+      jpaEntity.update(ODataEntryMockUtil.mockODataEntry(JPATypeMock.ENTITY_NAME));
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
+    assertEquals(jpaTypeMock.getMInt(), 0);// Key should not be changed
+    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
+    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
+  }
+
+  @Test
+  public void testUpdateODataEntryProperty() {
+    try {
+      EdmEntitySet edmEntitySet = EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false);
+      EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+      jpaEntity = new JPAEntity(edmEntityType, edmEntitySet);
+      JPATypeMock jpaTypeMock = new JPATypeMock();
+      jpaEntity.setJPAEntity(jpaTypeMock);
+      jpaEntity.update(ODataEntryMockUtil.mockODataEntryProperties(JPATypeMock.ENTITY_NAME));
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    JPATypeMock jpaTypeMock = (JPATypeMock) jpaEntity.getJPAEntity();
+    assertEquals(jpaTypeMock.getMInt(), 0);// Key should not be changed
+    assertEquals(jpaTypeMock.getMString(), ODataEntryMockUtil.VALUE_MSTRING);
+    assertTrue(jpaTypeMock.getMDateTime().equals(ODataEntryMockUtil.VALUE_DATE_TIME));
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAExpandCallBackTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAExpandCallBackTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAExpandCallBackTest.java
new file mode 100644
index 0000000..d6f9153
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAExpandCallBackTest.java
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.jpa.processor.core.access.data;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.ODataCallback;
+import org.apache.olingo.odata2.api.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.ep.callback.WriteEntryCallbackContext;
+import org.apache.olingo.odata2.api.ep.callback.WriteEntryCallbackResult;
+import org.apache.olingo.odata2.api.ep.callback.WriteFeedCallbackContext;
+import org.apache.olingo.odata2.api.ep.callback.WriteFeedCallbackResult;
+import org.apache.olingo.odata2.api.uri.ExpandSelectTreeNode;
+import org.apache.olingo.odata2.api.uri.NavigationPropertySegment;
+import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAExpandCallBack;
+import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.EdmMockUtil;
+import org.junit.Test;
+
+public class JPAExpandCallBackTest {
+
+  @Test
+  public void testRetrieveEntryResult() {
+    JPAExpandCallBack callBack = getJPAExpandCallBackObject();
+    WriteEntryCallbackContext writeFeedContext = EdmMockUtil.getWriteEntryCallBackContext();
+    try {
+      Field field = callBack.getClass().getDeclaredField("nextEntitySet");
+      field.setAccessible(true);
+      field.set(callBack, EdmMockUtil.mockTargetEntitySet());
+      WriteEntryCallbackResult result = callBack.retrieveEntryResult(writeFeedContext);
+      assertEquals(1, result.getEntryData().size());
+    } 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);
+    } catch (IllegalArgumentException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (IllegalAccessException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testRetrieveFeedResult() {
+    JPAExpandCallBack callBack = getJPAExpandCallBackObject();
+    WriteFeedCallbackContext writeFeedContext = EdmMockUtil.getWriteFeedCallBackContext();
+    try {
+      Field field = callBack.getClass().getDeclaredField("nextEntitySet");
+      field.setAccessible(true);
+      field.set(callBack, EdmMockUtil.mockTargetEntitySet());
+      WriteFeedCallbackResult result = callBack.retrieveFeedResult(writeFeedContext);
+      assertEquals(2, result.getFeedData().size());
+    } 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);
+    } catch (IllegalArgumentException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (IllegalAccessException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testGetCallbacks() {
+    Map<String, ODataCallback> callBacks = null;
+    try {
+      URI baseUri =
+          new URI("http://localhost:8080/org.apache.olingo.odata2.processor.ref.web/SalesOrderProcessing.svc/");
+      ExpandSelectTreeNode expandSelectTreeNode = EdmMockUtil.mockExpandSelectTreeNode();
+      List<ArrayList<NavigationPropertySegment>> expandList = EdmMockUtil.getExpandList();
+      callBacks = JPAExpandCallBack.getCallbacks(baseUri, expandSelectTreeNode, expandList);
+    } catch (URISyntaxException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    assertEquals(1, callBacks.size());
+
+  }
+
+  @Test
+  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);
+    } catch (IllegalArgumentException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (IllegalAccessException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (NoSuchMethodException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (InvocationTargetException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  private JPAExpandCallBack getJPAExpandCallBackObject() {
+    Map<String, ODataCallback> callBacks = null;
+    try {
+      URI baseUri =
+          new URI("http://localhost:8080/org.apache.olingo.odata2.processor.ref.web/SalesOrderProcessing.svc/");
+      ExpandSelectTreeNode expandSelectTreeNode = EdmMockUtil.mockExpandSelectTreeNode();
+      List<ArrayList<NavigationPropertySegment>> expandList = EdmMockUtil.getExpandList();
+      callBacks = JPAExpandCallBack.getCallbacks(baseUri, expandSelectTreeNode, expandList);
+    } catch (URISyntaxException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    return (JPAExpandCallBack) callBacks.get("SalesOrderLineItemDetails");
+  }
+
+}