You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@johnzon.apache.org by rs...@apache.org on 2017/11/29 19:20:45 UTC
johnzon git commit: JOHNZON-148 fixed checkstyle,
added test with Boolean in Object
Repository: johnzon
Updated Branches:
refs/heads/master 95061a0af -> 0317594b9
JOHNZON-148 fixed checkstyle, added test with Boolean in Object
Project: http://git-wip-us.apache.org/repos/asf/johnzon/repo
Commit: http://git-wip-us.apache.org/repos/asf/johnzon/commit/0317594b
Tree: http://git-wip-us.apache.org/repos/asf/johnzon/tree/0317594b
Diff: http://git-wip-us.apache.org/repos/asf/johnzon/diff/0317594b
Branch: refs/heads/master
Commit: 0317594b96d740233a3ce79921825b118e20258e
Parents: 95061a0
Author: Reinhard Sandtner <rs...@apache.org>
Authored: Wed Nov 29 20:19:59 2017 +0100
Committer: Reinhard Sandtner <rs...@apache.org>
Committed: Wed Nov 29 20:19:59 2017 +0100
----------------------------------------------------------------------
.../apache/johnzon/jsonb/JsonbWriteTest.java | 24 +++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/johnzon/blob/0317594b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbWriteTest.java
----------------------------------------------------------------------
diff --git a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbWriteTest.java b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbWriteTest.java
index eec5ad1..f16e2c4 100644
--- a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbWriteTest.java
+++ b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbWriteTest.java
@@ -26,7 +26,6 @@ import javax.json.bind.annotation.JsonbProperty;
import javax.json.bind.spi.JsonbProvider;
import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
import java.io.StringWriter;
import java.time.LocalDateTime;
import java.util.Collection;
@@ -57,6 +56,16 @@ public class JsonbWriteTest {
}
@Test
+ public void boolAsStreamInObject() {
+ SimpleBool simple = new SimpleBool();
+ simple.setBool(Boolean.TRUE);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ JsonbProvider.provider().create().build().toJson(simple, baos);
+ assertEquals("{\"bool\":true}", baos.toString());
+ }
+
+ @Test
public void simple() {
final Simple simple = new Simple();
simple.setValue("test");
@@ -116,6 +125,19 @@ public class JsonbWriteTest {
}
}
+ public static class SimpleBool {
+ private Boolean bool;
+
+ public Boolean getBool() {
+ return bool;
+ }
+
+ public SimpleBool setBool(Boolean bool) {
+ this.bool = bool;
+ return this;
+ }
+ }
+
public static class SimpleProperty {
@JsonbProperty("simple")
private String value;