【发布时间】:2020-07-01 15:08:37
【问题描述】:
几乎没有尝试检查 json 是否有包含两个项目的数组:
{
"sections" : [
{
"name" : "A",
"description" : "aaa"
},
{
"name" : "B",
"description" : "bbb"
}
]
}
但只是附带
.andExpect(jsonPath("$.sections[?(@.name=='A' && @.description=='aaa')]", hasSize(1)))
有什么方法可以使用 hasItem/hasProperty/containInAnyOrder 将其转换为 Harmcrest 匹配器?
【问题讨论】:
标签: java junit jsonpath hamcrest