如何使用 Rest-Assured (2.4.0) 检查响应的 JSON 是否为一个空列表?
假设响应内容为 []
(带有头部信息content-type=application/json
),我尝试了以下方法:
.body(Matchers.emptyArray()) // expected: an empty array, actual: []
.body("/", Matchers.emptyArray()) // invalid expression /
.body(".", Matchers.emptyArray()) // invalid expression .
Object array[] = new Object[0];
new MatcherAssert().assertThat(array, Matchers.emptyArray());
- romfret