You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2023/02/27 15:48:46 UTC

[shardingsphere] branch master updated: Use junit 5 on all agent modules (#24361)

This is an automated email from the ASF dual-hosted git repository.

zhaojinchao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 51ebf944ff3 Use junit 5 on all agent modules (#24361)
51ebf944ff3 is described below

commit 51ebf944ff3c6679ae765354d169d3755d01b93b
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Mon Feb 27 23:48:37 2023 +0800

    Use junit 5 on all agent modules (#24361)
    
    * Use junit 5 on agent-core module
    
    * Use junit 5 on all agent modules
---
 .../yaml/loader/YamlAdvisorsConfigurationLoaderTest.java   |  4 ++--
 .../yaml/swapper/YamlAdvisorsConfigurationSwapperTest.java |  2 +-
 .../agent/core/builder/AgentBuilderFactoryTest.java        | 14 +++++++-------
 .../agent/core/plugin/PluginContextTest.java               |  6 +++---
 .../core/plugin/PluginLifecycleServiceManagerTest.java     |  2 +-
 .../core/plugin/config/PluginConfigurationLoaderTest.java  |  4 ++--
 .../yaml/swapper/YamlPluginsConfigurationSwapperTest.java  |  6 +++---
 .../agent/core/spi/AgentServiceLoaderTest.java             | 13 +++++++------
 .../config/validator/PluginConfigurationValidatorTest.java | 13 +++++--------
 .../agent/plugin/core/util/AgentReflectionUtilTest.java    |  2 +-
 .../agent/plugin/core/util/MethodTimeRecorderTest.java     |  2 +-
 .../file/advice/MetaDataContextsFactoryAdviceTest.java     |  6 +++---
 .../metrics/core/advice/RouteResultCountAdviceTest.java    |  6 +++---
 .../metrics/core/advice/SQLParseCountAdviceTest.java       |  8 ++++----
 .../metrics/core/advice/SQLRouteCountAdviceTest.java       |  8 ++++----
 .../advice/proxy/CommitTransactionsCountAdviceTest.java    |  8 ++++----
 .../advice/proxy/CurrentConnectionsCountAdviceTest.java    |  8 ++++----
 .../core/advice/proxy/ExecuteErrorsCountAdviceTest.java    |  8 ++++----
 .../advice/proxy/ExecuteLatencyHistogramAdviceTest.java    |  8 ++++----
 .../metrics/core/advice/proxy/RequestsCountAdviceTest.java |  8 ++++----
 .../advice/proxy/RollbackTransactionsCountAdviceTest.java  |  8 ++++----
 .../metrics/core/exporter/impl/BuildInfoExporterTest.java  |  8 ++++----
 .../exporter/impl/proxy/ProxyMetaDataInfoExporterTest.java | 10 +++++-----
 .../core/exporter/impl/proxy/ProxyStateExporterTest.java   | 10 +++++-----
 .../prometheus/PrometheusPluginLifecycleServiceTest.java   |  8 ++++----
 .../collector/PrometheusMetricsCollectorFactoryTest.java   |  2 +-
 .../type/PrometheusMetricsCounterCollectorTest.java        |  2 +-
 .../type/PrometheusMetricsGaugeCollectorTest.java          |  2 +-
 .../PrometheusMetricsGaugeMetricFamilyCollectorTest.java   |  2 +-
 .../type/PrometheusMetricsHistogramCollectorTest.java      |  2 +-
 .../collector/type/PrometheusSummaryWrapperTest.java       |  2 +-
 .../prometheus/exoprter/PrometheusMetricsExporterTest.java |  4 ++--
 32 files changed, 97 insertions(+), 99 deletions(-)

diff --git a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/advisor/config/yaml/loader/YamlAdvisorsConfigurationLoaderTest.java b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/advisor/config/yaml/loader/YamlAdvisorsConfigurationLoaderTest.java
index 4a2a6a77f50..0415e66b25b 100644
--- a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/advisor/config/yaml/loader/YamlAdvisorsConfigurationLoaderTest.java
+++ b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/advisor/config/yaml/loader/YamlAdvisorsConfigurationLoaderTest.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.agent.core.advisor.config.yaml.entity.YamlPoint
 import org.apache.shardingsphere.agent.core.advisor.config.yaml.entity.YamlPointcutParameterConfiguration;
 import org.apache.shardingsphere.agent.core.advisor.config.yaml.fixture.YamlAdviceFixture;
 import org.apache.shardingsphere.agent.core.advisor.config.yaml.fixture.YamlTargetObjectFixture;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -32,7 +32,7 @@ import java.util.List;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public final class YamlAdvisorsConfigurationLoaderTest {
     
diff --git a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/advisor/config/yaml/swapper/YamlAdvisorsConfigurationSwapperTest.java b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/advisor/config/yaml/swapper/YamlAdvisorsConfigurationSwapperTest.java
index 7392caa2956..d0fa6ea2160 100644
--- a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/advisor/config/yaml/swapper/YamlAdvisorsConfigurationSwapperTest.java
+++ b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/advisor/config/yaml/swapper/YamlAdvisorsConfigurationSwapperTest.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.agent.core.advisor.config.MethodAdvisorConfigur
 import org.apache.shardingsphere.agent.core.advisor.config.yaml.entity.YamlAdvisorsConfiguration;
 import org.apache.shardingsphere.agent.core.advisor.config.yaml.fixture.YamlAdviceFixture;
 import org.apache.shardingsphere.agent.core.advisor.config.yaml.fixture.YamlTargetObjectFixture;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.yaml.snakeyaml.Yaml;
 
 import java.util.ArrayList;
diff --git a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/builder/AgentBuilderFactoryTest.java b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/builder/AgentBuilderFactoryTest.java
index 34e0b7978c6..f938ef3685d 100644
--- a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/builder/AgentBuilderFactoryTest.java
+++ b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/builder/AgentBuilderFactoryTest.java
@@ -21,14 +21,14 @@ import net.bytebuddy.agent.ByteBuddyAgent;
 import net.bytebuddy.agent.builder.AgentBuilder;
 import net.bytebuddy.agent.builder.ResettableClassFileTransformer;
 import net.bytebuddy.matcher.ElementMatchers;
+import org.apache.shardingsphere.agent.core.advisor.config.AdvisorConfiguration;
+import org.apache.shardingsphere.agent.core.advisor.config.MethodAdvisorConfiguration;
 import org.apache.shardingsphere.fixture.advice.BarAdvice;
 import org.apache.shardingsphere.fixture.advice.FooAdvice;
 import org.apache.shardingsphere.fixture.targeted.TargetObjectFixture;
-import org.apache.shardingsphere.agent.core.advisor.config.AdvisorConfiguration;
-import org.apache.shardingsphere.agent.core.advisor.config.MethodAdvisorConfiguration;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import java.util.Arrays;
 import java.util.Collections;
@@ -43,7 +43,7 @@ public final class AgentBuilderFactoryTest {
     
     private static ResettableClassFileTransformer agent;
     
-    @BeforeClass
+    @BeforeAll
     public static void setup() {
         ByteBuddyAgent.install();
         AdvisorConfiguration advisorConfig = createAdvisorConfiguration();
@@ -67,7 +67,7 @@ public final class AgentBuilderFactoryTest {
         return result;
     }
     
-    @AfterClass
+    @AfterAll
     public static void destroy() {
         agent.reset(ByteBuddyAgent.getInstrumentation(), AgentBuilder.RedefinitionStrategy.RETRANSFORMATION);
     }
diff --git a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/PluginContextTest.java b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/PluginContextTest.java
index 905d2e7c40a..d81cb035268 100644
--- a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/PluginContextTest.java
+++ b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/PluginContextTest.java
@@ -17,10 +17,10 @@
 
 package org.apache.shardingsphere.agent.core.plugin;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public final class PluginContextTest {
     
diff --git a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManagerTest.java b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManagerTest.java
index 7df5a5cf430..4b1866a9b6f 100644
--- a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManagerTest.java
+++ b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManagerTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.agent.core.plugin;
 
 import net.bytebuddy.dynamic.loading.MultipleParentClassLoader;
 import org.apache.shardingsphere.agent.api.PluginConfiguration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import javax.management.loading.PrivateMLet;
 import java.net.MalformedURLException;
diff --git a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/PluginConfigurationLoaderTest.java b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/PluginConfigurationLoaderTest.java
index 3bd97f78486..14a8ba4aa74 100644
--- a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/PluginConfigurationLoaderTest.java
+++ b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/PluginConfigurationLoaderTest.java
@@ -18,7 +18,7 @@
 package org.apache.shardingsphere.agent.core.plugin.config;
 
 import org.apache.shardingsphere.agent.api.PluginConfiguration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.io.File;
 import java.io.IOException;
@@ -29,7 +29,7 @@ import java.util.Objects;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
 
 public final class PluginConfigurationLoaderTest {
     
diff --git a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/yaml/swapper/YamlPluginsConfigurationSwapperTest.java b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/yaml/swapper/YamlPluginsConfigurationSwapperTest.java
index cca0dd6595e..ebd1a5c81a5 100644
--- a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/yaml/swapper/YamlPluginsConfigurationSwapperTest.java
+++ b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/config/yaml/swapper/YamlPluginsConfigurationSwapperTest.java
@@ -21,7 +21,7 @@ import org.apache.shardingsphere.agent.api.PluginConfiguration;
 import org.apache.shardingsphere.agent.core.plugin.config.yaml.entity.YamlAgentConfiguration;
 import org.apache.shardingsphere.agent.core.plugin.config.yaml.entity.YamlPluginCategoryConfiguration;
 import org.apache.shardingsphere.agent.core.plugin.config.yaml.entity.YamlPluginConfiguration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.yaml.snakeyaml.Yaml;
 
 import java.io.File;
@@ -36,8 +36,8 @@ import java.util.Properties;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public final class YamlPluginsConfigurationSwapperTest {
     
diff --git a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/spi/AgentServiceLoaderTest.java b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/spi/AgentServiceLoaderTest.java
index 8a84a2bd4b9..68432bedf6d 100644
--- a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/spi/AgentServiceLoaderTest.java
+++ b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/spi/AgentServiceLoaderTest.java
@@ -20,23 +20,24 @@ package org.apache.shardingsphere.agent.core.spi;
 import org.apache.shardingsphere.fixture.agent.AgentServiceEmptySPIFixture;
 import org.apache.shardingsphere.fixture.agent.AgentServiceSPIFixture;
 import org.apache.shardingsphere.fixture.agent.impl.AgentServiceSPIFixtureImpl;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public final class AgentServiceLoaderTest {
     
-    @Test(expected = NullPointerException.class)
+    @Test
     public void assertGetServiceLoaderWithNullValue() {
-        AgentServiceLoader.getServiceLoader(null);
+        assertThrows(NullPointerException.class, () -> AgentServiceLoader.getServiceLoader(null));
     }
     
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void assertGetServiceLoaderWithNoInterface() {
-        AgentServiceLoader.getServiceLoader(Object.class);
+        assertThrows(IllegalArgumentException.class, () -> AgentServiceLoader.getServiceLoader(Object.class));
     }
     
     @Test
diff --git a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/config/validator/PluginConfigurationValidatorTest.java b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/config/validator/PluginConfigurationValidatorTest.java
index dd8cf75804b..e7db2207566 100644
--- a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/config/validator/PluginConfigurationValidatorTest.java
+++ b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/config/validator/PluginConfigurationValidatorTest.java
@@ -18,9 +18,9 @@
 package org.apache.shardingsphere.agent.plugin.core.config.validator;
 
 import org.apache.shardingsphere.agent.api.PluginConfiguration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 public final class PluginConfigurationValidatorTest {
     
@@ -31,19 +31,16 @@ public final class PluginConfigurationValidatorTest {
     
     @Test
     public void assertValidateHostAndPortWhenHostIsEmpty() {
-        assertThrows("Hostname of foo_type is required", IllegalArgumentException.class,
-                () -> PluginConfigurationValidator.validateHostAndPort("foo_type", new PluginConfiguration("", 8080, "pwd", null)));
+        assertThrows(IllegalArgumentException.class, () -> PluginConfigurationValidator.validateHostAndPort("foo_type", new PluginConfiguration("", 8080, "pwd", null)));
     }
     
     @Test
     public void assertValidateHostAndPortWhenHostIsNull() {
-        assertThrows("Hostname of foo_type is required", IllegalArgumentException.class,
-                () -> PluginConfigurationValidator.validateHostAndPort("foo_type", new PluginConfiguration(null, 8080, "pwd", null)));
+        assertThrows(IllegalArgumentException.class, () -> PluginConfigurationValidator.validateHostAndPort("foo_type", new PluginConfiguration(null, 8080, "pwd", null)));
     }
     
     @Test
     public void assertValidateHostAndPortWhenPortLessThanOne() {
-        assertThrows("Port `0` of foo_host must be a positive number", IllegalArgumentException.class,
-                () -> PluginConfigurationValidator.validateHostAndPort("foo_type", new PluginConfiguration("localhost", 0, "pwd", null)));
+        assertThrows(IllegalArgumentException.class, () -> PluginConfigurationValidator.validateHostAndPort("foo_type", new PluginConfiguration("localhost", 0, "pwd", null)));
     }
 }
diff --git a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilTest.java b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilTest.java
index 87c1a92020e..20904dfbef1 100644
--- a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilTest.java
+++ b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilTest.java
@@ -18,7 +18,7 @@
 package org.apache.shardingsphere.agent.plugin.core.util;
 
 import org.apache.shardingsphere.agent.plugin.core.util.fixture.ReflectionFixture;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
diff --git a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/MethodTimeRecorderTest.java b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/MethodTimeRecorderTest.java
index 94efd428945..61af0382211 100644
--- a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/MethodTimeRecorderTest.java
+++ b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/MethodTimeRecorderTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.agent.plugin.core.util;
 
 import org.apache.shardingsphere.agent.api.advice.AgentAdvice;
 import org.apache.shardingsphere.agent.plugin.core.recorder.MethodTimeRecorder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
diff --git a/agent/plugins/logging/type/file/src/test/java/org/apache/shardingsphere/agent/plugin/logging/file/advice/MetaDataContextsFactoryAdviceTest.java b/agent/plugins/logging/type/file/src/test/java/org/apache/shardingsphere/agent/plugin/logging/file/advice/MetaDataContextsFactoryAdviceTest.java
index da35ad56352..5926825dfa7 100644
--- a/agent/plugins/logging/type/file/src/test/java/org/apache/shardingsphere/agent/plugin/logging/file/advice/MetaDataContextsFactoryAdviceTest.java
+++ b/agent/plugins/logging/type/file/src/test/java/org/apache/shardingsphere/agent/plugin/logging/file/advice/MetaDataContextsFactoryAdviceTest.java
@@ -21,8 +21,8 @@ import ch.qos.logback.classic.Level;
 import ch.qos.logback.classic.Logger;
 import ch.qos.logback.classic.spi.ILoggingEvent;
 import ch.qos.logback.core.read.ListAppender;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.slf4j.LoggerFactory;
 
 import java.lang.reflect.Method;
@@ -37,7 +37,7 @@ public final class MetaDataContextsFactoryAdviceTest {
     
     private ListAppender<ILoggingEvent> listAppender;
     
-    @Before
+    @BeforeEach
     public void setUp() {
         Logger logger = (Logger) LoggerFactory.getLogger(MetaDataContextsFactoryAdvice.class);
         listAppender = new ListAppender<>();
diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdviceTest.java
index a462ed17929..9348d115de8 100644
--- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdviceTest.java
+++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/RouteResultCountAdviceTest.java
@@ -25,8 +25,8 @@ import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.Met
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.infra.route.context.RouteMapper;
 import org.apache.shardingsphere.infra.route.context.RouteUnit;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
 
 import java.lang.reflect.Method;
 import java.util.Arrays;
@@ -40,7 +40,7 @@ public final class RouteResultCountAdviceTest {
     
     private final MetricConfiguration routedResultConfig = new MetricConfiguration("routed_result_total", MetricCollectorType.COUNTER, null, Arrays.asList("object", "name"));
     
-    @After
+    @AfterEach
     public void reset() {
         ((MetricsCollectorFixture) MetricsCollectorRegistry.get(routedResultConfig, "FIXTURE")).reset();
     }
diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java
index aa1fccc4113..1babdb98380 100644
--- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java
+++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLParseCountAdviceTest.java
@@ -17,10 +17,10 @@
 
 package org.apache.shardingsphere.agent.plugin.metrics.core.advice;
 
-import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
 import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
+import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
 import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
 import org.apache.shardingsphere.distsql.parser.statement.rdl.create.RegisterStorageUnitStatement;
 import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowStorageUnitsStatement;
@@ -36,8 +36,8 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQ
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLSelectStatement;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLUpdateStatement;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.tcl.MySQLCommitStatement;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
 
 import java.lang.reflect.Method;
 import java.util.Collections;
@@ -50,7 +50,7 @@ public final class SQLParseCountAdviceTest {
     
     private final MetricConfiguration config = new MetricConfiguration("parsed_sql_total", MetricCollectorType.COUNTER, null, Collections.singletonList("type"), Collections.emptyMap());
     
-    @After
+    @AfterEach
     public void reset() {
         ((MetricsCollectorFixture) MetricsCollectorRegistry.get(config, "FIXTURE")).reset();
     }
diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java
index 4f7640d044a..c24f12a1477 100644
--- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java
+++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/SQLRouteCountAdviceTest.java
@@ -20,8 +20,8 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice;
 import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
 import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
+import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
 import org.apache.shardingsphere.infra.binder.QueryContext;
 import org.apache.shardingsphere.infra.binder.statement.CommonSQLStatementContext;
 import org.apache.shardingsphere.infra.context.ConnectionContext;
@@ -29,8 +29,8 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQ
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLInsertStatement;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLSelectStatement;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLUpdateStatement;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
 
 import java.lang.reflect.Method;
 import java.util.Collections;
@@ -45,7 +45,7 @@ public final class SQLRouteCountAdviceTest {
     
     private final SQLRouteCountAdvice advice = new SQLRouteCountAdvice();
     
-    @After
+    @AfterEach
     public void reset() {
         ((MetricsCollectorFixture) MetricsCollectorRegistry.get(config, "FIXTURE")).reset();
     }
diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdviceTest.java
index f4b9815c0b1..b008099af29 100644
--- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdviceTest.java
+++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CommitTransactionsCountAdviceTest.java
@@ -17,13 +17,13 @@
 
 package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
 
-import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
 import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
+import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
 import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
 
 import java.lang.reflect.Method;
 import java.util.Collections;
@@ -38,7 +38,7 @@ public final class CommitTransactionsCountAdviceTest {
     
     private final CommitTransactionsCountAdvice advice = new CommitTransactionsCountAdvice();
     
-    @After
+    @AfterEach
     public void reset() {
         ((MetricsCollectorFixture) MetricsCollectorRegistry.get(config, "FIXTURE")).reset();
     }
diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdviceTest.java
index 54a1cf46a12..b45ce32be94 100644
--- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdviceTest.java
+++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/CurrentConnectionsCountAdviceTest.java
@@ -20,10 +20,10 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
 import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
 import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
-import org.junit.After;
-import org.junit.Test;
+import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
 
 import java.lang.reflect.Method;
 import java.util.Collections;
@@ -39,7 +39,7 @@ public final class CurrentConnectionsCountAdviceTest {
     
     private final CurrentConnectionsCountAdvice advice = new CurrentConnectionsCountAdvice();
     
-    @After
+    @AfterEach
     public void reset() {
         ((MetricsCollectorFixture) MetricsCollectorRegistry.get(config, "FIXTURE")).reset();
     }
diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java
index e2e58dbb635..e4ff40ef718 100644
--- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java
+++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteErrorsCountAdviceTest.java
@@ -20,10 +20,10 @@ package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
 import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
 import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
-import org.junit.After;
-import org.junit.Test;
+import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
 
 import java.lang.reflect.Method;
 import java.util.Collections;
@@ -36,7 +36,7 @@ public final class ExecuteErrorsCountAdviceTest {
     
     private final MetricConfiguration config = new MetricConfiguration("proxy_execute_errors_total", MetricCollectorType.COUNTER, null, Collections.emptyList(), Collections.emptyMap());
     
-    @After
+    @AfterEach
     public void reset() {
         ((MetricsCollectorFixture) MetricsCollectorRegistry.get(config, "FIXTURE")).reset();
     }
diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java
index ff72b5aa2ea..12b93fe923e 100644
--- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java
+++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java
@@ -17,13 +17,13 @@
 
 package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
 
-import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
 import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
+import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
 import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
 
 import java.lang.reflect.Method;
 import java.util.Collections;
@@ -36,7 +36,7 @@ public final class ExecuteLatencyHistogramAdviceTest {
     
     private final MetricConfiguration config = new MetricConfiguration("proxy_execute_latency_millis", MetricCollectorType.HISTOGRAM, null, Collections.emptyList(), Collections.emptyMap());
     
-    @After
+    @AfterEach
     public void reset() {
         ((MetricsCollectorFixture) MetricsCollectorRegistry.get(config, "FIXTURE")).reset();
     }
diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdviceTest.java
index f3654c5ed91..a8fe5e0b0e4 100644
--- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdviceTest.java
+++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RequestsCountAdviceTest.java
@@ -17,13 +17,13 @@
 
 package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
 
-import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
 import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
+import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
 import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
 
 import java.lang.reflect.Method;
 import java.util.Collections;
@@ -38,7 +38,7 @@ public final class RequestsCountAdviceTest {
     
     private final RequestsCountAdvice advice = new RequestsCountAdvice();
     
-    @After
+    @AfterEach
     public void reset() {
         ((MetricsCollectorFixture) MetricsCollectorRegistry.get(config, "FIXTURE")).reset();
     }
diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdviceTest.java
index a08f50bf2ea..59c348f4823 100644
--- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdviceTest.java
+++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/RollbackTransactionsCountAdviceTest.java
@@ -17,13 +17,13 @@
 
 package org.apache.shardingsphere.agent.plugin.metrics.core.advice.proxy;
 
-import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
 import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
+import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.TargetAdviceObjectFixture;
 import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
 
 import java.lang.reflect.Method;
 import java.util.Collections;
@@ -38,7 +38,7 @@ public final class RollbackTransactionsCountAdviceTest {
     
     private final RollbackTransactionsCountAdvice advice = new RollbackTransactionsCountAdvice();
     
-    @After
+    @AfterEach
     public void reset() {
         ((MetricsCollectorFixture) MetricsCollectorRegistry.get(config, "FIXTURE")).reset();
     }
diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/BuildInfoExporterTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/BuildInfoExporterTest.java
index 102d0e5e4c8..b23dc0ed662 100644
--- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/BuildInfoExporterTest.java
+++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/BuildInfoExporterTest.java
@@ -23,8 +23,8 @@ import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollecto
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
 import org.apache.shardingsphere.agent.plugin.metrics.core.fixture.collector.MetricsCollectorFixture;
 import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
 
 import java.util.Arrays;
 import java.util.Collections;
@@ -32,11 +32,11 @@ import java.util.Optional;
 
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public final class BuildInfoExporterTest {
     
-    @After
+    @AfterEach
     public void reset() {
         MetricConfiguration config = new MetricConfiguration("build_info", MetricCollectorType.GAUGE_METRIC_FAMILY, null, Arrays.asList("name", "version"), Collections.emptyMap());
         ((MetricsCollectorFixture) MetricsCollectorRegistry.get(config, "FIXTURE")).reset();
diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporterTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporterTest.java
index 8905fe9ddef..12377fa6a1f 100644
--- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporterTest.java
+++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyMetaDataInfoExporterTest.java
@@ -28,8 +28,8 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
 import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
 import org.mockito.MockedStatic;
 
 import javax.sql.DataSource;
@@ -38,8 +38,8 @@ import java.util.Optional;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.mockStatic;
@@ -47,7 +47,7 @@ import static org.mockito.Mockito.when;
 
 public final class ProxyMetaDataInfoExporterTest {
     
-    @After
+    @AfterEach
     public void reset() {
         MetricConfiguration config = new MetricConfiguration("proxy_meta_data_info", MetricCollectorType.GAUGE_METRIC_FAMILY, null, Collections.singletonList("name"), Collections.emptyMap());
         ((MetricsCollectorFixture) MetricsCollectorRegistry.get(config, "FIXTURE")).reset();
diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyStateExporterTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyStateExporterTest.java
index 8f45ffbaae7..0eb2d95456b 100644
--- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyStateExporterTest.java
+++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/proxy/ProxyStateExporterTest.java
@@ -36,8 +36,8 @@ import org.apache.shardingsphere.mode.manager.standalone.workerid.generator.Stan
 import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
 import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
 import org.mockito.MockedStatic;
 
 import java.util.Collections;
@@ -45,15 +45,15 @@ import java.util.Optional;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.mockStatic;
 
 public final class ProxyStateExporterTest {
     
-    @After
+    @AfterEach
     public void reset() {
         MetricConfiguration config = new MetricConfiguration("proxy_state", MetricCollectorType.GAUGE_METRIC_FAMILY, null, Collections.emptyList(), Collections.emptyMap());
         ((MetricsCollectorFixture) MetricsCollectorRegistry.get(config, "FIXTURE")).reset();
diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java
index fe229f0e872..01bb5fe3582 100644
--- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java
+++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java
@@ -33,8 +33,8 @@ import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.test.util.PropertiesBuilder;
 import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
-import org.junit.After;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
 import org.mockito.MockedStatic;
 
 import java.io.IOException;
@@ -49,7 +49,7 @@ public final class PrometheusPluginLifecycleServiceTest {
     
     private final PrometheusPluginLifecycleService pluginLifecycleService = new PrometheusPluginLifecycleService();
     
-    @After
+    @AfterEach
     public void close() {
         pluginLifecycleService.close();
     }
@@ -60,7 +60,7 @@ public final class PrometheusPluginLifecycleServiceTest {
         try (MockedStatic<ProxyContext> proxyContext = mockStatic(ProxyContext.class, RETURNS_DEEP_STUBS)) {
             proxyContext.when(() -> ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
             pluginLifecycleService.start(new PluginConfiguration("localhost", 8090, "", PropertiesBuilder.build(new Property("JVM_INFORMATION_COLLECTOR_ENABLED", Boolean.TRUE.toString()))), true);
-            try (Socket socket = new Socket();) {
+            try (Socket socket = new Socket()) {
                 socket.connect(new InetSocketAddress("localhost", 8090));
             }
         }
diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/PrometheusMetricsCollectorFactoryTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/PrometheusMetricsCollectorFactoryTest.java
index 87b3e622d8e..152479612f5 100644
--- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/PrometheusMetricsCollectorFactoryTest.java
+++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/PrometheusMetricsCollectorFactoryTest.java
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.type.
 import org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.type.PrometheusMetricsGaugeMetricFamilyCollector;
 import org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.type.PrometheusMetricsHistogramCollector;
 import org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.type.PrometheusMetricsSummaryCollector;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.Collections;
 
diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsCounterCollectorTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsCounterCollectorTest.java
index c6866aee5f3..ffbf65afdba 100644
--- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsCounterCollectorTest.java
+++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsCounterCollectorTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.type
 import io.prometheus.client.Counter;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.mockito.internal.configuration.plugins.Plugins;
 
 import java.util.Collections;
diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeCollectorTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeCollectorTest.java
index f95aa4e2942..068c449f44f 100644
--- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeCollectorTest.java
+++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeCollectorTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.type
 import io.prometheus.client.Gauge;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.mockito.internal.configuration.plugins.Plugins;
 
 import java.util.Collections;
diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeMetricFamilyCollectorTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeMetricFamilyCollectorTest.java
index e3c36d2bfc4..bc1fb526f7d 100644
--- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeMetricFamilyCollectorTest.java
+++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeMetricFamilyCollectorTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.type
 import io.prometheus.client.GaugeMetricFamily;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.mockito.internal.configuration.plugins.Plugins;
 
 import java.util.Collections;
diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsHistogramCollectorTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsHistogramCollectorTest.java
index cccf89886d0..b41e5f61fd4 100644
--- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsHistogramCollectorTest.java
+++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsHistogramCollectorTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.type
 import io.prometheus.client.Histogram;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.mockito.internal.configuration.plugins.Plugins;
 
 import java.util.Collections;
diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusSummaryWrapperTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusSummaryWrapperTest.java
index 593f83820d5..eba8e12319e 100644
--- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusSummaryWrapperTest.java
+++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusSummaryWrapperTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.type
 import io.prometheus.client.Summary;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
 import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricConfiguration;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.mockito.internal.configuration.plugins.Plugins;
 
 import java.util.Collections;
diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/PrometheusMetricsExporterTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/PrometheusMetricsExporterTest.java
index c9ac4145bad..e800986d888 100644
--- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/PrometheusMetricsExporterTest.java
+++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/exoprter/PrometheusMetricsExporterTest.java
@@ -19,13 +19,13 @@ package org.apache.shardingsphere.agent.plugin.metrics.prometheus.exoprter;
 
 import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.GaugeMetricFamilyMetricsCollector;
 import org.apache.shardingsphere.agent.plugin.metrics.core.exporter.MetricsExporter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.util.Optional;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;