added a test for checking if GSON can parse JSON that uses single quotes
instead of double quotes for various field values.
This commit is contained in:
parent
3b8404dac5
commit
427c17a732
@ -56,6 +56,12 @@ public class ObjectTest extends TestCase {
|
|||||||
gson = new Gson();
|
gson = new Gson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testJsonInSingleQuotes() {
|
||||||
|
String json = "{'stringValue':'no message'}";
|
||||||
|
BagOfPrimitives target = gson.fromJson(json, BagOfPrimitives.class);
|
||||||
|
assertEquals("no message", target.stringValue);
|
||||||
|
}
|
||||||
|
|
||||||
public void testBagOfPrimitivesSerialization() throws Exception {
|
public void testBagOfPrimitivesSerialization() throws Exception {
|
||||||
BagOfPrimitives target = new BagOfPrimitives(10, 20, false, "stringValue");
|
BagOfPrimitives target = new BagOfPrimitives(10, 20, false, "stringValue");
|
||||||
assertEquals(target.getExpectedJson(), gson.toJson(target));
|
assertEquals(target.getExpectedJson(), gson.toJson(target));
|
||||||
|
Loading…
Reference in New Issue
Block a user