You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2013/09/15 08:43:30 UTC

git commit: Olingo-9 - FIx for Null char values + New JUnits

Updated Branches:
  refs/heads/master c9c4d957a -> 9ee8e0f3a


Olingo-9 - FIx for Null char values
+ New JUnits


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/9ee8e0f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/9ee8e0f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/9ee8e0f3

Branch: refs/heads/master
Commit: 9ee8e0f3ae70285ceca30b5440ca013472520c36
Parents: c9c4d95
Author: Chandan V A <ch...@sap.com>
Authored: Sun Sep 15 12:13:04 2013 +0530
Committer: Chandan V A <ch...@sap.com>
Committed: Sun Sep 15 12:13:04 2013 +0530

----------------------------------------------------------------------
 .../core/jpa/access/data/JPAEntityParser.java   |  99 ++--
 .../processor/core/jpa/JPAEntityParserTest.java | 593 -------------------
 .../jpa/access/data/JPAEntityParserTest.java    | 593 +++++++++++++++++++
 .../JPAEntityParserTestForStaticMethods.java    | 250 ++++++++
 4 files changed, 876 insertions(+), 659 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/9ee8e0f3/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/data/JPAEntityParser.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/data/JPAEntityParser.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/data/JPAEntityParser.java
index d7a8c97..f424fa2 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/data/JPAEntityParser.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/data/JPAEntityParser.java
@@ -115,21 +115,13 @@ public final class JPAEntityParser {
           edmEntity.put(key, propertyValue);
         }
       } catch (EdmException e) {
-        throw ODataJPARuntimeException.throwException(
-            ODataJPARuntimeException.GENERAL.addContent(e
-                .getMessage()), e);
+        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
       } catch (SecurityException e) {
-        throw ODataJPARuntimeException.throwException(
-            ODataJPARuntimeException.GENERAL.addContent(e
-                .getMessage()), e);
+        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
       } catch (NoSuchMethodException e) {
-        throw ODataJPARuntimeException.throwException(
-            ODataJPARuntimeException.GENERAL.addContent(e
-                .getMessage()), e);
+        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
       } catch (IllegalArgumentException e) {
-        throw ODataJPARuntimeException.throwException(
-            ODataJPARuntimeException.GENERAL.addContent(e
-                .getMessage()), e);
+        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
       }
     }
 
@@ -206,21 +198,13 @@ public final class JPAEntityParser {
         }
       }
     } catch (EdmException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     } catch (SecurityException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     } catch (NoSuchMethodException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     } catch (IllegalArgumentException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     }
     return edmEntity;
   }
@@ -247,21 +231,13 @@ public final class JPAEntityParser {
           navigationMap.put(navigationProperty.getName(), result);
         }
       } catch (IllegalArgumentException e) {
-        throw ODataJPARuntimeException.throwException(
-            ODataJPARuntimeException.GENERAL.addContent(e
-                .getMessage()), e);
+        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
       } catch (EdmException e) {
-        throw ODataJPARuntimeException.throwException(
-            ODataJPARuntimeException.GENERAL.addContent(e
-                .getMessage()), e);
+        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
       } catch (SecurityException e) {
-        throw ODataJPARuntimeException.throwException(
-            ODataJPARuntimeException.GENERAL.addContent(e
-                .getMessage()), e);
+        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
       } catch (NoSuchMethodException e) {
-        throw ODataJPARuntimeException.throwException(
-            ODataJPARuntimeException.GENERAL.addContent(e
-                .getMessage()), e);
+        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
       }
     }
     return navigationMap;
@@ -277,13 +253,9 @@ public final class JPAEntityParser {
       Class<?> parameterType = method.getReturnType();
       method = jpaType.getMethod(methodName, new Class<?>[] { parameterType });
     } catch (NoSuchMethodException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     } catch (SecurityException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     }
 
     return method;
@@ -320,17 +292,11 @@ public final class JPAEntityParser {
         }
       }
     } catch (NoSuchMethodException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     } catch (SecurityException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     } catch (EdmException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     }
 
     if (!embeddableKey.isEmpty()) {
@@ -346,16 +312,22 @@ public final class JPAEntityParser {
       Class<?> returnType = method.getReturnType();
 
       if (returnType.equals(char[].class))
-        propertyValue = (String) String.valueOf((char[]) method.invoke(entity));
+      {
+        char[] ch = (char[]) method.invoke(entity);
+        if (ch != null)
+          propertyValue = (String) String.valueOf((char[]) method.invoke(entity));
+      }
       else if (returnType.equals(Character[].class))
         propertyValue = (String) toString((Character[]) method.invoke(entity));
       else if (returnType.equals(char.class)) {
         char c = (Character) method.invoke(entity);
-        propertyValue = (String) String.valueOf(c);
+        if (c != '\u0000')
+          propertyValue = (String) String.valueOf(c);
       }
       else if (returnType.equals(Character.class)) {
         Character c = (Character) method.invoke(entity);
-        propertyValue = toString(new Character[] { c });
+        if (c != null)
+          propertyValue = toString(new Character[] { c });
       }
       else
         propertyValue = method.invoke(entity);
@@ -373,9 +345,10 @@ public final class JPAEntityParser {
     if (input == null) return null;
 
     StringBuilder builder = new StringBuilder();
-    for (int i = 0; i < input.length; i++)
+    for (int i = 0; i < input.length; i++) {
+      if (input[i] == null) continue;
       builder.append(input[i].charValue());
-
+    }
     return builder.toString();
 
   }
@@ -460,18 +433,12 @@ public final class JPAEntityParser {
           params);
 
     } catch (NoSuchMethodException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     } catch (SecurityException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     } catch (EdmException e) {
-      throw ODataJPARuntimeException
-          .throwException(ODataJPARuntimeException.GENERAL
-              .addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     }
 
   }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/9ee8e0f3/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/JPAEntityParserTest.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/JPAEntityParserTest.java b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/JPAEntityParserTest.java
deleted file mode 100644
index fe4858d..0000000
--- a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/JPAEntityParserTest.java
+++ /dev/null
@@ -1,593 +0,0 @@
-/*******************************************************************************
- * 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.processor.core.jpa;
-
-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.processor.api.jpa.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.processor.core.jpa.access.data.JPAEntityParser;
-import org.apache.olingo.odata2.processor.core.jpa.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.processor.core.jpa.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.processor.core.jpa.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/9ee8e0f3/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/access/data/JPAEntityParserTest.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/access/data/JPAEntityParserTest.java b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/access/data/JPAEntityParserTest.java
new file mode 100644
index 0000000..f41f510
--- /dev/null
+++ b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/access/data/JPAEntityParserTest.java
@@ -0,0 +1,593 @@
+/*******************************************************************************
+ * 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.processor.core.jpa.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.processor.api.jpa.exception.ODataJPARuntimeException;
+import org.apache.olingo.odata2.processor.core.jpa.access.data.JPAEntityParser;
+import org.apache.olingo.odata2.processor.core.jpa.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.processor.core.jpa.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.processor.core.jpa.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/9ee8e0f3/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/access/data/JPAEntityParserTestForStaticMethods.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/access/data/JPAEntityParserTestForStaticMethods.java b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/access/data/JPAEntityParserTestForStaticMethods.java
new file mode 100644
index 0000000..38e48f6
--- /dev/null
+++ b/jpa-core/src/test/java/org/apache/olingo/odata2/processor/core/jpa/access/data/JPAEntityParserTestForStaticMethods.java
@@ -0,0 +1,250 @@
+/*******************************************************************************
+ * 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.processor.core.jpa.access.data;
+
+import java.lang.reflect.Method;
+
+import org.apache.olingo.odata2.processor.api.jpa.exception.ODataJPARuntimeException;
+import org.apache.olingo.odata2.processor.core.jpa.common.ODataJPATestConstants;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+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' };
+  }
+}