Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用请求参数作为字符串检查controllerTest中的NullvalueException(Spring mvc)_Java_Spring Mvc - Fatal编程技术网

Java 如何使用请求参数作为字符串检查controllerTest中的NullvalueException(Spring mvc)

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

我必须在ControllerTest(spring,java)中检查NullvalueException。 函数@requestParam中有一个字符串。 我用这种方法测试控制器,但失败了

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

谁能告诉我为什么失败了