diff --git a/pom.xml b/pom.xml
index 2f5abeb62e..425e2d54b2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -82,22 +82,28 @@
UTF-8
- false
- false
- 3.0.0
- 3.5.0
- 3.0.1
- 3.0.1
- 3.1.2
17
17
- 3.7.0
- 3.1.0
+ 17
+
+ false
false
- 3.1.2
- 3.0.1
+ false
+ 3.11.0
+ 3.0.0-M9
+ 3.0.0-M9
+ 3.3.0
+ 3.3.0
+ 3.5.0
+ 3.1.1
+ 3.4.1
+ 3.1.0
+ 3.1.0
+
+ 0.8.11
0.7.0
3.1.0
+ 5.14.2
UTF-8
@@ -124,46 +130,19 @@
org.junit.jupiter
junit-jupiter-api
- 5.9.3
+ ${junit.version}
test
org.junit.jupiter
junit-jupiter-engine
- 5.9.3
- test
-
-
-
- junit
- junit
- 4.13.2
+ ${junit.version}
test
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
org.jacoco
org.jacoco.agent
- 0.8.11
+ ${jacoco.version}
runtime
test
@@ -199,14 +178,14 @@
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
+ --add-opens java.base/java.io=ALL-UNNAMED
${maven.ignore.testfailure}
false
-
- ${project.build.directory}/coverage.exec
-
-
../../site/junit
+ false
+ 1
+ true
@@ -272,22 +251,22 @@
org.jacoco
jacoco-maven-plugin
- 0.8.8
+ ${jacoco.version}
false
+ ${project.build.directory}/coverage.exec
+ true
- default-instrument
-
- instrument
-
-
-
- default-restore-instrumented-classes
+ prepare-agent
- restore-instrumented-classes
+ prepare-agent
+
+ surefireArgLine
+ ${project.build.directory}/coverage.exec
+
report
@@ -300,6 +279,13 @@
../../site/${project.artifactId}
+
+ aggregate
+ verify
+
+ report-aggregate
+
+
@@ -307,6 +293,25 @@
exec-maven-plugin
${exec.maven.version}
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+ ${maven.failsafe.version}
+
+
+ --add-opens java.base/java.lang=ALL-UNNAMED
+ --add-opens java.base/java.util=ALL-UNNAMED
+
+
+
+
+
+ integration-test
+ verify
+
+
+
+
@@ -327,6 +332,10 @@
org.jacoco
jacoco-maven-plugin
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
diff --git a/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/YamlUtilsTest.java b/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/YamlUtilsTest.java
index 6acd1cb644..bbf699be57 100644
--- a/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/YamlUtilsTest.java
+++ b/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/YamlUtilsTest.java
@@ -16,10 +16,10 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
@@ -31,7 +31,7 @@ public class YamlUtilsTest {
private YamlUtils yamlUtils;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
this.properties = new HashMap<>();
properties.put("string", "string");
@@ -41,7 +41,7 @@ public void setUp() throws Exception {
this.yamlUtils = new YamlUtils("");
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
properties.clear();
}
@@ -49,64 +49,64 @@ public void tearDown() throws Exception {
@Test
public void testGetString() {
String string = yamlUtils.getString(properties, "string");
- Assert.assertEquals("string", string);
+ Assertions.assertEquals("string", string);
properties.put("string", null);
try {
yamlUtils.getString(properties, "string");
} catch (Exception e) {
- Assert.assertTrue(e instanceof IllegalArgumentException);
+ Assertions.assertTrue(e instanceof IllegalArgumentException);
}
}
@Test
public void testGetInteger() {
int integer = yamlUtils.getInteger(properties, "integer");
- Assert.assertEquals(integer, 10);
+ Assertions.assertEquals(integer, 10);
properties.put("integer", null);
try {
yamlUtils.getInteger(properties, "integer");
} catch (Exception e) {
- Assert.assertTrue(e instanceof IllegalArgumentException);
+ Assertions.assertTrue(e instanceof IllegalArgumentException);
}
}
@Test
public void testGetBoolean() {
boolean bool = yamlUtils.getBoolean(properties, "boolean");
- Assert.assertTrue(bool);
+ Assertions.assertTrue(bool);
properties.put("boolean", null);
try {
yamlUtils.getBoolean(properties, "boolean");
} catch (Exception e) {
- Assert.assertTrue(e instanceof IllegalArgumentException);
+ Assertions.assertTrue(e instanceof IllegalArgumentException);
}
}
@Test
public void testGetCollection() {
Collection collection = yamlUtils.getCollection(properties, "collection");
- Assert.assertNotNull(collection);
+ Assertions.assertNotNull(collection);
properties.put("collection", null);
try {
yamlUtils.getBoolean(properties, "collection");
} catch (Exception e) {
- Assert.assertTrue(e instanceof IllegalArgumentException);
+ Assertions.assertTrue(e instanceof IllegalArgumentException);
}
}
@Test
public void testGetStringList() {
List collection = yamlUtils.getStringList(properties, "collection");
- Assert.assertNotNull(collection);
+ Assertions.assertNotNull(collection);
try {
yamlUtils.requireMap(Arrays.asList(1, 2), "key");
} catch (Exception e) {
- Assert.assertTrue(e instanceof IllegalArgumentException);
+ Assertions.assertTrue(e instanceof IllegalArgumentException);
}
}
}
diff --git a/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/EnvironmentConfigurationTest.java b/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/EnvironmentConfigurationTest.java
index 6fcd0d5fca..e4d543c24c 100644
--- a/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/EnvironmentConfigurationTest.java
+++ b/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/EnvironmentConfigurationTest.java
@@ -2,16 +2,16 @@
import com.tencent.trpc.container.config.ApplicationConfigParser;
import com.tencent.trpc.core.extension.ExtensionLoader;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class EnvironmentConfigurationTest {
private Environment environment;
- @Before
+ @BeforeEach
public void init() {
System.setProperty("global.namespace", "${env_type_enhancer}");
System.setProperty("server.app", "wechat");
@@ -34,7 +34,7 @@ public void init() {
environment = new Environment(parser);
}
- @After
+ @AfterEach
public void teardown() {
System.clearProperty("global.namespace");
System.clearProperty("server.app");
@@ -57,6 +57,6 @@ public void teardown() {
@Test
public void testGetInternalProperty() {
Object internalProperty = environment.getInternalProperty("server.app");
- Assert.assertEquals(internalProperty, "wechat");
+ Assertions.assertEquals(internalProperty, "wechat");
}
-}
\ No newline at end of file
+}
diff --git a/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/EnvironmentTest.java b/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/EnvironmentTest.java
index 25e91f60e4..8c0cae9807 100644
--- a/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/EnvironmentTest.java
+++ b/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/EnvironmentTest.java
@@ -11,19 +11,19 @@
package com.tencent.trpc.container.config.system;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.tencent.trpc.container.config.ApplicationConfigParser;
import com.tencent.trpc.core.common.ConfigManager;
import com.tencent.trpc.core.extension.ExtensionLoader;
import java.util.Map;
import java.util.NoSuchElementException;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* Environment test class
@@ -34,7 +34,7 @@ public class EnvironmentTest {
private ConfigManager configManager;
private ConfigManager otherConfigManager;
- @Before
+ @BeforeEach
public void init() {
System.setProperty("global.namespace", "${env_type_enhancer}");
System.setProperty("server.app", "wechat");
@@ -59,7 +59,7 @@ public void init() {
otherConfigManager = environment.parse();
}
- @After
+ @AfterEach
public void teardown() {
System.clearProperty("global.namespace");
System.clearProperty("server.app");
@@ -123,9 +123,11 @@ public void testOverrideConfig() {
assertEquals(protocol, configManager.getClientConfig().getProtocol());
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void testInteger() {
- environment.getInteger("global.namespace", 2);
+ Assertions.assertThrows(IllegalStateException.class, () -> {
+ environment.getInteger("global.namespace", 2);
+ });
}
@Test
@@ -133,54 +135,74 @@ public void testBoolean() {
environment.getBoolean("global.namespace", true);
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void testShort() {
- environment.getShort("global.namespace", (short) 2);
+ Assertions.assertThrows(IllegalStateException.class, () -> {
+ environment.getShort("global.namespace", (short) 2);
+ });
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void testByte() {
- environment.getByte("global.namespace", (byte) 2);
+ Assertions.assertThrows(IllegalStateException.class, () -> {
+ environment.getByte("global.namespace", (byte) 2);
+ });
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void testFloat() {
- environment.getFloat("global.namespace", 2f);
+ Assertions.assertThrows(IllegalStateException.class, () -> {
+ environment.getFloat("global.namespace", 2f);
+ });
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void testDouble() {
- environment.getDouble("global.namespace", 2d);
+ Assertions.assertThrows(IllegalStateException.class, () -> {
+ environment.getDouble("global.namespace", 2d);
+ });
}
- @Test(expected = NoSuchElementException.class)
+ @Test
public void testIntNoElement() {
- environment.getInt("global.namespace.not.exist");
+ Assertions.assertThrows(NoSuchElementException.class, () -> {
+ environment.getInt("global.namespace.not.exist");
+ });
}
- @Test(expected = NoSuchElementException.class)
+ @Test
public void testBooleanNoElement() {
- environment.getBoolean("global.namespace.not.exist");
+ Assertions.assertThrows(NoSuchElementException.class, () -> {
+ environment.getBoolean("global.namespace.not.exist");
+ });
}
- @Test(expected = NoSuchElementException.class)
+ @Test
public void testShortNoElement() {
- environment.getShort("global.namespace.not.exist");
+ Assertions.assertThrows(NoSuchElementException.class, () -> {
+ environment.getShort("global.namespace.not.exist");
+ });
}
- @Test(expected = NoSuchElementException.class)
+ @Test
public void testByteNoElement() {
- environment.getByte("global.namespace.not.exist");
+ Assertions.assertThrows(NoSuchElementException.class, () -> {
+ environment.getByte("global.namespace.not.exist");
+ });
}
- @Test(expected = NoSuchElementException.class)
+ @Test
public void testFloatNoElement() {
- environment.getFloat("global.namespace.not.exist");
+ Assertions.assertThrows(NoSuchElementException.class, () -> {
+ environment.getFloat("global.namespace.not.exist");
+ });
}
- @Test(expected = NoSuchElementException.class)
+ @Test
public void testDoubleNoElement() {
- environment.getDouble("global.namespace.not.exist");
+ Assertions.assertThrows(NoSuchElementException.class, () -> {
+ environment.getDouble("global.namespace.not.exist");
+ });
}
@Test
diff --git a/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/SystemConfigurationTest.java b/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/SystemConfigurationTest.java
index 7f216d975d..0bfa801719 100644
--- a/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/SystemConfigurationTest.java
+++ b/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/SystemConfigurationTest.java
@@ -1,17 +1,16 @@
package com.tencent.trpc.container.config.system;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
public class SystemConfigurationTest {
@Test
public void testGetInternalProperty() {
- System.setProperty("testSysProperty","1");
+ System.setProperty("testSysProperty", "1");
SystemConfiguration systemConfiguration = new SystemConfiguration();
Object result = systemConfiguration.getInternalProperty("testSysProperty");
assertEquals("1", result);
}
-}
\ No newline at end of file
+}
diff --git a/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/parser/DefaultPropertySourceParserTest.java b/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/parser/DefaultPropertySourceParserTest.java
index c03eb914f1..3919db6f4e 100644
--- a/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/parser/DefaultPropertySourceParserTest.java
+++ b/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/system/parser/DefaultPropertySourceParserTest.java
@@ -3,18 +3,17 @@
import com.tencent.trpc.container.config.system.Configuration;
import com.tencent.trpc.core.utils.YamlParser;
import java.util.Map;
-import junit.framework.TestCase;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Assertions;
-public class DefaultPropertySourceParserTest extends TestCase {
+public class DefaultPropertySourceParserTest {
@Test
public void testGetFlattableMap() {
Map yamlConfigMap = YamlParser.parseAsFromClassPath("listener_default.yaml", Map.class);
DefaultPropertySourceParser propertySourceParser = new DefaultPropertySourceParser();
Map flattableMap = propertySourceParser.getFlattableMap(yamlConfigMap);
- Assert.assertEquals(147, flattableMap.size());
+ Assertions.assertEquals(147, flattableMap.size());
}
@Test
@@ -22,8 +21,8 @@ public void testParseFlattableMap() {
Map yamlConfigMap = YamlParser.parseAsFromClassPath("listener_default.yaml", Map.class);
DefaultPropertySourceParser propertySourceParser = new DefaultPropertySourceParser();
Map stringObjectMap = propertySourceParser.parseFlattableMap(yamlConfigMap);
- Assert.assertEquals(4, stringObjectMap.size());
+ Assertions.assertEquals(4, stringObjectMap.size());
Boolean aBoolean = Configuration.toBooleanObject(true);
- Assert.assertTrue(aBoolean);
+ Assertions.assertTrue(aBoolean);
}
-}
\ No newline at end of file
+}
diff --git a/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/yaml/BackendConfigParserTest.java b/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/yaml/BackendConfigParserTest.java
index 708675a0eb..fbd81e7187 100644
--- a/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/yaml/BackendConfigParserTest.java
+++ b/trpc-container/trpc-container-default/src/test/java/com/tencent/trpc/container/config/yaml/BackendConfigParserTest.java
@@ -13,8 +13,8 @@
import com.tencent.trpc.core.common.config.BackendConfig;
import com.tencent.trpc.core.utils.YamlParser;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -27,18 +27,18 @@ public class BackendConfigParserTest {
@Test
public void testParseConfigMap() {
BackendConfigParser backendConfigParser = new BackendConfigParser();
- Assert.assertNotNull(backendConfigParser);
+ Assertions.assertNotNull(backendConfigParser);
Map yamlConfigMap = YamlParser.parseAsFromClassPath("trpc_java_config.yaml", Map.class);
List