|
|
@ -71,7 +71,7 @@ public class IssuesTest { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void issue_24(){ |
|
|
|
public void issue_24() { |
|
|
|
|
|
|
|
|
|
|
|
InputStream is = null; |
|
|
|
InputStream is = null; |
|
|
|
try { |
|
|
|
try { |
|
|
@ -85,7 +85,7 @@ public class IssuesTest { |
|
|
|
System.out.println(o); |
|
|
|
System.out.println(o); |
|
|
|
|
|
|
|
|
|
|
|
is.close(); |
|
|
|
is.close(); |
|
|
|
} catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
IOUtils.closeQuietly(is); |
|
|
|
IOUtils.closeQuietly(is); |
|
|
|
} |
|
|
|
} |
|
|
@ -93,7 +93,7 @@ public class IssuesTest { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void issue_28_string(){ |
|
|
|
public void issue_28_string() { |
|
|
|
String json = "{\"contents\": [\"one\",\"two\",\"three\"]}"; |
|
|
|
String json = "{\"contents\": [\"one\",\"two\",\"three\"]}"; |
|
|
|
|
|
|
|
|
|
|
|
List<String> result = JsonPath.read(json, "$.contents[?(@ == 'two')]"); |
|
|
|
List<String> result = JsonPath.read(json, "$.contents[?(@ == 'two')]"); |
|
|
@ -103,7 +103,7 @@ public class IssuesTest { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void issue_28_int(){ |
|
|
|
public void issue_28_int() { |
|
|
|
String json = "{\"contents\": [1,2,3]}"; |
|
|
|
String json = "{\"contents\": [1,2,3]}"; |
|
|
|
|
|
|
|
|
|
|
|
List<Integer> result = JsonPath.read(json, "$.contents[?(@ == 2)]"); |
|
|
|
List<Integer> result = JsonPath.read(json, "$.contents[?(@ == 2)]"); |
|
|
@ -113,7 +113,7 @@ public class IssuesTest { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void issue_28_boolean(){ |
|
|
|
public void issue_28_boolean() { |
|
|
|
String json = "{\"contents\": [true, true, false]}"; |
|
|
|
String json = "{\"contents\": [true, true, false]}"; |
|
|
|
|
|
|
|
|
|
|
|
List<Boolean> result = JsonPath.read(json, "$.contents[?(@ == true)]"); |
|
|
|
List<Boolean> result = JsonPath.read(json, "$.contents[?(@ == true)]"); |
|
|
@ -123,11 +123,23 @@ public class IssuesTest { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = PathNotFoundException.class) |
|
|
|
|
|
|
|
public void issue_22() throws Exception { |
|
|
|
|
|
|
|
String json = "{\"a\":{\"b\":1,\"c\":2}}"; |
|
|
|
|
|
|
|
System.out.println(JsonPath.read(json, "a.d")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void issue_22() throws Exception { |
|
|
|
public void issue_22b() throws Exception { |
|
|
|
String json = "{\"a\":[{\"b\":1,\"c\":2},{\"b\":5,\"c\":2}]}"; |
|
|
|
String json = "{\"a\":[{\"b\":1,\"c\":2},{\"b\":5,\"c\":2}]}"; |
|
|
|
System.out.println(JsonPath.read(json, "a[?(@.b==5)].d")); |
|
|
|
System.out.println(JsonPath.read(json, "a[?(@.b==5)].d")); |
|
|
|
|
|
|
|
System.out.println(JsonPath.read(json, "a[?(@.b==5)].d")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = PathNotFoundException.class) |
|
|
|
|
|
|
|
public void issue_26() throws Exception { |
|
|
|
|
|
|
|
String json = "[{\"a\":[{\"b\":1,\"c\":2}]}]"; |
|
|
|
|
|
|
|
Object o = JsonPath.read(json, "$.a"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -139,5 +151,4 @@ public class IssuesTest { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|