我有一个像下面的json
{
"hasErrorResponse": "false",
"responseObject": [{
"success": true,
"errorMessage": null,
"availablity": "YES",
"errorCode": null,
"availableQtys": 1234,
"prId": "451667"
}]
}
现在使用RestAssured
如果我
response.then().assertThat().body("responseObject.prId", equalTo("451667"));
它失败了,因为它说Expected: 451667 but Got: [451667]
我想这是因为它将prId
属性设为ArrayList
而不是String
。我如何验证这个sceanrio?
答案 0 :(得分:0)
hasItems
matcher用于验证集合中的任何内容