BAEL-2412
New example showing that the empty string can be deserialized into a char.
This commit is contained in:
parent
089162e91c
commit
f69d154862
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue