【发布时间】:2012-11-24 14:00:01
【问题描述】:
是否可以使用 JsonPath 统计成员数?
使用spring mvc test 我正在测试一个生成的控制器
{"foo": "oof", "bar": "rab"}
与
standaloneSetup(new FooController(fooService)).build()
.perform(get("/something").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk())
.andExpect(jsonPath("$.foo").value("oof"))
.andExpect(jsonPath("$.bar").value("rab"));
我想确保生成的 json 中没有其他成员。希望通过使用 jsonPath 计算它们。可能吗?也欢迎其他解决方案。
【问题讨论】:
标签: java spring testing jsonpath spring-test-mvc