com.github.binarylei:spring-boot-test-autoconfigure-support

spring-boot-test-extend...

License

License

Categories

Categories

Spring Boot Container Microservices Auto Application Layer Libs Code Generators config Configuration
GroupId

GroupId

com.github.binarylei
ArtifactId

ArtifactId

spring-boot-test-autoconfigure-support
Last Version

Last Version

0.1.2-beta
Release Date

Release Date

Type

Type

jar
Description

Description

spring-boot-test-extend...

Download spring-boot-test-autoconfigure-support

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.binarylei/spring-boot-test-autoconfigure-support/ -->
<dependency>
    <groupId>com.github.binarylei</groupId>
    <artifactId>spring-boot-test-autoconfigure-support</artifactId>
    <version>0.1.2-beta</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.binarylei/spring-boot-test-autoconfigure-support/
implementation 'com.github.binarylei:spring-boot-test-autoconfigure-support:0.1.2-beta'
// https://jarcasting.com/artifacts/com.github.binarylei/spring-boot-test-autoconfigure-support/
implementation ("com.github.binarylei:spring-boot-test-autoconfigure-support:0.1.2-beta")
'com.github.binarylei:spring-boot-test-autoconfigure-support:jar:0.1.2-beta'
<dependency org="com.github.binarylei" name="spring-boot-test-autoconfigure-support" rev="0.1.2-beta">
  <artifact name="spring-boot-test-autoconfigure-support" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.binarylei', module='spring-boot-test-autoconfigure-support', version='0.1.2-beta')
)
libraryDependencies += "com.github.binarylei" % "spring-boot-test-autoconfigure-support" % "0.1.2-beta"
[com.github.binarylei/spring-boot-test-autoconfigure-support "0.1.2-beta"]

Dependencies

compile (9)

Group / Artifact Type Version
com.baomidou : mybatis-plus-boot-starter Optional jar 3.4.0
com.baomidou : dynamic-datasource-spring-boot-starter Optional jar 3.2.1
org.mybatis.spring.boot : mybatis-spring-boot-starter-test Optional jar 2.1.3
org.mybatis.spring.boot : mybatis-spring-boot-starter Optional jar 2.1.3
org.springframework.boot : spring-boot-starter-jdbc jar 2.1.1.RELEASE
com.h2database : h2 jar 1.4.197
com.github.binarylei : spring-boot-test-data-redis Optional jar 0.1.2-beta
org.springframework.boot : spring-boot-starter-test jar 2.1.1.RELEASE
org.projectlombok : lombok Optional jar 1.18.4

Project Modules

There are no modules declared in this project.

spring-boot-test-extend

目前只支持 Redis 的有限操作,后续计划增加对 Kafka、mybatis-plus 等常见外部资源单元测试的依赖,争取做到常见外部资源的自动装配,简化单元测试。

  1. MockSpringRunner Unit 使用说明

  2. Mybatis Unit 使用说明

  3. Mybatis-Plus Unit 使用说明

  4. Redis Unit 使用说明

Redis Unit 使用说明

详见 spring-boot-test-data-redis-sample 工程

  1. 使用 @RedisTest 注解自动注入 Redis 测试环境
@Configuration
@RedisTest
public class RedisConfig {
}
  1. 至此,你就可以将 RedisTemplate 无缝集成到你的测试环境中
@RunWith(SpringRunner.class)
@SpringBootTest(classes = RedisConfig.class)
public class AutoConfigureRedisTest {

    @Autowired
    private RedisTemplate redisTemplate;

    @Test
    public void testAutoConfigureRedis() {
        redisTemplate.opsForValue().set("key1", "value1");
        Assert.assertEquals("value1", redisTemplate.opsForValue().get("key1"));
    }
}

Versions

Version
0.1.2-beta