
您需要在传递到的路径中包括上下文路径
get。
在问题中显示的情况下,上下文路径为
/api并且您想向其发出请求,
/因此您需要传递
/api/给
get:
@Testpublic void index() throws Exception { this.mockMvc.perform(get("/api/").contextPath("/api").accept(MediaTypes.HAL_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("_links.business-cases", is(notNullValue())));}欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)