package com.alibaba.json.bvt.issue_2200;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath;
import junit.framework.TestCase;

public class Issue2264 extends TestCase {
    public void test_for_issue() throws Exception {
        String oID="{\"sys\":\"ROC\",\"code\":0,\"messages\":\"分页获取信息成功！\",\"data\":{\"pageNum\":1,\"pageSize\":10,\"totalPages\":11,\"total\":110,\"records\":[{\"id\":\"64e72850-d149-46d6-8bd7-5f1d332d2a16\",\"tenantCode\":\"clouds_dianmo\",\"name\":\"asr_t1\",\"operatorId\":\"38ba5660-ef6e-4b66-9673-b0236832f179\",\"createTime\":\"2019-01-25 14:21:03\",\"updateTime\":\"2019-01-25 14:21:03\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"liyiwan\",\"insRcuCnt\":0,\"distRcuCnt\":0},{\"id\":\"4f6a0975-3980-4fd9-b27c-09aa258f4e36\",\"tenantCode\":\"cloudminds\",\"name\":\"xianglong\",\"operatorId\":\"b9bf937f-01c6-4fe8-86f8-43ce7a08167a\",\"createTime\":\"2019-01-25 11:48:03\",\"updateTime\":\"2019-01-25 13:03:00\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"zhangxianglong\",\"insRcuCnt\":0,\"distRcuCnt\":1},{\"id\":\"b209b3b8-7b41-49dd-a087-fb7f6b5bfa51\",\"tenantCode\":\"cloudminds\",\"name\":\"cloud_pu\",\"operatorId\":\"21d08412-9c19-49c0-9428-a6a5ad1bb548\",\"createTime\":\"2019-01-25 11:45:14\",\"updateTime\":\"2019-01-25 11:45:14\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"dian\",\"insRcuCnt\":0,\"distRcuCnt\":1},{\"id\":\"a35e468d-3ff5-48e4-a0e9-b86249167ee5\",\"tenantCode\":\"CloudPepper_Test\",\"name\":\"welcome\",\"operatorId\":\"ca69a720-8b8e-4ee5-8b12-63a20e897ef1\",\"createTime\":\"2019-01-25 11:05:42\",\"updateTime\":\"2019-01-25 14:07:05\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"duwei\",\"insRcuCnt\":0,\"distRcuCnt\":1},{\"id\":\"25243f56-b31d-4b58-bd96-c6920628b06c\",\"tenantCode\":\"roc\",\"name\":\"士大夫撒点\",\"operatorId\":\"06f82222-48a4-4a6a-b1cc-52148ed27651\",\"createTime\":\"2019-01-25 11:02:02\",\"updateTime\":\"2019-01-25 11:02:02\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"admin\",\"insRcuCnt\":0,\"distRcuCnt\":0},{\"id\":\"229d9c33-0606-4cda-a4d5-8c1feba2a5ed\",\"tenantCode\":\"cloudminds\",\"name\":\"LocalAsr\",\"operatorId\":\"38ba5660-ef6e-4b66-9673-b0236832f179\",\"createTime\":\"2019-01-25 10:51:43\",\"updateTime\":\"2019-01-25 10:51:43\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"liyiwan\",\"insRcuCnt\":0,\"distRcuCnt\":0},{\"id\":\"3aedd158-24b8-4021-a9a3-d6effc91a32a\",\"tenantCode\":\"cloudminds\",\"name\":\"cloudAsr\",\"operatorId\":\"38ba5660-ef6e-4b66-9673-b0236832f179\",\"createTime\":\"2019-01-25 10:27:59\",\"updateTime\":\"2019-01-25 10:27:59\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"liyiwan\",\"insRcuCnt\":0,\"distRcuCnt\":1},{\"id\":\"53065639-a467-4872-8333-73e085c99e43\",\"tenantCode\":\"CloudPepper_Test\",\"name\":\"asrtest\",\"operatorId\":\"394e0148-ba95-4c39-a9f9-973abb2c718a\",\"createTime\":\"2019-01-25 10:17:36\",\"updateTime\":\"2019-01-25 13:12:01\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"liuyanan\",\"insRcuCnt\":0,\"distRcuCnt\":1},{\"id\":\"da2db833-c065-49dd-bdb7-939c2026faa3\",\"tenantCode\":\"CloudPepper_Test\",\"name\":\"testwqeq\",\"operatorId\":\"bb5cd865-baea-42a0-a36d-b9e354b88f27\",\"createTime\":\"2019-01-24 19:20:04\",\"updateTime\":\"2019-01-24 19:20:27\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"cqtest01\",\"insRcuCnt\":0,\"distRcuCnt\":0},{\"id\":\"da672b14-d968-4776-97ba-b7c1addaa3b3\",\"tenantCode\":\"CloudPepper_Test\",\"name\":\"cqtestASR\",\"operatorId\":\"bb5cd865-baea-42a0-a36d-b9e354b88f27\",\"createTime\":\"2019-01-24 16:46:40\",\"updateTime\":\"2019-01-24 18:14:15\",\"status\":0,\"robotType\":1,\"policyType\":0,\"policyVersion\":null,\"description\":null,\"extensionJson\":null,\"operatorCode\":\"cqtest01\",\"insRcuCnt\":0,\"distRcuCnt\":2}]},\"errors\":null,\"action\":0,\"script\":\"\"}";

        JSONObject json = JSONObject.parseObject(oID);
        String par="$..records[?(@.name=='asr_t1')].operatorId";
        Object source = JSONPath.eval(json,par);
        String device_udid=JSONObject.toJSONString(source);
        assertEquals("[\"38ba5660-ef6e-4b66-9673-b0236832f179\"]", device_udid);
    }
}
