Search in sources :

Example 1 with Entity

use of com.alibaba.json.bvt.path.JSONPath_between_int.Entity in project fastjson by alibaba.

the class JSONPath_size method test_path_size_1.

public void test_path_size_1() throws Exception {
    List list = new ArrayList();
    list.add(new Entity(101, "kiki"));
    list.add(new Entity(102, "ljw2083"));
    list.add(new Entity(103, "ljw2083"));
    JSONPath path = JSONPath.compile("$");
    Assert.assertEquals(3, path.size(list));
}
Also used : Entity(com.alibaba.json.bvt.path.JSONPath_between_int.Entity) JSONPath(com.alibaba.fastjson.JSONPath) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 2 with Entity

use of com.alibaba.json.bvt.path.JSONPath_between_int.Entity in project fastjson by alibaba.

the class JSONPath_size method test_path.

public void test_path() throws Exception {
    List list = new ArrayList();
    list.add(new Entity(101, "kiki"));
    list.add(new Entity(102, "ljw2083"));
    list.add(new Entity(103, "ljw2083"));
    JSONObject root = new JSONObject();
    root.put("values", list);
    Assert.assertEquals(3, JSONPath.size(root, "$.values"));
}
Also used : Entity(com.alibaba.json.bvt.path.JSONPath_between_int.Entity) JSONObject(com.alibaba.fastjson.JSONObject) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 3 with Entity

use of com.alibaba.json.bvt.path.JSONPath_between_int.Entity in project fastjson by alibaba.

the class JSONPath_size method test_root.

public void test_root() throws Exception {
    List list = new ArrayList();
    list.add(new Entity(101, "kiki"));
    list.add(new Entity(102, "ljw2083"));
    list.add(new Entity(103, "ljw2083"));
    Assert.assertEquals(3, JSONPath.size(list, "$"));
}
Also used : Entity(com.alibaba.json.bvt.path.JSONPath_between_int.Entity) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 4 with Entity

use of com.alibaba.json.bvt.path.JSONPath_between_int.Entity in project fastjson by alibaba.

the class JSONPath_size method test_path_size_2.

public void test_path_size_2() throws Exception {
    List list = new ArrayList();
    list.add(new Entity(101, "kiki"));
    list.add(new Entity(102, "ljw2083"));
    list.add(new Entity(103, "ljw2083"));
    JSONObject root = new JSONObject();
    root.put("values", list);
    JSONPath path = JSONPath.compile("$.values");
    Assert.assertEquals(3, path.size(root));
}
Also used : Entity(com.alibaba.json.bvt.path.JSONPath_between_int.Entity) JSONPath(com.alibaba.fastjson.JSONPath) JSONObject(com.alibaba.fastjson.JSONObject) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

Entity (com.alibaba.json.bvt.path.JSONPath_between_int.Entity)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 JSONObject (com.alibaba.fastjson.JSONObject)2 JSONPath (com.alibaba.fastjson.JSONPath)2