mirror of
https://gitee.com/yudaocode/SpringBoot-Labs.git
synced 2026-09-03 05:53:54 +08:00
增加 ut 示例
This commit is contained in:
@@ -66,7 +66,7 @@
|
||||
## 持续交付
|
||||
|
||||
* [《芋道 Spring Boot 持续交付 Jenkins 入门》](http://www.iocoder.cn/Spring-Boot/Jenkins/?github) 对应 [lab-41](https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-41) 。
|
||||
* 《芋道 Spring Boot 单元测试 Test 入门》计划中...
|
||||
* [《芋道 Spring Boot 单元测试 Test 入门》](http://www.iocoder.cn/Spring-Boot/Unit-Test/?github) 对应 [lab-42](https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-42) 。
|
||||
* 《芋道 Spring Boot 容器 Docker 入门》计划中...
|
||||
|
||||
## 监控管理
|
||||
|
||||
@@ -37,11 +37,10 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<groupId>com.h2database</groupId> <!-- 单元测试,我们采用 H2 作为数据库 -->
|
||||
<artifactId>h2</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
spring:
|
||||
application:
|
||||
name: demo-application
|
||||
|
||||
# datasource 数据源配置内容
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3306/lab-39-mysql?useSSL=false&useUnicode=true&characterEncoding=UTF-8
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.springframework.test.context.jdbc.Sql;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
|
||||
@SpringBootTest
|
||||
public class UserDaoTest {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
|
||||
@SpringBootTest
|
||||
public class UserServiceTest {
|
||||
|
||||
@MockBean
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
spring:
|
||||
application:
|
||||
name: demo-application
|
||||
|
||||
# datasource 数据源配置内容
|
||||
datasource:
|
||||
url: jdbc:h2:mem:testdb
|
||||
|
||||
Reference in New Issue
Block a user