【发布时间】:2015-05-11 06:12:35
【问题描述】:
我是新来的放心。使用“放心”尝试验证是否找到数据详细信息。这里存在两个数据详细信息。有时会是 2 或 3 或 5 我得到如下响应并使用 java
{
"queryPath": "/api/",
"nId": "f084f5ad24fcfaa9e9faea0",
"statusCode": 707
"statusMessage": "Success",
"results": {
"data": [
{
"id": "10248522500798",
"capabilities": [
"record",
"HDt"
],
"name": "errt2"
},
{
"id": "418143778",
"capabilities": [
"1record",
"HDy"
],
"name": "Livin"
}
]
}
}
代码使用
JsonPath jsonResponse = new JsonPath(response.asString());
ArrayList<String> list = new ArrayList<String>();
list = jsonResponse.get("results.data"); //
if (list.size() < 1 ) {
SpiceCheck.fail("data not found! " + list.size());
}
我还想检查数据名称是否为空。我怎样才能放心。
【问题讨论】:
标签: java json rest hamcrest rest-assured