Added another test to JsonParserTest.

This commit is contained in:
Joel Leitch 2009-09-23 19:21:09 +00:00
parent c6f762f36b
commit 0e17041c8b

View File

@ -57,6 +57,17 @@ public class JsonParserTest extends TestCase {
JsonElement e = parser.parse(" "); JsonElement e = parser.parse(" ");
assertTrue(e.isJsonNull()); 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() { public void testParseReader() {
StringReader reader = new StringReader("{a:10,b:'c'}"); StringReader reader = new StringReader("{a:10,b:'c'}");