From 0e17041c8b0977d34d859e8007addd759d2cf73d Mon Sep 17 00:00:00 2001 From: Joel Leitch Date: Wed, 23 Sep 2009 19:21:09 +0000 Subject: [PATCH] Added another test to JsonParserTest. --- .../src/test/java/com/google/gson/JsonParserTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gson/src/test/java/com/google/gson/JsonParserTest.java b/gson/src/test/java/com/google/gson/JsonParserTest.java index a756c94f..d94503ba 100644 --- a/gson/src/test/java/com/google/gson/JsonParserTest.java +++ b/gson/src/test/java/com/google/gson/JsonParserTest.java @@ -57,6 +57,17 @@ public class JsonParserTest extends TestCase { JsonElement e = parser.parse(" "); assertTrue(e.isJsonNull()); } + + public void testParseMixedArray() { + String json = "[{},13,\"stringValue\"]"; + JsonElement e = parser.parse(json); + assertTrue(e.isJsonArray()); + + JsonArray array = e.getAsJsonArray(); + assertEquals("{}", array.get(0).toString()); + assertEquals(13, array.get(1).getAsInt()); + assertEquals("stringValue", array.get(2).getAsString()); + } public void testParseReader() { StringReader reader = new StringReader("{a:10,b:'c'}");