From bbb60b3953acf39a1e359fc09595a85b6952012f Mon Sep 17 00:00:00 2001 From: David Baldwin Date: Fri, 29 Jul 2011 12:29:44 -0700 Subject: [PATCH] ... --- .../com/jayway/jsonpath/JsonPathTest.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/json-path/src/test/java/com/jayway/jsonpath/JsonPathTest.java b/json-path/src/test/java/com/jayway/jsonpath/JsonPathTest.java index e8a054a3..5cb36dad 100644 --- a/json-path/src/test/java/com/jayway/jsonpath/JsonPathTest.java +++ b/json-path/src/test/java/com/jayway/jsonpath/JsonPathTest.java @@ -149,7 +149,13 @@ public abstract class JsonPathTest { String doc = "{foo:{biz:{id:1}}}"; assertEquals(JsonPath.read(doc, "$.foo.biz.(object)").toString(), "{\"id\":1}"); - assertTrue(JsonPath.read(doc, "$.foo.biz.(collection)").isJsonNull()); + try{ + JsonPath.read(doc, "$.foo.biz.(collection)"); + fail(); + } + catch(JsonException e){ + + } doc = "{foo:{biz:[{Id:1},{Id:2},{Id:4,foo:1234}]}}"; @@ -288,14 +294,20 @@ public abstract class JsonPathTest { @Test public void access_index_out_of_bounds_does_not_throw_exception() throws Exception { - JsonElement res = JsonPath.read(DOCUMENT, "$.store.book[100].author"); + try{ + JsonElement res = JsonPath.read(DOCUMENT, "$.store.book[100].author"); + fail(); + } + catch(JsonException je){ + + } + - assertTrue(res.isJsonNull()); JsonElement res2 = JsonPath.read(DOCUMENT, "$.store.book[1, 200].author"); JsonElement res3 = JsonPath.read(DOCUMENT, "$.store.book[1, 200]"); assertEquals(res2.toObject(), "Evelyn Waugh"); - System.out.println(res3.toJsonArray().get(1)); +