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:
Inderjeet Singh 2008-10-10 02:32:50 +00:00
parent 3b8404dac5
commit 427c17a732

View File

@ -56,6 +56,12 @@ public class ObjectTest extends TestCase {
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 {
BagOfPrimitives target = new BagOfPrimitives(10, 20, false, "stringValue");
assertEquals(target.getExpectedJson(), gson.toJson(target));