【发布时间】:2016-11-30 04:34:57
【问题描述】:
我需要jUnit测试的帮助,我的结果是json文件,我需要测试那个文件的长度,问题是jsonPath函数里面没有这个方法。
@Test
@Transactional
public void getMunicipalitiesByCity() throws Exception {
restSampleMockMvc.perform(get("/api/insurancePlan/municipalities/city/{cityName}", "esc"))
.andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.length").value(7));
这是我的测试方法,预期长度为 7。 任何帮助将不胜感激,谢谢
【问题讨论】: