From 427c17a73208cf53c381e4e8099d4ef60c08cc9b Mon Sep 17 00:00:00 2001 From: Inderjeet Singh Date: Fri, 10 Oct 2008 02:32:50 +0000 Subject: [PATCH] added a test for checking if GSON can parse JSON that uses single quotes instead of double quotes for various field values. --- .../test/java/com/google/gson/functional/ObjectTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gson/src/test/java/com/google/gson/functional/ObjectTest.java b/gson/src/test/java/com/google/gson/functional/ObjectTest.java index 56c68ea4..499a6e6f 100644 --- a/gson/src/test/java/com/google/gson/functional/ObjectTest.java +++ b/gson/src/test/java/com/google/gson/functional/ObjectTest.java @@ -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));