[SCB-2632] migrate java-chassis-core module to junit5 part 1 (#3179)

diff --git a/core/src/test/java/org/apache/servicecomb/core/TestConfig.java b/core/src/test/java/org/apache/servicecomb/core/TestConfig.java
index 81a050e..02f8200 100644
--- a/core/src/test/java/org/apache/servicecomb/core/TestConfig.java
+++ b/core/src/test/java/org/apache/servicecomb/core/TestConfig.java
@@ -29,8 +29,8 @@
 import org.apache.servicecomb.swagger.invocation.context.HttpStatus;
 import org.apache.servicecomb.swagger.invocation.context.InvocationContext;
 import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
-import org.junit.Test;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 public class TestConfig {
   @Test
diff --git a/core/src/test/java/org/apache/servicecomb/core/TestConfigurationSpringInitializer.java b/core/src/test/java/org/apache/servicecomb/core/TestConfigurationSpringInitializer.java
index d9d8e05..496bf0d 100644
--- a/core/src/test/java/org/apache/servicecomb/core/TestConfigurationSpringInitializer.java
+++ b/core/src/test/java/org/apache/servicecomb/core/TestConfigurationSpringInitializer.java
@@ -26,10 +26,10 @@
 import org.apache.log4j.Logger;
 import org.apache.servicecomb.config.ConfigUtil;
 import org.apache.servicecomb.foundation.test.scaffolding.config.ArchaiusUtils;
-import org.junit.After;
-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;
 import org.mockito.ArgumentMatchers;
 import org.mockito.Mockito;
 import org.mockito.stubbing.Answer;
@@ -47,7 +47,7 @@
 import mockit.Deencapsulation;
 
 public class TestConfigurationSpringInitializer {
-  @Before
+  @BeforeEach
   public void beforeTest() {
     Logger.getRootLogger().setLevel(Level.OFF);
 
@@ -57,7 +57,7 @@
     Logger.getRootLogger().setLevel(Level.INFO);
   }
 
-  @After
+  @AfterEach
   public void afterTest() {
     ConfigUtil.clearExtraConfig();
     ArchaiusUtils.resetConfig();
@@ -218,12 +218,14 @@
     Assertions.assertEquals("value2", extraProperties.get("key2"));
   }
 
-  @Test(expected = RuntimeException.class)
-  public void shoud_throw_exception_when_given_ignoreResolveFailure_false() {
-    StandardEnvironment environment = newStandardEnvironment();
+  @Test
+  public void should_throw_exception_when_given_ignoreResolveFailure_false() {
+    Assertions.assertThrows(RuntimeException.class, () -> {
+      StandardEnvironment environment = newStandardEnvironment();
 
-    ConfigurationSpringInitializer configurationSpringInitializer = new ConfigurationSpringInitializer();
-    configurationSpringInitializer.setEnvironment(environment);
+      ConfigurationSpringInitializer configurationSpringInitializer = new ConfigurationSpringInitializer();
+      configurationSpringInitializer.setEnvironment(environment);
+    });
   }
 
   private Map<String, Map<String, Object>> getExtraConfigMapFromConfigUtil() {
diff --git a/core/src/test/java/org/apache/servicecomb/core/TestCseApplicationListener.java b/core/src/test/java/org/apache/servicecomb/core/TestCseApplicationListener.java
index 4059406..4325e86 100644
--- a/core/src/test/java/org/apache/servicecomb/core/TestCseApplicationListener.java
+++ b/core/src/test/java/org/apache/servicecomb/core/TestCseApplicationListener.java
@@ -20,28 +20,28 @@
 import org.apache.servicecomb.core.bootstrap.SCBBootstrap;
 import org.apache.servicecomb.foundation.test.scaffolding.config.ArchaiusUtils;
 import org.apache.servicecomb.registry.DiscoveryManager;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
 import org.springframework.context.event.ContextClosedEvent;
 
-import mockit.Mocked;
-
 public class TestCseApplicationListener {
-  @Before
+  @BeforeEach
   public void before() {
     ConfigUtil.installDynamicConfig();
   }
 
-  @AfterClass
+  @AfterAll
   public static void classTeardown() {
     DiscoveryManager.renewInstance();
     ArchaiusUtils.resetConfig();
   }
 
   @Test
-  public void onApplicationEvent_close(@Mocked ContextClosedEvent contextClosedEvent) {
+  public void onApplicationEvent_close() {
+    ContextClosedEvent contextClosedEvent = Mockito.mock(ContextClosedEvent.class);
     SCBEngine scbEngine = SCBBootstrap.createSCBEngineForTest();
     scbEngine.setStatus(SCBStatus.UP);
 
diff --git a/core/src/test/java/org/apache/servicecomb/core/TestEndpoint.java b/core/src/test/java/org/apache/servicecomb/core/TestEndpoint.java
index 87cdc8f..9650bc3 100644
--- a/core/src/test/java/org/apache/servicecomb/core/TestEndpoint.java
+++ b/core/src/test/java/org/apache/servicecomb/core/TestEndpoint.java
@@ -18,21 +18,16 @@
 package org.apache.servicecomb.core;
 
 import org.apache.servicecomb.registry.api.registry.MicroserviceInstance;
-import org.junit.Test;
-
-import mockit.Expectations;
-import mockit.Mocked;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
 
 public class TestEndpoint {
   @Test
-  public void testEndpoint(@Mocked Transport transport) {
-    new Expectations() {
-      {
-        transport.parseAddress("rest://123.6.6.6:8080");
-        result = "rest://123.6.6.6:8080";
-      }
-    };
+  public void testEndpoint() {
+    Transport transport = Mockito.mock(Transport.class);
+    Mockito.when(transport.parseAddress("rest://123.6.6.6:8080")).thenReturn("rest://123.6.6.6:8080");
+
     Endpoint endpoint = new Endpoint(transport, "rest://123.6.6.6:8080");
     Assertions.assertEquals(endpoint.getAddress(), "rest://123.6.6.6:8080");
     Assertions.assertEquals(endpoint.getEndpoint(), "rest://123.6.6.6:8080");
@@ -41,7 +36,9 @@
   }
 
   @Test
-  public void testEndpointAddressConstructor(@Mocked Transport transport, @Mocked MicroserviceInstance instance) {
+  public void testEndpointAddressConstructor() {
+    Transport transport = Mockito.mock(Transport.class);
+    MicroserviceInstance instance = Mockito.mock(MicroserviceInstance.class);
     Endpoint endpoint = new Endpoint(transport, "rest://123.6.6.6:8080", instance, "iot://123.6.6.6:8080");
     Assertions.assertEquals(endpoint.getAddress(), "iot://123.6.6.6:8080");
     Assertions.assertEquals(endpoint.getEndpoint(), "rest://123.6.6.6:8080");
diff --git a/core/src/test/java/org/apache/servicecomb/core/TestException.java b/core/src/test/java/org/apache/servicecomb/core/TestException.java
index d4739a5..be6dc45 100644
--- a/core/src/test/java/org/apache/servicecomb/core/TestException.java
+++ b/core/src/test/java/org/apache/servicecomb/core/TestException.java
@@ -19,8 +19,8 @@
 
 import org.apache.servicecomb.core.exception.CseException;
 import org.apache.servicecomb.core.exception.ExceptionUtils;
-import org.junit.Test;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 public class TestException {
   @Test
diff --git a/core/src/test/java/org/apache/servicecomb/core/TestTransport.java b/core/src/test/java/org/apache/servicecomb/core/TestTransport.java
index e4e3203..e97f808 100644
--- a/core/src/test/java/org/apache/servicecomb/core/TestTransport.java
+++ b/core/src/test/java/org/apache/servicecomb/core/TestTransport.java
@@ -18,18 +18,18 @@
 package org.apache.servicecomb.core;
 
 import org.apache.servicecomb.swagger.invocation.AsyncResponse;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 public class TestTransport {
-  @BeforeClass
+  @BeforeAll
   public static void classSetup() {
 
   }
 
-  @AfterClass
+  @AfterAll
   public static void classTeardown() {
     SCBEngine.getInstance().destroy();
   }
diff --git a/core/src/test/java/org/apache/servicecomb/core/consumer/TestReactiveResponseExecutor.java b/core/src/test/java/org/apache/servicecomb/core/consumer/TestReactiveResponseExecutor.java
index cec56c0..0e2b33b 100644
--- a/core/src/test/java/org/apache/servicecomb/core/consumer/TestReactiveResponseExecutor.java
+++ b/core/src/test/java/org/apache/servicecomb/core/consumer/TestReactiveResponseExecutor.java
@@ -18,8 +18,8 @@
 package org.apache.servicecomb.core.consumer;
 
 import org.apache.servicecomb.core.provider.consumer.ReactiveResponseExecutor;
-import org.junit.Test;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
 
 public class TestReactiveResponseExecutor {
diff --git a/core/src/test/java/org/apache/servicecomb/core/consumer/TestSyncResponseExecutor.java b/core/src/test/java/org/apache/servicecomb/core/consumer/TestSyncResponseExecutor.java
index 2ce9844..7502030 100644
--- a/core/src/test/java/org/apache/servicecomb/core/consumer/TestSyncResponseExecutor.java
+++ b/core/src/test/java/org/apache/servicecomb/core/consumer/TestSyncResponseExecutor.java
@@ -20,8 +20,8 @@
 import org.apache.servicecomb.core.Invocation;
 import org.apache.servicecomb.core.provider.consumer.SyncResponseExecutor;
 import org.apache.servicecomb.swagger.invocation.Response;
-import org.junit.Test;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
 
 public class TestSyncResponseExecutor {
diff --git a/core/src/test/java/org/apache/servicecomb/core/definition/TestMicroserviceMetaManager.java b/core/src/test/java/org/apache/servicecomb/core/definition/TestMicroserviceMetaManager.java
index 68c0c94..8d89a10 100644
--- a/core/src/test/java/org/apache/servicecomb/core/definition/TestMicroserviceMetaManager.java
+++ b/core/src/test/java/org/apache/servicecomb/core/definition/TestMicroserviceMetaManager.java
@@ -17,8 +17,8 @@
 
 package org.apache.servicecomb.core.definition;
 
-import org.junit.Test;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
 
 public class TestMicroserviceMetaManager {
diff --git a/core/src/test/java/org/apache/servicecomb/core/event/TestInvocationStartEvent.java b/core/src/test/java/org/apache/servicecomb/core/event/TestInvocationStartEvent.java
index 48e8521..6e0649d 100644
--- a/core/src/test/java/org/apache/servicecomb/core/event/TestInvocationStartEvent.java
+++ b/core/src/test/java/org/apache/servicecomb/core/event/TestInvocationStartEvent.java
@@ -17,16 +17,16 @@
 package org.apache.servicecomb.core.event;
 
 import org.apache.servicecomb.core.Invocation;
-import org.junit.Test;
-
-import mockit.Mocked;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
 
 public class TestInvocationStartEvent {
   InvocationStartEvent event;
 
   @Test
-  public void construct(@Mocked Invocation invocation) {
+  public void construct() {
+    Invocation invocation = Mockito.mock(Invocation.class);
     event = new InvocationStartEvent(invocation);
 
     Assertions.assertSame(invocation, event.getInvocation());
diff --git a/core/src/test/java/org/apache/servicecomb/core/executor/TestGroupExecutor.java b/core/src/test/java/org/apache/servicecomb/core/executor/TestGroupExecutor.java
index dcb9ff8..0a596b4 100644
--- a/core/src/test/java/org/apache/servicecomb/core/executor/TestGroupExecutor.java
+++ b/core/src/test/java/org/apache/servicecomb/core/executor/TestGroupExecutor.java
@@ -23,22 +23,22 @@
 
 import org.apache.servicecomb.foundation.test.scaffolding.config.ArchaiusUtils;
 import org.apache.servicecomb.foundation.test.scaffolding.log.LogCollector;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
 
 import mockit.Deencapsulation;
+import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class TestGroupExecutor {
   String strThreadTest = "default";
 
-  @Before
+  @BeforeEach
   public void setup() {
     ArchaiusUtils.resetConfig();
   }
 
-  @AfterClass
+  @AfterAll
   public static void teardown() {
     ArchaiusUtils.resetConfig();
   }
diff --git a/core/src/test/java/org/apache/servicecomb/core/executor/TestThreadPoolExecutorEx.java b/core/src/test/java/org/apache/servicecomb/core/executor/TestThreadPoolExecutorEx.java
index ddcf48d..7382d37 100644
--- a/core/src/test/java/org/apache/servicecomb/core/executor/TestThreadPoolExecutorEx.java
+++ b/core/src/test/java/org/apache/servicecomb/core/executor/TestThreadPoolExecutorEx.java
@@ -24,8 +24,8 @@
 import java.util.concurrent.TimeUnit;
 import java.util.function.IntSupplier;
 
-import org.junit.Test;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;