johnzon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject johnzon git commit: JOHNZON-157 add more tests and remove obsolete code
Date Mon, 12 Feb 2018 11:36:01 GMT
Repository: johnzon
Updated Branches:
  refs/heads/master 307a7cb51 -> 8e4709c95


JOHNZON-157 add more tests and remove obsolete code


Project: http://git-wip-us.apache.org/repos/asf/johnzon/repo
Commit: http://git-wip-us.apache.org/repos/asf/johnzon/commit/8e4709c9
Tree: http://git-wip-us.apache.org/repos/asf/johnzon/tree/8e4709c9
Diff: http://git-wip-us.apache.org/repos/asf/johnzon/diff/8e4709c9

Branch: refs/heads/master
Commit: 8e4709c95408ab636aa07d5c141e584865847911
Parents: 307a7cb
Author: Mark Struberg <struberg@apache.org>
Authored: Mon Feb 12 12:35:00 2018 +0100
Committer: Mark Struberg <struberg@apache.org>
Committed: Mon Feb 12 12:35:00 2018 +0100

----------------------------------------------------------------------
 .../johnzon/core/JohnzonJsonParserImpl.java     |  4 ++--
 .../org/apache/johnzon/jsonb/JsonbReadTest.java | 23 ++++++++++++++++----
 2 files changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/johnzon/blob/8e4709c9/johnzon-core/src/main/java/org/apache/johnzon/core/JohnzonJsonParserImpl.java
----------------------------------------------------------------------
diff --git a/johnzon-core/src/main/java/org/apache/johnzon/core/JohnzonJsonParserImpl.java
b/johnzon-core/src/main/java/org/apache/johnzon/core/JohnzonJsonParserImpl.java
index ce93a5d..5fa051a 100644
--- a/johnzon-core/src/main/java/org/apache/johnzon/core/JohnzonJsonParserImpl.java
+++ b/johnzon-core/src/main/java/org/apache/johnzon/core/JohnzonJsonParserImpl.java
@@ -38,7 +38,7 @@ public abstract class JohnzonJsonParserImpl implements JohnzonJsonParser
{
     @Override
     public JsonObject getObject() {
         Event current = current();
-        if (current != null && current != Event.START_OBJECT) {
+        if (current != Event.START_OBJECT) {
             throw new IllegalStateException(current + " doesn't support getObject()");
         }
 
@@ -50,7 +50,7 @@ public abstract class JohnzonJsonParserImpl implements JohnzonJsonParser
{
     @Override
     public JsonArray getArray() {
         Event current = current();
-        if (current != null && current != Event.START_ARRAY) {
+        if (current != Event.START_ARRAY) {
             throw new IllegalStateException(current + " doesn't support getArray()");
         }
 

http://git-wip-us.apache.org/repos/asf/johnzon/blob/8e4709c9/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java
----------------------------------------------------------------------
diff --git a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java
index 37e5d23..c3d10b0 100644
--- a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java
+++ b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java
@@ -18,15 +18,11 @@
  */
 package org.apache.johnzon.jsonb;
 
-import org.junit.Assert;
 import org.junit.Test;
 
-import javax.json.Json;
-import javax.json.JsonObject;
 import javax.json.bind.annotation.JsonbDateFormat;
 import javax.json.bind.annotation.JsonbProperty;
 import javax.json.bind.spi.JsonbProvider;
-import javax.json.stream.JsonParser;
 
 import java.io.ByteArrayInputStream;
 import java.io.StringReader;
@@ -80,6 +76,25 @@ public class JsonbReadTest {
         assertEquals("test", JsonbProvider.provider().create().build().fromJson(new StringReader(json),
SimpleProperty.class).value);
     }
 
+    @Test
+    public void propertyMappingNewLineCr() {
+        String json = "{\r\n" +
+                "  \"simple\":\"test\"\r\n" +
+                "}\r\n";
+
+        assertEquals("test", JsonbProvider.provider().create().build().fromJson(new StringReader(json),
SimpleProperty.class).value);
+    }
+
+    @Test
+    public void propertyMappingNewLineTabs() {
+        String json = "{\n" +
+                "\t\"simple\":\"test\"\n" +
+                "}\n";
+
+        assertEquals("test", JsonbProvider.provider().create().build().fromJson(new StringReader(json),
SimpleProperty.class).value);
+    }
+
+
 
     public static class Simple {
         private String value;


Mime
View raw message