import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
public class HelloControllerTest { @Autowired
private MockMvc mockMvc; @Test
public void testHello() throws Exception { mockMvc.perform(MockMvcRequestBuilders.get("/hi").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().string("Hello world"));
}
}

最新文章

  1. EZchip将推全球首款100核64位ARM A-53芯片
  2. UIViewContentMode各类型效果
  3. SQL中CONVERT日期不同格式的转换用法
  4. 实现鼠标拖动canvas绘制的图片
  5. LINUX内核分析期末总结
  6. libcurl with telnet
  7. [转]Efficiently Paging Through Large Amounts of Data
  8. 关于android WebViewClient的方法解释
  9. 怎么让LinearLayout充满ScrollView
  10. iOS上用FTGL显示定制Truetype字体碰到的问题
  11. js冒泡事件的特例toggle无法实现阻止冒泡——slideDown()和slideUp()
  12. SPRING IN ACTION 第4版笔记-第八章Advanced Spring MVC-006-Pizza例子的支付流程
  13. chrome扩展——Postman
  14. CentOS安装JDK7
  15. 用xerces-c来进行xml schema校验
  16. Ant Design Pro+Electron+electron-builder实现React应用脱离浏览器,桌面安装运行
  17. centos7 关闭selinux
  18. javascript Object的新方法
  19. springMVC 几种页面跳转方式
  20. Centos7 配置ssh 免秘钥登陆

热门文章

  1. HTTP协议学习笔记---HTTP持久连接和如何正确地关闭HTTP连接
  2. PCA whitening
  3. pyqt5 鼠标操作
  4. 高版本sonar安装遇到的坑-sonar 6.6
  5. REUSE_ALV_GRID_DISPLAY详解
  6. 位运算&,逻辑与and
  7. sizeof strlen区别于联系
  8. Linux串口—struct termios结构体【转】
  9. python实战===教你用微信每天给女朋友说晚安
  10. oracle 远程导入导出(本地win)