【发布时间】:2018-03-02 07:04:35
【问题描述】:
我正在测试休息控制器。这是测试代码:
mockMvc.perform(get("/index/get-all"))
.andExpect(status().isOk())
.andDo(print())
.andExpect(jsonPath("$",hasSize(2)));
我得到响应正文:
Body = [{"id":"123"},{"id":"1234"}]
我得到错误:
java.lang.AssertionError: No value at JSON path "$", exception: net/minidev/json/writer/JsonReaderI
我做错了什么?
【问题讨论】: