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)); +