Added a test to reproduce bug described in http://groups.google.com/group/google-gson/browse_thread/thread/9591c539e3c19d59
Seems like an invalid bug report as Gson can deserialize primitive values in Integer fields.
This commit is contained in:
parent
341c4ce5d1
commit
c3f61ee5ad
@ -568,4 +568,14 @@ public class PrimitiveTest extends TestCase {
|
|||||||
result = gson.toJson(target);
|
result = gson.toJson(target);
|
||||||
assertTrue(result.equals('"' + target + '"'));
|
assertTrue(result.equals('"' + target + '"'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testDeserializePrimitiveWrapperAsObjectField() {
|
||||||
|
String json = "{i:10}";
|
||||||
|
ClassWithIntegerField target = gson.fromJson(json, ClassWithIntegerField.class);
|
||||||
|
assertEquals(10, target.i.intValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ClassWithIntegerField {
|
||||||
|
Integer i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user