From 43f3f5e80bb845db09e34ce467c38052b08866cf Mon Sep 17 00:00:00 2001 From: "John J. Aylward" Date: Mon, 19 Mar 2018 09:48:50 -0400 Subject: [PATCH] Add another test --- src/test/java/org/json/junit/JSONPointerTest.java | 8 ++++++++ src/test/resources/jsonpointer-testdoc.json | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/json/junit/JSONPointerTest.java b/src/test/java/org/json/junit/JSONPointerTest.java index c4a8781..5ddd089 100644 --- a/src/test/java/org/json/junit/JSONPointerTest.java +++ b/src/test/java/org/json/junit/JSONPointerTest.java @@ -74,6 +74,14 @@ public class JSONPointerTest { query("/obj//") ); } + + @Test + public void queryByEmptyKeySubObjectValue() { + assertSame( + document.getJSONObject("obj").getJSONObject("").get("subKey"), + query("/obj//subKey") + ); + } @Test public void slashEscaping() { diff --git a/src/test/resources/jsonpointer-testdoc.json b/src/test/resources/jsonpointer-testdoc.json index 6c1ce28..657ccdd 100644 --- a/src/test/resources/jsonpointer-testdoc.json +++ b/src/test/resources/jsonpointer-testdoc.json @@ -20,6 +20,9 @@ "val" ] }, - "" : { "" : "empty key of an object with an empty key" } + "" : { + "" : "empty key of an object with an empty key", + "subKey" : "Some other value" + } } } \ No newline at end of file