olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chri...@apache.org
Subject [2/2] olingo-odata4 git commit: [OLINGO-1152] Test case for null enum values
Date Fri, 08 Sep 2017 12:55:14 GMT
[OLINGO-1152] Test case for null enum values

Signed-off-by: Christian Amend <christian.amend@sap.com>


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/0a2ebd79
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/0a2ebd79
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/0a2ebd79

Branch: refs/heads/master
Commit: 0a2ebd7953c95eded80c0d050a33c2c036cfa014
Parents: 6b34920
Author: Tom van Wietmarschen <aaargh@gmail.com>
Authored: Tue Aug 22 15:08:20 2017 +0200
Committer: Christian Amend <christian.amend@sap.com>
Committed: Fri Sep 8 14:51:40 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/olingo/client/core/JSONTest.java | 15 +++++++++++++++
 .../org/apache/olingo/client/core/olingo1152.json    |  6 ++++++
 2 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0a2ebd79/lib/client-core/src/test/java/org/apache/olingo/client/core/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/JSONTest.java
index caef339..646c562 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/JSONTest.java
@@ -36,6 +36,7 @@ import org.apache.olingo.client.api.data.ResWrap;
 import org.apache.olingo.client.api.domain.ClientCollectionValue;
 import org.apache.olingo.client.api.domain.ClientComplexValue;
 import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientProperty;
 import org.apache.olingo.client.api.domain.ClientValue;
 import org.apache.olingo.client.core.serialization.JsonDeserializer;
 import org.apache.olingo.commons.api.Constants;
@@ -482,4 +483,18 @@ public class JSONTest extends AbstractTest {
       i++;
     }
   }
+  
+  @Test
+  public void issueOLINGO1152() throws Exception {
+    InputStream inputStream = getClass().getResourceAsStream(
+        "olingo1152" + "." + getSuffix(ContentType.APPLICATION_JSON));
+    ClientEntity entity = client.getReader().readEntity(inputStream, ContentType.APPLICATION_JSON);
+    assertNotNull(entity);
+    ClientProperty prop = entity.getProperty("Gender");
+    assertNotNull(prop);
+    ClientValue value = prop.getValue();
+    assertNotNull(value);
+    assertTrue(value.asEnum() == null);
+
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0a2ebd79/lib/client-core/src/test/resources/org/apache/olingo/client/core/olingo1152.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/olingo1152.json
b/lib/client-core/src/test/resources/org/apache/olingo/client/core/olingo1152.json
new file mode 100644
index 0000000..7f288c1
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/olingo1152.json
@@ -0,0 +1,6 @@
+{
+  "@odata.type": "#Microsoft.OData.SampleService.Models.TripPin.Person",
+  "@odata.id": "http://services.odata.org/V4/(S(fe5rsnxo3fkkkk2bvmh1nl1y))/TripPinServiceRW/People('russellwhyte')",
+  "Gender@odata.type": "#Microsoft.OData.SampleService.Models.TripPin.PersonGender",
+  "Gender": null
+}
\ No newline at end of file


Mime
View raw message