[SCB-2475] migrate foundation-common module to junit5 (part 1) (#3076)

diff --git a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/event/TestEventBus.java b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/event/TestEventBus.java
index c83444a..8f7829c 100644
--- a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/event/TestEventBus.java
+++ b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/event/TestEventBus.java
@@ -21,11 +21,11 @@
 
 import org.hamcrest.MatcherAssert;
 import org.hamcrest.Matchers;
-import org.junit.Test;
 
 import com.google.common.eventbus.AllowConcurrentEvents;
 import com.google.common.eventbus.EventBus;
 import com.google.common.eventbus.Subscribe;
+import org.junit.jupiter.api.Test;
 
 public class TestEventBus {
   private final EventBus eventBus = new SimpleEventBus();
diff --git a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/part/TestFilePart.java b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/part/TestFilePart.java
index a2b6cf4..b129bc2 100644
--- a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/part/TestFilePart.java
+++ b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/part/TestFilePart.java
@@ -24,10 +24,10 @@
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
-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 TestFilePart {
   static File file = new File("testFilePart.txt");
@@ -38,13 +38,13 @@
 
   FilePart part = new FilePart(name, file.getAbsolutePath());
 
-  @BeforeClass
+  @BeforeAll
   public static void setup() throws IOException {
     file.delete();
     FileUtils.write(file, content, StandardCharsets.UTF_8);
   }
 
-  @AfterClass
+  @AfterAll
   public static void teardown() {
     file.delete();
   }
diff --git a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/spring/TestPaasNamespaceHandler.java b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/spring/TestPaasNamespaceHandler.java
index a223245..41d5c03 100644
--- a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/spring/TestPaasNamespaceHandler.java
+++ b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/spring/TestPaasNamespaceHandler.java
@@ -17,21 +17,21 @@
 
 package org.apache.servicecomb.foundation.common.spring;
 
-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;
 
 public class TestPaasNamespaceHandler {
 
   PaasNamespaceHandler paasNamespaceHandler = null;
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     paasNamespaceHandler = new PaasNamespaceHandler();
   }
 
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     paasNamespaceHandler = null;
   }
diff --git a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/Log4jUtilsTest.java b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/Log4jUtilsTest.java
index 3fd0c5b..ee60e84 100644
--- a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/Log4jUtilsTest.java
+++ b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/Log4jUtilsTest.java
@@ -24,9 +24,9 @@
 import org.apache.log4j.PropertyConfigurator;
 import org.apache.servicecomb.foundation.common.Holder;
 import org.apache.servicecomb.foundation.common.config.impl.PropertiesLoader;
-import org.junit.Before;
-import org.junit.Test;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.springframework.core.io.Resource;
 
 import mockit.Deencapsulation;
@@ -35,7 +35,7 @@
 
 public class Log4jUtilsTest {
 
-  @Before
+  @BeforeEach
   public void before() {
     Deencapsulation.setField(Log4jUtils.class, "inited", false);
   }
diff --git a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestBeanUtils.java b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestBeanUtils.java
index 55f3d3b..9c06dc0 100644
--- a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestBeanUtils.java
+++ b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestBeanUtils.java
@@ -19,10 +19,10 @@
 import java.math.BigDecimal;
 
 import org.aspectj.lang.annotation.Aspect;
-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.springframework.aop.SpringProxy;
 import org.springframework.aop.aspectj.annotation.AspectJProxyFactory;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -53,12 +53,12 @@
   static class MyAspect {
   }
 
-  @BeforeClass
+  @BeforeAll
   public static void setup() {
     System.clearProperty(BeanUtils.SCB_SCAN_PACKAGE);
   }
 
-  @AfterClass
+  @AfterAll
   public static void tearDown() {
     System.clearProperty(BeanUtils.SCB_SCAN_PACKAGE);
   }
diff --git a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestRollingFileAppenderExt.java b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestRollingFileAppenderExt.java
index 7c70752..8fb776c 100644
--- a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestRollingFileAppenderExt.java
+++ b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestRollingFileAppenderExt.java
@@ -21,22 +21,17 @@
 
 import org.apache.log4j.Layout;
 import org.apache.log4j.spi.LoggingEvent;
-import org.junit.Test;
 
-import mockit.Expectations;
-import mockit.Injectable;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
 
 public class TestRollingFileAppenderExt {
   @Test
-  public void testRollingFileAppenderExt(@Injectable LoggingEvent event,
-      @Injectable Layout layout) throws Exception {
-    new Expectations() {
-      {
-        layout.format(event);
-        result = "test";
-      }
-    };
+  public void testRollingFileAppenderExt() throws Exception {
+    Layout layout = Mockito.mock(Layout.class);
+    LoggingEvent event = Mockito.mock(LoggingEvent.class);
+    Mockito.when(layout.format(event)).thenReturn("test");
     File cur = new File(System.getProperty("user.dir"));
     File temp = new File(cur, "temptestfile.log");
     if (temp.exists()) {