Skip to content

Commit

Permalink
开启 2.4.0 版本,并使用 junit5 来做单元测试
Browse files Browse the repository at this point in the history
  • Loading branch information
blinkfox committed Dec 7, 2020
1 parent 0291c2d commit 1a3745c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.blinkfox</groupId>
<artifactId>fenix-spring-boot-starter</artifactId>
<version>2.3.7-SNAPSHOT</version>
<version>2.4.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>fenix-spring-boot-starter</name>
Expand Down Expand Up @@ -35,7 +35,7 @@

<properties>
<java.version>1.8</java.version>
<spring.boot.version>2.3.4.RELEASE</spring.boot.version>
<spring.boot.version>2.4.0</spring.boot.version>
</properties>

<dependencies>
Expand All @@ -60,7 +60,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<version>1.18.16</version>
<optional>true</optional>
</dependency>

Expand All @@ -79,7 +79,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.21.Final</version>
<version>5.4.22.Final</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,34 @@
import com.blinkfox.fenix.config.FenixConfig;
import com.blinkfox.fenix.config.FenixConfigManager;
import com.blinkfox.fenix.helper.StringHelper;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
* 用于测试在 SpringBoot 中使用该 Fenix Spring Boot Starter 的测试类.
*
* @author blinkfox on 2018-08-14.
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class FenixStarterApplicationTest {
class FenixStarterApplicationTest {

/**
* 测试 Fenix 的配置加载情况是否正确.
*/
@Test
public void testFenixConfig() {
void testFenixConfig() {
// 测试常规配置.
FenixConfig fenixConfig = FenixConfigManager.getInstance().getFenixConfig();
Assert.assertTrue(fenixConfig.isPrintBanner());
Assert.assertFalse(fenixConfig.isPrintSqlInfo());
Assertions.assertTrue(fenixConfig.isPrintBanner());
Assertions.assertFalse(fenixConfig.isPrintSqlInfo());

// 测试扫描位置的配置.
Assert.assertEquals("fenix,myxml", fenixConfig.getXmlLocations());
Assert.assertTrue(StringHelper.isNotBlank(fenixConfig.getHandlerLocations()));
Assertions.assertEquals("fenix,myxml", fenixConfig.getXmlLocations());
Assertions.assertTrue(StringHelper.isNotBlank(fenixConfig.getHandlerLocations()));

// 测试 xml 和 handler 的扫描的结果是否正确存储到了内存中.
Assert.assertFalse(FenixConfig.getTagHandlerMap().isEmpty());
Assertions.assertFalse(FenixConfig.getTagHandlerMap().isEmpty());
}

}

0 comments on commit 1a3745c

Please sign in to comment.