From bdc8b066a5f6d4ab53a4c5a1665cf9ffe8d2d026 Mon Sep 17 00:00:00 2001 From: Javier Date: Fri, 14 Dec 2018 20:29:48 +0100 Subject: [PATCH] BAEL-2412 Remove boolean and char fields from some of the examples. --- .../primitives/models/PrimitiveBundleInitialized.java | 5 +---- .../test/java/org/baeldung/gson/primitives/UnitTest.java | 8 ++------ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java b/gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java index 6fa99f4e3d..2780f7fd18 100644 --- a/gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java +++ b/gson/src/main/java/org/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java @@ -8,14 +8,11 @@ public class PrimitiveBundleInitialized { public long longValue = 1L; public float floatValue = 1.0f; public double doubleValue = 1; - public boolean booleanValue = true; - public char charValue = 'a'; // @formatter:on public String toString() { return "{" + "byte: " + byteValue + ", " + "short: " + shortValue + ", " + "int: " + intValue + ", " + "long: " + longValue + ", " - + "float: " + floatValue + ", " + "double: " + doubleValue + ", " - + "boolean: " + booleanValue + ", " + "char: " + charValue + "}"; + + "float: " + floatValue + ", " + "double: " + doubleValue + "}"; } } diff --git a/gson/src/test/java/org/baeldung/gson/primitives/UnitTest.java b/gson/src/test/java/org/baeldung/gson/primitives/UnitTest.java index d77476517d..f952ae5b92 100644 --- a/gson/src/test/java/org/baeldung/gson/primitives/UnitTest.java +++ b/gson/src/test/java/org/baeldung/gson/primitives/UnitTest.java @@ -141,7 +141,7 @@ public class UnitTest { // @formatter:off String json = "{\"byteValue\": null, \"shortValue\": null, " + "\"intValue\": null, " + "\"longValue\": null, \"floatValue\": null" - + ", \"doubleValue\": null" + ", \"booleanValue\": null, \"charValue\": null}"; + + ", \"doubleValue\": null}"; // @formatter:on PrimitiveBundleInitialized model = gson.fromJson(json, PrimitiveBundleInitialized.class); @@ -152,8 +152,6 @@ public class UnitTest { assertEquals(1, model.longValue); assertEquals(1, model.floatValue, 0.0001); assertEquals(1, model.doubleValue, 0.0001); - assertTrue(model.booleanValue); - assertEquals('a', model.charValue); } @Test(expected = JsonSyntaxException.class) public void fromJsonEmptyString() { @@ -181,7 +179,7 @@ public class UnitTest { // @formatter:off String json = "{\"byteValue\": \"15\", \"shortValue\": \"15\", " + "\"intValue\": \"15\", " + "\"longValue\": \"15\", \"floatValue\": \"15.0\"" - + ", \"doubleValue\": \"15.0\"" + ", \"booleanValue\": \"false\", \"charValue\": \"z\"}"; + + ", \"doubleValue\": \"15.0\"}"; // @formatter:on PrimitiveBundleInitialized model = gson.fromJson(json, PrimitiveBundleInitialized.class); @@ -192,8 +190,6 @@ public class UnitTest { assertEquals(15, model.longValue); assertEquals(15, model.floatValue, 0.0001); assertEquals(15, model.doubleValue, 0.0001); - assertFalse(model.booleanValue); - assertEquals('z', model.charValue); } @Test public void fromJsonBooleanFrom2ValueInteger() {