BAEL-2412

New example showing that the empty string can be deserialized into a char.
This commit is contained in:
Javier 2018-12-12 06:27:36 +01:00
parent 089162e91c
commit f69d154862
1 changed files with 11 additions and 1 deletions

View File

@ -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