Java 如何使用请求参数作为字符串检查controllerTest中的NullvalueException(Spring mvc)
我必须在ControllerTest(spring,java)中检查NullvalueException。 函数@requestParam中有一个字符串。 我用这种方法测试控制器,但失败了Java 如何使用请求参数作为字符串检查controllerTest中的NullvalueException(Spring mvc),java,spring-mvc,Java,Spring Mvc,我必须在ControllerTest(spring,java)中检查NullvalueException。 函数@requestParam中有一个字符串。 我用这种方法测试控制器,但失败了 when(ServiceImpl.getAllByName(null)).thenthow(newnullValueException(message)); mockMvc.perform(get(“/tag/tag?name=null”)。 contentType(MediaType.APPLICATION
when(ServiceImpl.getAllByName(null)).thenthow(newnullValueException(message));
mockMvc.perform(get(“/tag/tag?name=null”)。
contentType(MediaType.APPLICATION\u JSON\u值))
.andExpect(status().isOk()).andExpect(jsonPath(“$.fetchresponseList”,IsNull.nullValue())
错误:
java.lanag.assertionFailure
预计状态为200,但为400
谁能告诉我为什么失败了