|
|
@ -60,15 +60,10 @@ public class FilterTest extends BaseTest { |
|
|
|
" }\n" + |
|
|
|
" }\n" + |
|
|
|
"}"; |
|
|
|
"}"; |
|
|
|
|
|
|
|
|
|
|
|
private static final JsonProvider jp = new JsonSmartJsonProvider(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final Configuration conf = Configuration.defaultConfiguration(); |
|
|
|
private static final Configuration conf = Configuration.defaultConfiguration(); |
|
|
|
//-------------------------------------------------
|
|
|
|
|
|
|
|
//
|
|
|
|
private static final JsonProvider jp = conf.jsonProvider(); |
|
|
|
// Single filter tests
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//-------------------------------------------------
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void is_filters_evaluates() throws Exception { |
|
|
|
public void is_filters_evaluates() throws Exception { |
|
|
|
final Map<String, Object> check = new HashMap<String, Object>(); |
|
|
|
final Map<String, Object> check = new HashMap<String, Object>(); |
|
|
|
check.put("foo", "foo"); |
|
|
|
check.put("foo", "foo"); |
|
|
@ -380,7 +375,7 @@ public class FilterTest extends BaseTest { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void filters_can_contain_json_path_expressions() throws Exception { |
|
|
|
public void filters_can_contain_json_path_expressions() throws Exception { |
|
|
|
Object doc = new JsonSmartJsonProvider().parse(DOCUMENT); |
|
|
|
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(DOCUMENT); |
|
|
|
|
|
|
|
|
|
|
|
assertFalse(filter(where("$.store.bicycle.color").ne("red")).apply(createPredicateContext(doc))); |
|
|
|
assertFalse(filter(where("$.store.bicycle.color").ne("red")).apply(createPredicateContext(doc))); |
|
|
|
} |
|
|
|
} |
|
|
@ -410,7 +405,7 @@ public class FilterTest extends BaseTest { |
|
|
|
"}\n"; |
|
|
|
"}\n"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object doc = new JsonSmartJsonProvider().parse(json); |
|
|
|
Object doc = Configuration.defaultConfiguration().jsonProvider().parse(json); |
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> result = JsonPath.read(doc, "$.fields[?]", filter(where("errors").notEmpty())); |
|
|
|
List<Map<String, Object>> result = JsonPath.read(doc, "$.fields[?]", filter(where("errors").notEmpty())); |
|
|
|
assertEquals(1, result.size()); |
|
|
|
assertEquals(1, result.size()); |
|
|
|