升级 Junit5,移除 hutool,使用 commons-lang3。

pull/1/head
ZhouXY108 2023-02-24 09:45:04 +08:00
parent 8545dd714f
commit b6e823a211
3 changed files with 31 additions and 11 deletions

31
pom.xml
View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>xyz.zhouxy.plusone</groupId>
@ -15,6 +15,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<commons-lang3.version>3.12.0</commons-lang3.version>
</properties>
<dependencies>
@ -22,17 +23,35 @@
<groupId>xyz.zhouxy.plusone</groupId>
<artifactId>plusone-commons</artifactId>
<version>0.1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
<version>5.8.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<pluginManagement>
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>

View File

@ -4,7 +4,8 @@ import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;
import cn.hutool.core.util.StrUtil;
import org.apache.commons.lang3.StringUtils;
import xyz.zhouxy.plusone.constant.RegexConsts;
import xyz.zhouxy.plusone.util.RegexUtil;
@ -108,7 +109,7 @@ public class StringValidator<DTO> extends PropertyValidator<DTO, String, StringV
public <E extends RuntimeException> StringValidator<DTO> notBlank(
Function<String, E> exceptionCreator) {
withRule(input -> StrUtil.isNotBlank(input), exceptionCreator);
withRule(StringUtils::isNotBlank, exceptionCreator);
return this;
}

View File

@ -4,15 +4,15 @@ import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import xyz.zhouxy.plusone.constant.RegexConsts;
import xyz.zhouxy.plusone.validator.BaseValidator;
import xyz.zhouxy.plusone.validator.ValidateUtil;
public class BaseValidatorTest {
class BaseValidatorTest {
@Test
public void testValidate() {
void testValidate() {
RegisterCommand registerCommand = new RegisterCommand("zhouxy108", "luquanlion@outlook.com", "22336", "A1b2C3d4",
"A1b2C3d4",
Arrays.asList(new String[] { "admin", "editor" }));