springboot测试的时候status(),content()方法报错
来源:互联网 发布:java 启动事务 编辑:程序博客网 时间:2024/06/05 03:04
@Testpublic void testHello() throws Exception {mockMvc.perform(MockMvcRequestBuilders.get("/hello").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(content().string(equalTo("Hello World!")));}
是因为静态导入的原因,只要导入:
import static org.hamcrest.Matchers.equalTo; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;然后就OK了。
阅读全文
0 0
- springboot测试的时候status(),content()方法报错
- textView.setText() 的时候报错 android.content.res.Resources$NotFoundException: String resource ID #0x0
- springboot报错(二) Internal Server Error,status=500
- SpringBoot在利用JDBCTemplate连接数据库的时候报错Incorrect column count: expected 1, actual 3] with root cause
- adb 报错的时候
- 启动R12 AP时候报错:adformsctl.sh: exiting with status 150/204
- MFC扩展DLL调用对话框,测试的时候报错问题的解决
- 使用Springboot的报错问题
- mybatis测试的时候报错No suitable driver found for jdbc。。。解决办法
- Struts框架demo测试的时候报错:org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFil
- springboot项目浏览器报错:There was an unexpected error (type=Not Found, status=404).
- IOS真机运行带有Notification Content target的时候证书报错This application or a bundle it contains has the same bun
- 启动springboot报错
- 小记---idea springboot 报错没有get或者set方法
- 报错:HTTP Status 500 -
- ssh整合DWR的时候报 HTTP Status 404 - There is no Action mapped for namespace / and action name bookInfo.
- eclipse+tomcat测试连接时候HTTP Status 404错误
- eclipse+tomcat测试连接时候HTTP Status 404错误
- springcloud注册中心
- 开发环境如何运行web项目不带项目名字
- TensorFlow神经网络模型不收敛的处理
- scala初学之Tuple、Array、Map、文件操作入门实战
- python编码格式
- springboot测试的时候status(),content()方法报错
- 反射得到类的内部信息
- 佛祖保佑 永无bug" 注释模板设置详解(仅供娱乐)
- 用Python做数据分析:Pandas常用数据查询语法
- n阶汉诺塔的递归算法
- 线性代数 03.05 矩阵的初等变换与线性方程组 习题课
- 物理地址=段地址向左移1个16进制位+偏移量
- 107. Binary Tree Level Order Traversal II
- 在Android Studio中使用Git