refactor: simplify config build

This commit is contained in:
ReaJason
2025-09-12 22:51:50 +08:00
parent da16649e6f
commit f33972e460
12 changed files with 247 additions and 18 deletions
@@ -0,0 +1,35 @@
package com.reajason.javaweb.memshell.config;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* @author ReaJason
* @since 2025/8/26
*/
class AntSwordConfigTest {
@Test
void test() {
AntSwordConfig antSwordConfig = AntSwordConfig.builder()
.pass("")
.headerName(null)
.headerValue("").build();
assertNotNull(antSwordConfig.getPass());
assertNotNull(antSwordConfig.getHeaderName());
assertNotNull(antSwordConfig.getHeaderValue());
}
@Test
void testInit(){
AntSwordConfig antSwordConfig = AntSwordConfig.builder()
.pass("pass")
.headerName("ua")
.headerValue("v").build();
assertEquals("pass", antSwordConfig.getPass());
assertEquals("ua", antSwordConfig.getHeaderName());
assertEquals("v", antSwordConfig.getHeaderValue());
}
}
@@ -0,0 +1,24 @@
package com.reajason.javaweb.memshell.config;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* @author ReaJason
* @since 2025/8/26
*/
class BehinderConfigTest {
@Test
void test() {
BehinderConfig behinderConfig = BehinderConfig.builder()
.pass(null)
.headerName("")
.headerValue("").build();
assertNotNull(behinderConfig.getPass());
assertNotNull(behinderConfig.getHeaderName());
assertNotNull(behinderConfig.getHeaderValue());
}
}
@@ -0,0 +1,26 @@
package com.reajason.javaweb.memshell.config;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* @author ReaJason
* @since 2025/8/25
*/
class GodzillaConfigTest {
@Test
void testNull() {
GodzillaConfig godzillaConfig = GodzillaConfig.builder()
.pass(null)
.key("")
.headerName(null)
.headerValue("")
.build();
assertNotNull(godzillaConfig.getPass());
assertNotNull(godzillaConfig.getKey());
assertNotNull(godzillaConfig.getHeaderName());
assertNotNull(godzillaConfig.getHeaderValue());
}
}