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 335b844214..8581f07a65 100644 --- a/gson/src/test/java/org/baeldung/gson/primitives/UnitTest.java +++ b/gson/src/test/java/org/baeldung/gson/primitives/UnitTest.java @@ -143,11 +143,21 @@ public class UnitTest { // @formatter:off String json = "{\"byteValue\": \"\", \"shortValue\": \"\", " + "\"intValue\": \"\", " + "\"longValue\": \"\", \"floatValue\": \"\"" - + ", \"doubleValue\": \"\"" + ", \"booleanValue\": \"\", \"charValue\": \"\"}"; + + ", \"doubleValue\": \"\"" + ", \"booleanValue\": \"\"}"; // @formatter:on gson.fromJson(json, PrimitiveBundleInitialized.class); } + @Test public void fromJsonEmptyStringToChar() { + Gson gson = new Gson(); + // @formatter:off + String json = "{\"charValue\": \"\"}"; + // @formatter:on + CharExample model = gson.fromJson(json, CharExample.class); + + assertEquals(Character.MIN_VALUE, model.value); + } + @Test public void fromJsonValidValueWithinString() { Gson gson = new Gson(); // @formatter:off