|
|
|
@ -151,4 +151,47 @@ public class JsonOrgJsonProviderTest extends BaseTest {
|
|
|
|
|
Object result = JsonPath.read(json,"$..[?(@.price == 22.99)].length()"); |
|
|
|
|
assertThat(result).isEqualTo(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void test_issue_562() { |
|
|
|
|
String json = "{\n" + |
|
|
|
|
" \"store\": {\n" + |
|
|
|
|
" \"book\": [\n" + |
|
|
|
|
" {\n" + |
|
|
|
|
" \"category\": \"reference\",\n" + |
|
|
|
|
" \"author\": \"Nigel Rees\",\n" + |
|
|
|
|
" \"title\": \"Sayings of the Century\",\n" + |
|
|
|
|
" \"price\": 8.95\n" + |
|
|
|
|
" },\n" + |
|
|
|
|
" {\n" + |
|
|
|
|
" \"category\": \"fiction\",\n" + |
|
|
|
|
" \"author\": \"Evelyn Waugh\",\n" + |
|
|
|
|
" \"title\": \"Sword of Honour\",\n" + |
|
|
|
|
" \"price\": 12.99\n" + |
|
|
|
|
" },\n" + |
|
|
|
|
" {\n" + |
|
|
|
|
" \"category\": \"fiction\",\n" + |
|
|
|
|
" \"author\": \"Herman Melville\",\n" + |
|
|
|
|
" \"title\": \"Moby Dick\",\n" + |
|
|
|
|
" \"isbn\": \"0-553-21311-3\",\n" + |
|
|
|
|
" \"price\": 8.99\n" + |
|
|
|
|
" },\n" + |
|
|
|
|
" {\n" + |
|
|
|
|
" \"category\": \"fiction\",\n" + |
|
|
|
|
" \"author\": \"J. R. R. Tolkien\",\n" + |
|
|
|
|
" \"title\": \"The Lord of the Rings\",\n" + |
|
|
|
|
" \"isbn\": \"0-395-19395-8\",\n" + |
|
|
|
|
" \"price\": 22.99\n" + |
|
|
|
|
" }\n" + |
|
|
|
|
" ],\n" + |
|
|
|
|
" \"bicycle\": {\n" + |
|
|
|
|
" \"color\": \"red\",\n" + |
|
|
|
|
" \"price\": 19.95\n" + |
|
|
|
|
" }\n" + |
|
|
|
|
" },\n" + |
|
|
|
|
" \"expensive\": 10\n" + |
|
|
|
|
"}\n"; |
|
|
|
|
Object result = JsonPath.read(json,"$.store.book[?(@.price>10)].length()"); |
|
|
|
|
assertThat(result).isEqualTo(2); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|