我必须检查ControllerTest中的NullvalueException(spring,java)。 在函数@requestParam中是一个String。 我以这种方式测试Controller,但它失败了
when(ServiceImpl.getAllByName(null)).thenThrow(new NullValueException(message));
mockMvc.perform(get("/tag/tag?name=null").
contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(status().isOk()).andExpect(jsonPath("$.fetchresponseList", IsNull.nullValue()))
错误: java.lanag.assertionFailure 状态预计为200但是400
任何人都可以告诉我它失败的原因吗?