【发布时间】:2018-03-04 05:36:29
【问题描述】:
当我返回的数组无序时,如何测试正确的测试结果?我的测试失败,因为它们在数组中的顺序在每次测试运行时都不同。我该如何解决这个问题或解决无序数组?
mockMvc.perform(delete("/deleteSomeObject" + "/objIdLong" + "/objFKeyString"))
.
.
.andExpect(jsonPath("$[0].id.objIdLong", is(533252)))
.andExpect(jsonPath("$[0].id.objFKeyString", is("SomeString")))
.andExpect(jsonPath("$[1].id.objIdLong", is(642654252)))
.andExpect(jsonPath("$[1].id.objFKeyString", is("ThisString")))
.andExpect(jsonPath("$[2].id.objIdLong", is(4624352)))
.andExpect(jsonPath("$[2].id.objFKeyString", is("SomeOtherString")));
【问题讨论】:
标签: spring spring-boot junit mockmvc