杰森身体:
{
"result": [
{
"object": {
"type": "mattress"
}
},
{
"object": {
"type": "pillow"
}
}
]
}
我如何使用放心的身体和 hamcrest 断言断言该型别只是枕头或床垫(可能还有更多,所以我正在寻找通用解决方案)?
示例断言:
response.then().assertThat().body("result", hasSize(greaterThan(0)));
uj5u.com热心网友回复:
此代码将解决您的问题:
.body("result.object.type", everyItem(isOneOf("mattress", "pillow")));
0 评论