use of com.alibaba.fastjson.JSONPath in project fastjson by alibaba.
the class JSONPath_field_access_filter_compare_int method test_list_map_gt.
public void test_list_map_gt() throws Exception {
JSONPath path = new JSONPath("$[?(@.id > 1002)]");
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(1, result.size());
Assert.assertSame(entities.get(2), result.get(0));
}
use of com.alibaba.fastjson.JSONPath in project fastjson by alibaba.
the class JSONPath_field_access_filter_compare_int method test_list_map_ge.
public void test_list_map_ge() throws Exception {
JSONPath path = new JSONPath("$[?(@.id >= 1002)]");
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(2, result.size());
Assert.assertSame(entities.get(1), result.get(0));
Assert.assertSame(entities.get(2), result.get(1));
}
use of com.alibaba.fastjson.JSONPath in project fastjson by alibaba.
the class JSONPath_field_access_filter_compare_int method test_list_map_lt.
public void test_list_map_lt() throws Exception {
JSONPath path = new JSONPath("$[?(@.id < 1002)]");
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(1, result.size());
Assert.assertSame(entities.get(0), result.get(0));
}
use of com.alibaba.fastjson.JSONPath in project fastjson by alibaba.
the class JSONPath_field_access_filter_compare_int_simple method test_list_2.
public void test_list_2() throws Exception {
JSONPath path = new JSONPath("[id <= 1002]");
List<Entity> entities = new ArrayList<Entity>();
entities.add(new Entity(1001, "ljw2083"));
entities.add(new Entity(1002, "wenshao"));
entities.add(new Entity(1003, null));
entities.add(new Entity(null, null));
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(2, result.size());
Assert.assertSame(entities.get(0), result.get(0));
Assert.assertSame(entities.get(1), result.get(1));
}
use of com.alibaba.fastjson.JSONPath in project fastjson by alibaba.
the class JSONPath_field_access_filter_compare_int_simple method test_list.
public void test_list() throws Exception {
JSONPath path = new JSONPath("$[id <= 1002]");
List<Entity> entities = new ArrayList<Entity>();
entities.add(new Entity(1001, "ljw2083"));
entities.add(new Entity(1002, "wenshao"));
entities.add(new Entity(1003, null));
entities.add(new Entity(null, null));
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(2, result.size());
Assert.assertSame(entities.get(0), result.get(0));
Assert.assertSame(entities.get(1), result.get(1));
}
Aggregations