Spring Boot:编写一个 Hello World 应用(Kotlin & Gradle)( 十 )
3
响应成功,并返回内容为:Hello, World!。
3.5. 单元测试
3.5.1. 编写测试用例
src/test/kotlin/org/springdev/guides/helloworld/HelloControllerTests.kt
package org.springdev.guides.helloworld
import org.junit.Test
import org.junit.runner.RunWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
import org.springframework.test.context.junit4.SpringRunner
import org.springframework.test.web.servlet.MockMvc
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
推荐阅读
- Rust编写广告拦截器的新引擎,为什么性能提高了69倍?
- BAT面试题汇总:分布式+Dubbo +JVM+微服务+多线程+Spring附答案
- 为什么C语言编译器能用C语言编写?
- BAT面试Java高岗必问115题:Spring,微服务,SpringMVC,MyBatis
- 图文与视频内容的小想法
- SpringBoot图文教程1「概念+案例 思维导图」「基础篇上」
- 安卓哥编写的Linux入门指南|值得收藏
- 24岁阿里P 7架构师为你进行spring源码深度解析,听完我立马就跪了
- 一文教你细数 SpringBoot 中的连接池
- BAT一线互联网常考面试题:Spring+并发编程+JVM+设计模式+Redis