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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3768bc6f0c HDDS-6752. Migrate tests with rules in hdds-server-scm to 
JUnit5 (#3442)
3768bc6f0c is described below

commit 3768bc6f0c3fc56423dd86815027fc583d0c6260
Author: Kaijie Chen <[email protected]>
AuthorDate: Fri Jun 17 03:29:36 2022 +0800

    HDDS-6752. Migrate tests with rules in hdds-server-scm to JUnit5 (#3442)
---
 .../apache/hadoop/hdds/scm/TestHddsServerUtil.java |  73 ++++-----
 .../hadoop/hdds/scm/TestHddsServerUtils.java       |  22 +--
 .../hadoop/hdds/scm/block/TestBlockManager.java    | 131 ++++++++-------
 .../container/balancer/TestContainerBalancer.java  |  93 ++++++-----
 .../TestContainerReplicaPendingOps.java            |  90 +++++-----
 .../container/states/TestContainerAttribute.java   |  47 +++---
 .../hdds/scm/crl/TestCRLStatusReportHandler.java   |  40 ++---
 .../hdds/scm/node/TestContainerPlacement.java      |  21 +--
 .../hadoop/hdds/scm/node/TestSCMNodeManager.java   | 181 +++++++++------------
 .../hdds/scm/node/TestSCMNodeStorageStatMap.java   |  98 +++++------
 .../scm/node/states/TestNode2ContainerMap.java     |  96 ++++++-----
 .../scm/pipeline/TestPipelinePlacementPolicy.java  | 162 ++++++++----------
 .../TestOneReplicaPipelineSafeModeRule.java        |  20 +--
 .../hdds/scm/safemode/TestSCMSafeModeManager.java  | 142 +++++++---------
 .../hadoop/hdds/scm/server/TestSCMCertStore.java   |  49 ++----
 .../scm/server/TestSCMSecurityProtocolServer.java  |  17 +-
 .../hdds/scm/update/server/MockCRLStore.java       |   6 +-
 .../server/TestSCMUpdateServiceGrpcServer.java     |  80 ++++-----
 .../scm/upgrade/TestScmStartupSlvLessThanMlv.java  |  33 ++--
 19 files changed, 635 insertions(+), 766 deletions(-)

diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestHddsServerUtil.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestHddsServerUtil.java
index 0c9222d061..68d6903185 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestHddsServerUtil.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestHddsServerUtil.java
@@ -25,26 +25,18 @@ import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.scm.ha.SCMNodeInfo;
 import org.apache.hadoop.hdds.utils.HddsServerUtil;
 
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import org.apache.hadoop.net.NetUtils;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.Timeout;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 
 /**
  * Test the HDDS server side utilities.
  */
+@Timeout(300)
 public class TestHddsServerUtil {
 
-  @Rule
-  public Timeout timeout = Timeout.seconds(300);
-
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
-
   /**
    * Verify that the datanode endpoint is parsed correctly.
    * This tests the logic used by the DataNodes to determine which address
@@ -59,18 +51,16 @@ public class TestHddsServerUtil {
     conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY, "1.2.3.4");
     InetSocketAddress addr = NetUtils.createSocketAddr(
         SCMNodeInfo.buildNodeInfo(conf).get(0).getScmDatanodeAddress());
-    assertThat(addr.getHostString(), is("1.2.3.4"));
-    assertThat(addr.getPort(), is(
-        ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT));
+    assertEquals("1.2.3.4", addr.getHostString());
+    assertEquals(ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT, 
addr.getPort());
 
     // Next try a client address with just a host name and port.
     // Verify the port is ignored and the default DataNode port is used.
     conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY, "1.2.3.4:100");
     addr = NetUtils.createSocketAddr(
         SCMNodeInfo.buildNodeInfo(conf).get(0).getScmDatanodeAddress());
-    assertThat(addr.getHostString(), is("1.2.3.4"));
-    assertThat(addr.getPort(),
-        is(ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT));
+    assertEquals("1.2.3.4", addr.getHostString());
+    assertEquals(ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT, 
addr.getPort());
 
     // Set both OZONE_SCM_CLIENT_ADDRESS_KEY and
     // OZONE_SCM_DATANODE_ADDRESS_KEY.
@@ -80,9 +70,8 @@ public class TestHddsServerUtil {
     conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_ADDRESS_KEY, "5.6.7.8");
     addr = NetUtils.createSocketAddr(
             SCMNodeInfo.buildNodeInfo(conf).get(0).getScmDatanodeAddress());
-    assertThat(addr.getHostString(), is("5.6.7.8"));
-    assertThat(addr.getPort(), is(
-        ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT));
+    assertEquals("5.6.7.8", addr.getHostString());
+    assertEquals(ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT, 
addr.getPort());
 
     // Set both OZONE_SCM_CLIENT_ADDRESS_KEY and
     // OZONE_SCM_DATANODE_ADDRESS_KEY.
@@ -92,11 +81,10 @@ public class TestHddsServerUtil {
     conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_ADDRESS_KEY, "5.6.7.8:200");
     addr = NetUtils.createSocketAddr(
         SCMNodeInfo.buildNodeInfo(conf).get(0).getScmDatanodeAddress());
-    assertThat(addr.getHostString(), is("5.6.7.8"));
-    assertThat(addr.getPort(), is(200));
+    assertEquals("5.6.7.8", addr.getHostString());
+    assertEquals(200, addr.getPort());
   }
 
-
   /**
    * Verify that the client endpoint bind address is computed correctly.
    * This tests the logic used by the SCM to determine its own bind address.
@@ -109,8 +97,8 @@ public class TestHddsServerUtil {
     // is set differently.
     conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY, "1.2.3.4");
     InetSocketAddress addr = HddsServerUtil.getScmClientBindAddress(conf);
-    assertThat(addr.getHostString(), is("0.0.0.0"));
-    assertThat(addr.getPort(), 
is(ScmConfigKeys.OZONE_SCM_CLIENT_PORT_DEFAULT));
+    assertEquals("0.0.0.0", addr.getHostString());
+    assertEquals(ScmConfigKeys.OZONE_SCM_CLIENT_PORT_DEFAULT, addr.getPort());
 
     // The bind host should be 0.0.0.0 unless OZONE_SCM_CLIENT_BIND_HOST_KEY
     // is set differently. The port number from OZONE_SCM_CLIENT_ADDRESS_KEY
@@ -118,8 +106,8 @@ public class TestHddsServerUtil {
     conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY, "1.2.3.4:100");
     conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_ADDRESS_KEY, "1.2.3.4:200");
     addr = HddsServerUtil.getScmClientBindAddress(conf);
-    assertThat(addr.getHostString(), is("0.0.0.0"));
-    assertThat(addr.getPort(), is(100));
+    assertEquals("0.0.0.0", addr.getHostString());
+    assertEquals(100, addr.getPort());
 
     // OZONE_SCM_CLIENT_BIND_HOST_KEY should be respected.
     // Port number should be default if none is specified via
@@ -128,9 +116,8 @@ public class TestHddsServerUtil {
     conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_ADDRESS_KEY, "1.2.3.4");
     conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_BIND_HOST_KEY, "5.6.7.8");
     addr = HddsServerUtil.getScmClientBindAddress(conf);
-    assertThat(addr.getHostString(), is("5.6.7.8"));
-    assertThat(addr.getPort(), is(
-        ScmConfigKeys.OZONE_SCM_CLIENT_PORT_DEFAULT));
+    assertEquals("5.6.7.8", addr.getHostString());
+    assertEquals(ScmConfigKeys.OZONE_SCM_CLIENT_PORT_DEFAULT, addr.getPort());
 
     // OZONE_SCM_CLIENT_BIND_HOST_KEY should be respected.
     // Port number from OZONE_SCM_CLIENT_ADDRESS_KEY should be
@@ -139,8 +126,8 @@ public class TestHddsServerUtil {
     conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_ADDRESS_KEY, "1.2.3.4:200");
     conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_BIND_HOST_KEY, "5.6.7.8");
     addr = HddsServerUtil.getScmClientBindAddress(conf);
-    assertThat(addr.getHostString(), is("5.6.7.8"));
-    assertThat(addr.getPort(), is(100));
+    assertEquals("5.6.7.8", addr.getHostString());
+    assertEquals(100, addr.getPort());
   }
 
   /**
@@ -155,9 +142,8 @@ public class TestHddsServerUtil {
     // is set differently.
     conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY, "1.2.3.4");
     InetSocketAddress addr = HddsServerUtil.getScmDataNodeBindAddress(conf);
-    assertThat(addr.getHostString(), is("0.0.0.0"));
-    assertThat(addr.getPort(), is(
-        ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT));
+    assertEquals("0.0.0.0", addr.getHostString());
+    assertEquals(ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT, 
addr.getPort());
 
     // The bind host should be 0.0.0.0 unless OZONE_SCM_DATANODE_BIND_HOST_KEY
     // is set differently. The port number from OZONE_SCM_DATANODE_ADDRESS_KEY
@@ -165,8 +151,8 @@ public class TestHddsServerUtil {
     conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY, "1.2.3.4:100");
     conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_ADDRESS_KEY, "1.2.3.4:200");
     addr = HddsServerUtil.getScmDataNodeBindAddress(conf);
-    assertThat(addr.getHostString(), is("0.0.0.0"));
-    assertThat(addr.getPort(), is(200));
+    assertEquals("0.0.0.0", addr.getHostString());
+    assertEquals(200, addr.getPort());
 
     // OZONE_SCM_DATANODE_BIND_HOST_KEY should be respected.
     // Port number should be default if none is specified via
@@ -175,9 +161,8 @@ public class TestHddsServerUtil {
     conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_ADDRESS_KEY, "1.2.3.4");
     conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_BIND_HOST_KEY, "5.6.7.8");
     addr = HddsServerUtil.getScmDataNodeBindAddress(conf);
-    assertThat(addr.getHostString(), is("5.6.7.8"));
-    assertThat(addr.getPort(), is(
-        ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT));
+    assertEquals("5.6.7.8", addr.getHostString());
+    assertEquals(ScmConfigKeys.OZONE_SCM_DATANODE_PORT_DEFAULT, 
addr.getPort());
 
     // OZONE_SCM_DATANODE_BIND_HOST_KEY should be respected.
     // Port number from OZONE_SCM_DATANODE_ADDRESS_KEY should be
@@ -186,10 +171,8 @@ public class TestHddsServerUtil {
     conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_ADDRESS_KEY, "1.2.3.4:200");
     conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_BIND_HOST_KEY, "5.6.7.8");
     addr = HddsServerUtil.getScmDataNodeBindAddress(conf);
-    assertThat(addr.getHostString(), is("5.6.7.8"));
-    assertThat(addr.getPort(), is(200));
+    assertEquals("5.6.7.8", addr.getHostString());
+    assertEquals(200, addr.getPort());
   }
 
-
-
 }
\ No newline at end of file
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestHddsServerUtils.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestHddsServerUtils.java
index face383c7a..6da9e4be97 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestHddsServerUtils.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/TestHddsServerUtils.java
@@ -39,28 +39,22 @@ import static 
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_NAMES;
 import static 
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_STALENODE_INTERVAL;
 import static 
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_DATANODE_ID_DIR;
 import static 
org.apache.hadoop.ozone.OzoneConsts.OZONE_SCM_DATANODE_ID_FILE_DEFAULT;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.Timeout;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * Unit tests for {@link HddsServerUtil}.
  */
+@Timeout(300)
 public class TestHddsServerUtils {
   public static final Logger LOG = LoggerFactory.getLogger(
       TestHddsServerUtils.class);
 
-  @Rule
-  public Timeout timeout = Timeout.seconds(300);
-
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
-
   /**
    * Test getting OZONE_SCM_DATANODE_ADDRESS_KEY with port.
    */
@@ -199,8 +193,8 @@ public class TestHddsServerUtils {
 
   @Test
   public void testNoScmDbDirConfigured() {
-    thrown.expect(IllegalArgumentException.class);
-    ServerUtils.getScmDbDir(new OzoneConfiguration());
+    assertThrows(IllegalArgumentException.class,
+        () -> ServerUtils.getScmDbDir(new OzoneConfiguration()));
   }
 
   @Test
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/block/TestBlockManager.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/block/TestBlockManager.java
index 3771fab273..5991663701 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/block/TestBlockManager.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/block/TestBlockManager.java
@@ -19,6 +19,7 @@ package org.apache.hadoop.hdds.scm.block;
 
 import java.io.IOException;
 import java.time.ZoneId;
+import java.nio.file.Path;
 import java.time.ZoneOffset;
 import java.util.List;
 import java.util.Map;
@@ -78,13 +79,12 @@ import org.apache.ozone.test.GenericTestUtils;
 import static org.apache.hadoop.ozone.OzoneConsts.GB;
 import static org.apache.hadoop.ozone.OzoneConsts.MB;
 
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.TemporaryFolder;
+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.junit.jupiter.api.Timeout;
+import org.junit.jupiter.api.io.TempDir;
 
 /**
  * Tests for SCM Block Manager.
@@ -103,24 +103,18 @@ public class TestBlockManager {
   private SCMServiceManager serviceManager;
   private int numContainerPerOwnerInPipeline;
   private OzoneConfiguration conf;
-
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
-
-  @Rule
-  public TemporaryFolder folder = new TemporaryFolder();
   private SCMMetadataStore scmMetadataStore;
   private ReplicationConfig replicationConfig;
 
-  @Before
-  public void setUp() throws Exception {
+  @BeforeEach
+  public void setUp(@TempDir Path tempDir) throws Exception {
     conf = SCMTestUtils.getConf();
     numContainerPerOwnerInPipeline = conf.getInt(
         ScmConfigKeys.OZONE_SCM_PIPELINE_OWNER_CONTAINER_COUNT,
         ScmConfigKeys.OZONE_SCM_PIPELINE_OWNER_CONTAINER_COUNT_DEFAULT);
 
 
-    conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, 
folder.newFolder().toString());
+    conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, tempDir.toString());
     conf.setBoolean(HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION, false);
     conf.setTimeDuration(HddsConfigKeys.HDDS_PIPELINE_REPORT_INTERVAL, 5,
         TimeUnit.SECONDS);
@@ -196,7 +190,7 @@ public class TestBlockManager {
     scm.getScmContext().updateSafeModeStatus(new SafeModeStatus(false, true));
   }
 
-  @After
+  @AfterEach
   public void cleanup() throws Exception {
     scm.stop();
     scm.join();
@@ -210,7 +204,7 @@ public class TestBlockManager {
     HddsTestUtils.openAllRatisPipelines(pipelineManager);
     AllocatedBlock block = blockManager.allocateBlock(DEFAULT_BLOCK_SIZE,
         replicationConfig, OzoneConsts.OZONE, new ExcludeList());
-    Assert.assertNotNull(block);
+    Assertions.assertNotNull(block);
   }
 
   @Test
@@ -229,9 +223,9 @@ public class TestBlockManager {
     AllocatedBlock block = blockManager
         .allocateBlock(DEFAULT_BLOCK_SIZE, replicationConfig, 
OzoneConsts.OZONE,
             excludeList);
-    Assert.assertNotNull(block);
+    Assertions.assertNotNull(block);
     for (PipelineID id : excludeList.getPipelineIds()) {
-      Assert.assertNotEquals(block.getPipeline().getId(), id);
+      Assertions.assertNotEquals(block.getPipeline().getId(), id);
     }
 
     for (Pipeline pipeline : pipelineManager.getPipelines(replicationConfig)) {
@@ -240,13 +234,13 @@ public class TestBlockManager {
     block = blockManager
         .allocateBlock(DEFAULT_BLOCK_SIZE, replicationConfig, 
OzoneConsts.OZONE,
             excludeList);
-    Assert.assertNotNull(block);
-    Assert.assertTrue(
+    Assertions.assertNotNull(block);
+    Assertions.assertTrue(
         excludeList.getPipelineIds().contains(block.getPipeline().getId()));
   }
 
   @Test
-  public void testAllocateBlockInParallel() throws Exception {
+  public void testAllocateBlockInParallel() {
     int threadCount = 20;
     List<ExecutorService> executors = new ArrayList<>(threadCount);
     for (int i = 0; i < threadCount; i++) {
@@ -275,7 +269,7 @@ public class TestBlockManager {
           .allOf(futureList.toArray(new CompletableFuture[futureList.size()]))
           .get();
     } catch (Exception e) {
-      Assert.fail("testAllocateBlockInParallel failed");
+      Assertions.fail("testAllocateBlockInParallel failed");
     }
   }
 
@@ -321,21 +315,20 @@ public class TestBlockManager {
       futureList.add(future);
     }
     try {
-      CompletableFuture
-              .allOf(futureList.toArray(
-                      new CompletableFuture[futureList.size()])).get();
+      CompletableFuture.allOf(futureList.toArray(
+          new CompletableFuture[0])).get();
 
-      Assert.assertTrue(
-          pipelineManager.getPipelines(replicationConfig).size() == 1);
-      Assert.assertTrue(
-              allocatedBlockMap.size() == numContainerPerOwnerInPipeline);
-      Assert.assertTrue(allocatedBlockMap.
-              values().size() == numContainerPerOwnerInPipeline);
-      allocatedBlockMap.values().stream().forEach(v -> {
-        Assert.assertTrue(v.size() == numContainerPerOwnerInPipeline);
+      Assertions.assertEquals(1,
+          pipelineManager.getPipelines(replicationConfig).size());
+      Assertions.assertEquals(numContainerPerOwnerInPipeline,
+          allocatedBlockMap.size());
+      Assertions.assertEquals(numContainerPerOwnerInPipeline,
+          allocatedBlockMap.values().size());
+      allocatedBlockMap.values().forEach(v -> {
+        Assertions.assertEquals(numContainerPerOwnerInPipeline, v.size());
       });
     } catch (Exception e) {
-      Assert.fail("testAllocateBlockInParallel failed");
+      Assertions.fail("testAllocateBlockInParallel failed");
     }
   }
 
@@ -386,24 +379,24 @@ public class TestBlockManager {
       CompletableFuture
               .allOf(futureList.toArray(
                       new CompletableFuture[futureList.size()])).get();
-      Assert.assertEquals(1,
+      Assertions.assertEquals(1,
           pipelineManager.getPipelines(replicationConfig).size());
       Pipeline pipeline =
           pipelineManager.getPipelines(replicationConfig).get(0);
       // total no of containers to be created will be number of healthy
       // volumes * number of numContainerPerOwnerInPipeline which is equal to
       // the thread count
-      Assert.assertEquals(threadCount, pipelineManager.
+      Assertions.assertEquals(threadCount, pipelineManager.
               getNumberOfContainers(pipeline.getId()));
-      Assert.assertEquals(threadCount,
+      Assertions.assertEquals(threadCount,
               allocatedBlockMap.size());
-      Assert.assertEquals(threadCount, allocatedBlockMap.
+      Assertions.assertEquals(threadCount, allocatedBlockMap.
               values().size());
-      allocatedBlockMap.values().stream().forEach(v -> {
-        Assert.assertEquals(1, v.size());
+      allocatedBlockMap.values().forEach(v -> {
+        Assertions.assertEquals(1, v.size());
       });
     } catch (Exception e) {
-      Assert.fail("testAllocateBlockInParallel failed");
+      Assertions.fail("testAllocateBlockInParallel failed");
     }
   }
 
@@ -454,53 +447,55 @@ public class TestBlockManager {
       CompletableFuture
           .allOf(futureList.toArray(
               new CompletableFuture[futureList.size()])).get();
-      Assert.assertTrue(
-          pipelineManager.getPipelines(replicationConfig).size() == 1);
+      Assertions.assertEquals(1,
+          pipelineManager.getPipelines(replicationConfig).size());
       Pipeline pipeline =
           pipelineManager.getPipelines(replicationConfig).get(0);
       // the pipeline per raft log disk config is set to 1 by default
       int numContainers = (int)Math.ceil((double)
               (numContainerPerOwnerInPipeline *
                   numContainerPerOwnerInPipeline) / numMetaDataVolumes);
-      Assert.assertTrue(numContainers == pipelineManager.
+      Assertions.assertEquals(numContainers, pipelineManager.
           getNumberOfContainers(pipeline.getId()));
-      Assert.assertTrue(
-          allocatedBlockMap.size() == numContainers);
-      Assert.assertTrue(allocatedBlockMap.
-          values().size() == numContainers);
+      Assertions.assertEquals(numContainers, allocatedBlockMap.size());
+      Assertions.assertEquals(numContainers, 
allocatedBlockMap.values().size());
     } catch (Exception e) {
-      Assert.fail("testAllocateBlockInParallel failed");
+      Assertions.fail("testAllocateBlockInParallel failed");
     }
   }
 
   @Test
-  public void testAllocateOversizedBlock() throws Exception {
+  public void testAllocateOversizedBlock() {
     long size = 6 * GB;
-    thrown.expectMessage("Unsupported block size");
-    blockManager.allocateBlock(size,
-        replicationConfig, OzoneConsts.OZONE, new ExcludeList());
+    Throwable t = Assertions.assertThrows(IOException.class, () ->
+        blockManager.allocateBlock(size,
+            replicationConfig, OzoneConsts.OZONE, new ExcludeList()));
+    Assertions.assertEquals("Unsupported block size: " + size,
+        t.getMessage());
   }
 
 
   @Test
-  public void testAllocateBlockFailureInSafeMode() throws Exception {
+  public void testAllocateBlockFailureInSafeMode() {
     scm.getScmContext().updateSafeModeStatus(
         new SCMSafeModeManager.SafeModeStatus(true, true));
     // Test1: In safe mode expect an SCMException.
-    thrown.expectMessage("SafeModePrecheck failed for "
-        + "allocateBlock");
-    blockManager.allocateBlock(DEFAULT_BLOCK_SIZE,
-        replicationConfig, OzoneConsts.OZONE, new ExcludeList());
+    Throwable t = Assertions.assertThrows(IOException.class, () ->
+        blockManager.allocateBlock(DEFAULT_BLOCK_SIZE,
+            replicationConfig, OzoneConsts.OZONE, new ExcludeList()));
+    Assertions.assertEquals("SafeModePrecheck failed for allocateBlock",
+        t.getMessage());
   }
 
   @Test
   public void testAllocateBlockSucInSafeMode() throws Exception {
     // Test2: Exit safe mode and then try allocateBock again.
-    Assert.assertNotNull(blockManager.allocateBlock(DEFAULT_BLOCK_SIZE,
+    Assertions.assertNotNull(blockManager.allocateBlock(DEFAULT_BLOCK_SIZE,
         replicationConfig, OzoneConsts.OZONE, new ExcludeList()));
   }
 
-  @Test(timeout = 10000)
+  @Test
+  @Timeout(100)
   public void testMultipleBlockAllocation()
       throws IOException, TimeoutException, InterruptedException {
 
@@ -542,7 +537,8 @@ public class TestBlockManager {
     return true;
   }
 
-  @Test(timeout = 10000)
+  @Test
+  @Timeout(100)
   public void testMultipleBlockAllocationWithClosedContainer()
       throws IOException, TimeoutException, InterruptedException {
     nodeManager.setNumPipelinePerDatanode(1);
@@ -596,15 +592,16 @@ public class TestBlockManager {
     }, 10, 1000);
   }
 
-  @Test(timeout = 10000)
+  @Test
+  @Timeout(100)
   public void testBlockAllocationWithNoAvailablePipelines()
-      throws IOException, TimeoutException, InterruptedException {
+      throws IOException {
     for (Pipeline pipeline : pipelineManager.getPipelines()) {
       pipelineManager.closePipeline(pipeline, false);
     }
-    Assert.assertEquals(0,
+    Assertions.assertEquals(0,
         pipelineManager.getPipelines(replicationConfig).size());
-    Assert.assertNotNull(blockManager
+    Assertions.assertNotNull(blockManager
         .allocateBlock(DEFAULT_BLOCK_SIZE, replicationConfig, 
OzoneConsts.OZONE,
             new ExcludeList()));
   }
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/balancer/TestContainerBalancer.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/balancer/TestContainerBalancer.java
index 98c92b2242..fe3209997b 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/balancer/TestContainerBalancer.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/balancer/TestContainerBalancer.java
@@ -50,9 +50,9 @@ import 
org.apache.hadoop.hdds.scm.server.StorageContainerManager;
 import org.apache.hadoop.hdds.server.events.EventPublisher;
 import org.apache.hadoop.ozone.OzoneConsts;
 import org.apache.ozone.test.GenericTestUtils;
-import org.junit.Assert;
-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.mockito.Mockito;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -106,7 +106,7 @@ public class TestContainerBalancer {
   /**
    * Sets up configuration values and creates a mock cluster.
    */
-  @Before
+  @BeforeEach
   public void setup() throws IOException, NodeNotFoundException {
     conf = new OzoneConfiguration();
     scm = Mockito.mock(StorageContainerManager.class);
@@ -195,14 +195,14 @@ public class TestContainerBalancer {
 
   @Test
   public void testCalculationOfUtilization() {
-    Assert.assertEquals(nodesInCluster.size(), nodeUtilizations.size());
+    Assertions.assertEquals(nodesInCluster.size(), nodeUtilizations.size());
     for (int i = 0; i < nodesInCluster.size(); i++) {
-      Assert.assertEquals(nodeUtilizations.get(i),
+      Assertions.assertEquals(nodeUtilizations.get(i),
           nodesInCluster.get(i).calculateUtilization(), 0.0001);
     }
 
     // should be equal to average utilization of the cluster
-    Assert.assertEquals(averageUtilization,
+    Assertions.assertEquals(averageUtilization,
         containerBalancer.calculateAvgUtilization(nodesInCluster), 0.0001);
   }
 
@@ -238,12 +238,13 @@ public class TestContainerBalancer {
           containerBalancer.getUnBalancedNodes();
 
       stopBalancer();
-      Assert.assertEquals(
+      Assertions.assertEquals(
           expectedUnBalancedNodes.size(),
           unBalancedNodesAccordingToBalancer.size());
 
       for (int j = 0; j < expectedUnBalancedNodes.size(); j++) {
-        
Assert.assertEquals(expectedUnBalancedNodes.get(j).getDatanodeDetails(),
+        Assertions.assertEquals(
+            expectedUnBalancedNodes.get(j).getDatanodeDetails(),
             unBalancedNodesAccordingToBalancer.get(j).getDatanodeDetails());
       }
     }
@@ -264,8 +265,8 @@ public class TestContainerBalancer {
 
     stopBalancer();
     ContainerBalancerMetrics metrics = containerBalancer.getMetrics();
-    Assert.assertEquals(0, containerBalancer.getUnBalancedNodes().size());
-    Assert.assertEquals(0, metrics.getNumDatanodesUnbalanced());
+    Assertions.assertEquals(0, containerBalancer.getUnBalancedNodes().size());
+    Assertions.assertEquals(0, metrics.getNumDatanodesUnbalanced());
   }
 
   /**
@@ -288,10 +289,11 @@ public class TestContainerBalancer {
 
     int number = percent * numberOfNodes / 100;
     ContainerBalancerMetrics metrics = containerBalancer.getMetrics();
-    Assert.assertFalse(
+    Assertions.assertFalse(
         containerBalancer.getCountDatanodesInvolvedPerIteration() > number);
-    Assert.assertTrue(metrics.getNumDatanodesInvolvedInLatestIteration() > 0);
-    Assert.assertFalse(
+    Assertions.assertTrue(
+        metrics.getNumDatanodesInvolvedInLatestIteration() > 0);
+    Assertions.assertFalse(
         metrics.getNumDatanodesInvolvedInLatestIteration() > number);
     stopBalancer();
   }
@@ -310,14 +312,14 @@ public class TestContainerBalancer {
     stopBalancer();
 
     // balancer should have identified unbalanced nodes
-    Assert.assertFalse(containerBalancer.getUnBalancedNodes().isEmpty());
+    Assertions.assertFalse(containerBalancer.getUnBalancedNodes().isEmpty());
     // no container should have been selected
-    Assert.assertTrue(containerBalancer.getSourceToTargetMap().isEmpty());
+    Assertions.assertTrue(containerBalancer.getSourceToTargetMap().isEmpty());
     /*
     Iteration result should be CAN_NOT_BALANCE_ANY_MORE because no container
     move is generated
      */
-    Assert.assertEquals(
+    Assertions.assertEquals(
         ContainerBalancer.IterationResult.CAN_NOT_BALANCE_ANY_MORE,
         containerBalancer.getIterationResult());
 
@@ -332,7 +334,7 @@ public class TestContainerBalancer {
     // check whether all selected containers are closed
     for (ContainerMoveSelection moveSelection:
          containerBalancer.getSourceToTargetMap().values()) {
-      Assert.assertSame(
+      Assertions.assertSame(
           cidToInfoMap.get(moveSelection.getContainerID()).getState(),
           HddsProtos.LifeCycleState.CLOSED);
     }
@@ -350,13 +352,13 @@ public class TestContainerBalancer {
     sleepWhileBalancing(500);
 
     // balancer should not have moved more size than the limit
-    Assert.assertFalse(containerBalancer.getSizeMovedPerIteration() >
+    Assertions.assertFalse(containerBalancer.getSizeMovedPerIteration() >
         10 * OzoneConsts.GB);
 
     long size = containerBalancer.getMetrics()
         .getDataSizeMovedGBInLatestIteration();
-    Assert.assertTrue(size > 0);
-    Assert.assertFalse(size > 10);
+    Assertions.assertTrue(size > 0);
+    Assertions.assertFalse(size > 10);
     stopBalancer();
   }
 
@@ -382,7 +384,7 @@ public class TestContainerBalancer {
     for (ContainerMoveSelection moveSelection : sourceToTargetMap.values()) {
       ContainerID container = moveSelection.getContainerID();
       DatanodeDetails target = moveSelection.getTargetNode();
-      Assert.assertTrue(cidToReplicasMap.get(container)
+      Assertions.assertTrue(cidToReplicasMap.get(container)
           .stream()
           .map(ContainerReplica::getDatanodeDetails)
           .noneMatch(target::equals));
@@ -428,7 +430,7 @@ public class TestContainerBalancer {
       ContainerPlacementStatus placementStatus =
           placementPolicy.validateContainerPlacement(replicas,
               containerInfo.getReplicationConfig().getRequiredNodes());
-      Assert.assertTrue(placementStatus.isPolicySatisfied());
+      Assertions.assertTrue(placementStatus.isPolicySatisfied());
     }
   }
 
@@ -455,9 +457,9 @@ public class TestContainerBalancer {
         containerBalancer.getSourceToTargetMap().values()) {
       DatanodeDetails target = moveSelection.getTargetNode();
       NodeStatus status = mockNodeManager.getNodeStatus(target);
-      Assert.assertSame(HddsProtos.NodeOperationalState.IN_SERVICE,
+      Assertions.assertSame(HddsProtos.NodeOperationalState.IN_SERVICE,
           status.getOperationalState());
-      Assert.assertTrue(status.isHealthy());
+      Assertions.assertTrue(status.isHealthy());
     }
   }
 
@@ -484,7 +486,7 @@ public class TestContainerBalancer {
     for (ContainerMoveSelection moveSelection :
         containerBalancer.getSourceToTargetMap().values()) {
       ContainerID container = moveSelection.getContainerID();
-      Assert.assertFalse(containers.contains(container));
+      Assertions.assertFalse(containers.contains(container));
       containers.add(container);
     }
   }
@@ -514,7 +516,7 @@ public class TestContainerBalancer {
     for (ContainerMoveSelection moveSelection :
         containerBalancer.getSourceToTargetMap().values()) {
       ContainerID container = moveSelection.getContainerID();
-      Assert.assertFalse(excludeContainers.contains(container));
+      Assertions.assertFalse(excludeContainers.contains(container));
     }
   }
 
@@ -534,8 +536,8 @@ public class TestContainerBalancer {
     startBalancer(balancerConfiguration);
     sleepWhileBalancing(500);
 
-    Assert.assertFalse(containerBalancer.getUnBalancedNodes().isEmpty());
-    Assert.assertTrue(containerBalancer.getSourceToTargetMap().isEmpty());
+    Assertions.assertFalse(containerBalancer.getUnBalancedNodes().isEmpty());
+    Assertions.assertTrue(containerBalancer.getSourceToTargetMap().isEmpty());
     stopBalancer();
 
     // some containers should be selected when using default values
@@ -548,8 +550,8 @@ public class TestContainerBalancer {
 
     stopBalancer();
     // balancer should have identified unbalanced nodes
-    Assert.assertFalse(containerBalancer.getUnBalancedNodes().isEmpty());
-    Assert.assertFalse(containerBalancer.getSourceToTargetMap().isEmpty());
+    Assertions.assertFalse(containerBalancer.getUnBalancedNodes().isEmpty());
+    Assertions.assertFalse(containerBalancer.getSourceToTargetMap().isEmpty());
   }
 
   @Test
@@ -570,11 +572,11 @@ public class TestContainerBalancer {
     stopBalancer();
 
     ContainerBalancerMetrics metrics = containerBalancer.getMetrics();
-    Assert.assertEquals(determineExpectedUnBalancedNodes(
+    Assertions.assertEquals(determineExpectedUnBalancedNodes(
             balancerConfiguration.getThreshold()).size(),
         metrics.getNumDatanodesUnbalanced());
-    Assert.assertTrue(metrics.getDataSizeMovedGBInLatestIteration() <= 6);
-    Assert.assertEquals(1, metrics.getNumIterations());
+    Assertions.assertTrue(metrics.getDataSizeMovedGBInLatestIteration() <= 6);
+    Assertions.assertEquals(1, metrics.getNumIterations());
   }
 
   /**
@@ -634,8 +636,8 @@ public class TestContainerBalancer {
         containerBalancer.getSourceToTargetMap().entrySet()) {
       DatanodeDetails source = entry.getKey();
       DatanodeDetails target = entry.getValue().getTargetNode();
-      Assert.assertTrue(source.equals(dn1) || source.equals(dn2));
-      Assert.assertTrue(target.equals(dn1) || target.equals(dn2));
+      Assertions.assertTrue(source.equals(dn1) || source.equals(dn2));
+      Assertions.assertTrue(target.equals(dn1) || target.equals(dn2));
     }
   }
 
@@ -648,12 +650,12 @@ public class TestContainerBalancer {
 
     ContainerBalancerConfiguration cbConf =
         ozoneConfiguration.getObject(ContainerBalancerConfiguration.class);
-    Assert.assertEquals(1, cbConf.getThreshold(), 0.001);
+    Assertions.assertEquals(1, cbConf.getThreshold(), 0.001);
 
-    Assert.assertEquals(26 * 1024 * 1024 * 1024L,
+    Assertions.assertEquals(26 * 1024 * 1024 * 1024L,
         cbConf.getMaxSizeLeavingSource());
 
-    Assert.assertEquals(30 * 60 * 1000,
+    Assertions.assertEquals(30 * 60 * 1000,
         cbConf.getMoveTimeout().toMillis());
   }
 
@@ -675,7 +677,8 @@ public class TestContainerBalancer {
     According to the setup and configurations, this iteration's result should
     be ITERATION_COMPLETED.
      */
-    Assert.assertEquals(ContainerBalancer.IterationResult.ITERATION_COMPLETED,
+    Assertions.assertEquals(
+        ContainerBalancer.IterationResult.ITERATION_COMPLETED,
         containerBalancer.getIterationResult());
     stopBalancer();
 
@@ -693,7 +696,8 @@ public class TestContainerBalancer {
     startBalancer(balancerConfiguration);
     sleepWhileBalancing(1000);
 
-    Assert.assertEquals(ContainerBalancer.IterationResult.ITERATION_COMPLETED,
+    Assertions.assertEquals(
+        ContainerBalancer.IterationResult.ITERATION_COMPLETED,
         containerBalancer.getIterationResult());
     stopBalancer();
   }
@@ -723,12 +727,13 @@ public class TestContainerBalancer {
     According to the setup and configurations, this iteration's result should
     be ITERATION_COMPLETED.
      */
-    Assert.assertEquals(ContainerBalancer.IterationResult.ITERATION_COMPLETED,
+    Assertions.assertEquals(
+        ContainerBalancer.IterationResult.ITERATION_COMPLETED,
         containerBalancer.getIterationResult());
-    Assert.assertEquals(1,
+    Assertions.assertEquals(1,
         containerBalancer.getMetrics()
             .getNumContainerMovesCompletedInLatestIteration());
-    Assert.assertTrue(containerBalancer.getMetrics()
+    Assertions.assertTrue(containerBalancer.getMetrics()
             .getNumContainerMovesTimeoutInLatestIteration() > 1);
     stopBalancer();
 
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/TestContainerReplicaPendingOps.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/TestContainerReplicaPendingOps.java
index 98f20f38fb..320246ecf2 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/TestContainerReplicaPendingOps.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/TestContainerReplicaPendingOps.java
@@ -23,9 +23,9 @@ import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.MockDatanodeDetails;
 import org.apache.hadoop.hdds.scm.container.ContainerID;
 import org.apache.ozone.test.TestClock;
-import org.junit.Assert;
-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 java.time.Instant;
 import java.time.ZoneOffset;
@@ -47,7 +47,7 @@ public class TestContainerReplicaPendingOps {
   private DatanodeDetails dn2;
   private DatanodeDetails dn3;
 
-  @Before
+  @BeforeEach
   public void setup() {
     config = new OzoneConfiguration();
     clock = new TestClock(Instant.now(), ZoneOffset.UTC);
@@ -61,7 +61,7 @@ public class TestContainerReplicaPendingOps {
   public void testGetPendingOpsReturnsEmptyList() {
     List<ContainerReplicaOp> ops =
         pendingOps.getPendingOps(new ContainerID(1));
-    Assert.assertEquals(0, ops.size());
+    Assertions.assertEquals(0, ops.size());
   }
 
   @Test
@@ -73,22 +73,22 @@ public class TestContainerReplicaPendingOps {
 
     List<ContainerReplicaOp> ops =
         pendingOps.getPendingOps(new ContainerID(1));
-    Assert.assertEquals(3, ops.size());
+    Assertions.assertEquals(3, ops.size());
     for (ContainerReplicaOp op : ops) {
-      Assert.assertEquals(0, op.getReplicaIndex());
-      Assert.assertEquals(ADD, op.getOpType());
+      Assertions.assertEquals(0, op.getReplicaIndex());
+      Assertions.assertEquals(ADD, op.getOpType());
     }
     List<DatanodeDetails> allDns = ops.stream()
         .map(s -> s.getTarget()).collect(Collectors.toList());
-    Assert.assertTrue(allDns.contains(dn1));
-    Assert.assertTrue(allDns.contains(dn2));
-    Assert.assertTrue(allDns.contains(dn3));
+    Assertions.assertTrue(allDns.contains(dn1));
+    Assertions.assertTrue(allDns.contains(dn2));
+    Assertions.assertTrue(allDns.contains(dn3));
 
     ops = pendingOps.getPendingOps(new ContainerID(2));
-    Assert.assertEquals(1, ops.size());
-    Assert.assertEquals(1, ops.get(0).getReplicaIndex());
-    Assert.assertEquals(ADD, ops.get(0).getOpType());
-    Assert.assertEquals(dn1, ops.get(0).getTarget());
+    Assertions.assertEquals(1, ops.size());
+    Assertions.assertEquals(1, ops.get(0).getReplicaIndex());
+    Assertions.assertEquals(ADD, ops.get(0).getOpType());
+    Assertions.assertEquals(dn1, ops.get(0).getTarget());
   }
 
   @Test
@@ -100,22 +100,22 @@ public class TestContainerReplicaPendingOps {
 
     List<ContainerReplicaOp> ops =
         pendingOps.getPendingOps(new ContainerID(1));
-    Assert.assertEquals(3, ops.size());
+    Assertions.assertEquals(3, ops.size());
     for (ContainerReplicaOp op : ops) {
-      Assert.assertEquals(0, op.getReplicaIndex());
-      Assert.assertEquals(DELETE, op.getOpType());
+      Assertions.assertEquals(0, op.getReplicaIndex());
+      Assertions.assertEquals(DELETE, op.getOpType());
     }
     List<DatanodeDetails> allDns = ops.stream()
         .map(s -> s.getTarget()).collect(Collectors.toList());
-    Assert.assertTrue(allDns.contains(dn1));
-    Assert.assertTrue(allDns.contains(dn2));
-    Assert.assertTrue(allDns.contains(dn3));
+    Assertions.assertTrue(allDns.contains(dn1));
+    Assertions.assertTrue(allDns.contains(dn2));
+    Assertions.assertTrue(allDns.contains(dn3));
 
     ops = pendingOps.getPendingOps(new ContainerID(2));
-    Assert.assertEquals(1, ops.size());
-    Assert.assertEquals(1, ops.get(0).getReplicaIndex());
-    Assert.assertEquals(DELETE, ops.get(0).getOpType());
-    Assert.assertEquals(dn1, ops.get(0).getTarget());
+    Assertions.assertEquals(1, ops.size());
+    Assertions.assertEquals(1, ops.get(0).getReplicaIndex());
+    Assertions.assertEquals(DELETE, ops.get(0).getOpType());
+    Assertions.assertEquals(dn1, ops.get(0).getTarget());
   }
 
   @Test
@@ -130,25 +130,25 @@ public class TestContainerReplicaPendingOps {
         pendingOps.getPendingOps(new ContainerID(1));
 
     // We expect 4 entries - 2 add and 2 delete.
-    Assert.assertEquals(4, ops.size());
+    Assertions.assertEquals(4, ops.size());
 
-    Assert.assertTrue(pendingOps
+    Assertions.assertTrue(pendingOps
         .completeAddReplica(new ContainerID(1), dn1, 0));
     ops = pendingOps.getPendingOps(new ContainerID(1));
-    Assert.assertEquals(3, ops.size());
+    Assertions.assertEquals(3, ops.size());
 
     // Complete one that does not exist:
-    Assert.assertFalse(pendingOps
+    Assertions.assertFalse(pendingOps
         .completeAddReplica(new ContainerID(1), dn1, 0));
     ops = pendingOps.getPendingOps(new ContainerID(1));
-    Assert.assertEquals(3, ops.size());
+    Assertions.assertEquals(3, ops.size());
 
     // Complete the remaining ones
     pendingOps.completeDeleteReplica(new ContainerID(1), dn1, 0);
     pendingOps.completeDeleteReplica(new ContainerID(1), dn2, 0);
     pendingOps.completeAddReplica(new ContainerID(1), dn3, 0);
     ops = pendingOps.getPendingOps(new ContainerID(1));
-    Assert.assertEquals(0, ops.size());
+    Assertions.assertEquals(0, ops.size());
   }
 
   @Test
@@ -161,14 +161,14 @@ public class TestContainerReplicaPendingOps {
 
     ContainerID cid = new ContainerID(1);
     List<ContainerReplicaOp> ops = pendingOps.getPendingOps(cid);
-    Assert.assertEquals(4, ops.size());
+    Assertions.assertEquals(4, ops.size());
     for (ContainerReplicaOp op : ops) {
-      Assert.assertTrue(pendingOps.removeOp(cid, op));
+      Assertions.assertTrue(pendingOps.removeOp(cid, op));
     }
     // Attempt to remove one that no longer exists
-    Assert.assertFalse(pendingOps.removeOp(cid, ops.get(0)));
+    Assertions.assertFalse(pendingOps.removeOp(cid, ops.get(0)));
     ops = pendingOps.getPendingOps(cid);
-    Assert.assertEquals(0, ops.size());
+    Assertions.assertEquals(0, ops.size());
   }
 
   @Test
@@ -183,44 +183,44 @@ public class TestContainerReplicaPendingOps {
 
     List<ContainerReplicaOp> ops =
         pendingOps.getPendingOps(new ContainerID(1));
-    Assert.assertEquals(4, ops.size());
+    Assertions.assertEquals(4, ops.size());
     ops = pendingOps.getPendingOps(new ContainerID(2));
-    Assert.assertEquals(1, ops.size());
+    Assertions.assertEquals(1, ops.size());
 
     // Some entries at "start" some at start + 1000 and start + 2000.
     // Clock is currently at +2000.
     pendingOps.removeExpiredEntries(2500);
     // Nothing is remove as nothing is older than the current clock time.
     ops = pendingOps.getPendingOps(new ContainerID(1));
-    Assert.assertEquals(4, ops.size());
+    Assertions.assertEquals(4, ops.size());
 
     clock.fastForward(1000);
     pendingOps.removeExpiredEntries(2500);
     // Nothing is remove as nothing is older than the current clock time.
     ops = pendingOps.getPendingOps(new ContainerID(1));
-    Assert.assertEquals(2, ops.size());
+    Assertions.assertEquals(2, ops.size());
     // We should lose the entries for DN1
     List<DatanodeDetails> dns = ops.stream()
         .map(s -> s.getTarget())
         .collect(Collectors.toList());
-    Assert.assertFalse(dns.contains(dn1));
-    Assert.assertTrue(dns.contains(dn2));
-    Assert.assertTrue(dns.contains(dn3));
+    Assertions.assertFalse(dns.contains(dn1));
+    Assertions.assertTrue(dns.contains(dn2));
+    Assertions.assertTrue(dns.contains(dn3));
 
     clock.fastForward(1000);
     pendingOps.removeExpiredEntries(2500);
 
     // Now should only have entries for container 2
     ops = pendingOps.getPendingOps(new ContainerID(1));
-    Assert.assertEquals(0, ops.size());
+    Assertions.assertEquals(0, ops.size());
     ops = pendingOps.getPendingOps(new ContainerID(2));
-    Assert.assertEquals(1, ops.size());
+    Assertions.assertEquals(1, ops.size());
 
     // Advance the clock again and all should be removed
     clock.fastForward(1000);
     pendingOps.removeExpiredEntries(2500);
     ops = pendingOps.getPendingOps(new ContainerID(2));
-    Assert.assertEquals(0, ops.size());
+    Assertions.assertEquals(0, ops.size());
   }
 
 }
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/states/TestContainerAttribute.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/states/TestContainerAttribute.java
index fab2c68025..b8141b2e6a 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/states/TestContainerAttribute.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/states/TestContainerAttribute.java
@@ -20,10 +20,8 @@ package org.apache.hadoop.hdds.scm.container.states;
 
 import org.apache.hadoop.hdds.scm.container.ContainerID;
 import org.apache.hadoop.hdds.scm.exceptions.SCMException;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 import java.util.Arrays;
 import java.util.List;
@@ -33,25 +31,22 @@ import java.util.List;
  */
 public class TestContainerAttribute {
 
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
-
   @Test
   public void testInsert() throws SCMException {
     ContainerAttribute<Integer> containerAttribute = new 
ContainerAttribute<>();
     ContainerID id = ContainerID.valueOf(42);
     containerAttribute.insert(1, id);
-    Assert.assertEquals(1,
+    Assertions.assertEquals(1,
         containerAttribute.getCollection(1).size());
-    Assert.assertTrue(containerAttribute.getCollection(1).contains(id));
+    Assertions.assertTrue(containerAttribute.getCollection(1).contains(id));
 
     // Insert again and verify that the new ContainerId is inserted.
     ContainerID newId =
         ContainerID.valueOf(42);
     containerAttribute.insert(1, newId);
-    Assert.assertEquals(1,
+    Assertions.assertEquals(1,
         containerAttribute.getCollection(1).size());
-    Assert.assertTrue(containerAttribute.getCollection(1).contains(newId));
+    Assertions.assertTrue(containerAttribute.getCollection(1).contains(newId));
   }
 
   @Test
@@ -61,12 +56,12 @@ public class TestContainerAttribute {
     for (int x = 1; x < 42; x++) {
       containerAttribute.insert(1, ContainerID.valueOf(x));
     }
-    Assert.assertTrue(containerAttribute.hasKey(1));
+    Assertions.assertTrue(containerAttribute.hasKey(1));
     for (int x = 1; x < 42; x++) {
-      Assert.assertTrue(containerAttribute.hasContainerID(1, x));
+      Assertions.assertTrue(containerAttribute.hasContainerID(1, x));
     }
 
-    Assert.assertFalse(containerAttribute.hasContainerID(1,
+    Assertions.assertFalse(containerAttribute.hasContainerID(1,
         ContainerID.valueOf(42)));
   }
 
@@ -80,11 +75,11 @@ public class TestContainerAttribute {
       }
     }
     for (String k : keyslist) {
-      Assert.assertEquals(100,
+      Assertions.assertEquals(100,
           containerAttribute.getCollection(k).size());
     }
     containerAttribute.clearSet("Key1");
-    Assert.assertEquals(0,
+    Assertions.assertEquals(0,
         containerAttribute.getCollection("Key1").size());
   }
 
@@ -104,17 +99,17 @@ public class TestContainerAttribute {
     }
 
     for (int x = 1; x < 101; x += 2) {
-      Assert.assertFalse(containerAttribute.hasContainerID("Key1",
+      Assertions.assertFalse(containerAttribute.hasContainerID("Key1",
           ContainerID.valueOf(x)));
     }
 
-    Assert.assertEquals(100,
+    Assertions.assertEquals(100,
         containerAttribute.getCollection("Key2").size());
 
-    Assert.assertEquals(100,
+    Assertions.assertEquals(100,
         containerAttribute.getCollection("Key3").size());
 
-    Assert.assertEquals(50,
+    Assertions.assertEquals(50,
         containerAttribute.getCollection("Key1").size());
   }
 
@@ -128,16 +123,16 @@ public class TestContainerAttribute {
     ContainerID id = ContainerID.valueOf(42);
 
     containerAttribute.insert(key1, id);
-    Assert.assertTrue(containerAttribute.hasContainerID(key1, id));
-    Assert.assertFalse(containerAttribute.hasContainerID(key2, id));
+    Assertions.assertTrue(containerAttribute.hasContainerID(key1, id));
+    Assertions.assertFalse(containerAttribute.hasContainerID(key2, id));
 
     // This should move the id from key1 bucket to key2 bucket.
     containerAttribute.update(key1, key2, id);
-    Assert.assertFalse(containerAttribute.hasContainerID(key1, id));
-    Assert.assertTrue(containerAttribute.hasContainerID(key2, id));
+    Assertions.assertFalse(containerAttribute.hasContainerID(key1, id));
+    Assertions.assertTrue(containerAttribute.hasContainerID(key2, id));
 
     // This should fail since we cannot find this id in the key3 bucket.
-    thrown.expect(SCMException.class);
-    containerAttribute.update(key3, key1, id);
+    Assertions.assertThrows(SCMException.class,
+        () -> containerAttribute.update(key3, key1, id));
   }
 }
\ No newline at end of file
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/crl/TestCRLStatusReportHandler.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/crl/TestCRLStatusReportHandler.java
index ab32e3688e..91c9dbc09a 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/crl/TestCRLStatusReportHandler.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/crl/TestCRLStatusReportHandler.java
@@ -31,17 +31,17 @@ import 
org.apache.hadoop.hdds.security.x509.certificate.authority.CertificateSto
 import org.apache.hadoop.hdds.security.x509.crl.CRLStatus;
 import org.apache.hadoop.hdds.server.events.Event;
 import org.apache.hadoop.hdds.server.events.EventPublisher;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+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.junit.jupiter.api.io.TempDir;
 import org.mockito.Mockito;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -58,15 +58,12 @@ public class TestCRLStatusReportHandler implements 
EventPublisher {
   private CertificateStore certificateStore;
   private SCMMetadataStore scmMetadataStore;
 
-  @Rule
-  public final TemporaryFolder tempDir = new TemporaryFolder();
-
-  @Before
-  public void init() throws IOException {
+  @BeforeEach
+  public void init(@TempDir Path tempDir) throws IOException {
     OzoneConfiguration config = new OzoneConfiguration();
 
     config.set(HddsConfigKeys.OZONE_METADATA_DIRS,
-        tempDir.newFolder().getAbsolutePath());
+        tempDir.toAbsolutePath().toString());
     config.setBoolean(OZONE_SECURITY_ENABLED_KEY, true);
 
     SCMStorageConfig storageConfig = Mockito.mock(SCMStorageConfig.class);
@@ -80,7 +77,7 @@ public class TestCRLStatusReportHandler implements 
EventPublisher {
         new CRLStatusReportHandler(certificateStore, config);
   }
 
-  @After
+  @AfterEach
   public void destroyDbStore() throws Exception {
     if (scmMetadataStore.getStore() != null) {
       scmMetadataStore.getStore().close();
@@ -103,21 +100,24 @@ public class TestCRLStatusReportHandler implements 
EventPublisher {
         getCRLStatusReport(dn2, pendingCRLIds2, 2L);
     crlStatusReportHandler.onMessage(reportFromDatanode1, this);
     CRLStatus crlStatus = certificateStore.getCRLStatusForDN(dn1.getUuid());
-    
Assert.assertTrue(crlStatus.getPendingCRLIds().containsAll(pendingCRLIds1));
-    Assert.assertEquals(5L, crlStatus.getReceivedCRLId());
+    Assertions.assertTrue(
+        crlStatus.getPendingCRLIds().containsAll(pendingCRLIds1));
+    Assertions.assertEquals(5L, crlStatus.getReceivedCRLId());
 
     pendingCRLIds1.remove(0);
     reportFromDatanode1 = getCRLStatusReport(dn1, pendingCRLIds1, 6L);
     crlStatusReportHandler.onMessage(reportFromDatanode1, this);
     crlStatus = certificateStore.getCRLStatusForDN(dn1.getUuid());
-    Assert.assertEquals(1, crlStatus.getPendingCRLIds().size());
-    Assert.assertEquals(4L, crlStatus.getPendingCRLIds().get(0).longValue());
-    Assert.assertEquals(6L, crlStatus.getReceivedCRLId());
+    Assertions.assertEquals(1, crlStatus.getPendingCRLIds().size());
+    Assertions.assertEquals(4L,
+        crlStatus.getPendingCRLIds().get(0).longValue());
+    Assertions.assertEquals(6L, crlStatus.getReceivedCRLId());
 
     crlStatusReportHandler.onMessage(reportFromDatanode2, this);
     crlStatus = certificateStore.getCRLStatusForDN(dn2.getUuid());
-    
Assert.assertTrue(crlStatus.getPendingCRLIds().containsAll(pendingCRLIds2));
-    Assert.assertEquals(2L, crlStatus.getReceivedCRLId());
+    Assertions.assertTrue(
+        crlStatus.getPendingCRLIds().containsAll(pendingCRLIds2));
+    Assertions.assertEquals(2L, crlStatus.getReceivedCRLId());
   }
 
   private CRLStatusReportFromDatanode getCRLStatusReport(
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestContainerPlacement.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestContainerPlacement.java
index cf705d3c84..f82f8f3d54 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestContainerPlacement.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestContainerPlacement.java
@@ -67,16 +67,14 @@ import org.apache.commons.io.IOUtils;
 import static 
org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeState.HEALTHY;
 
 import org.apache.ozone.test.GenericTestUtils;
-import org.junit.After;
+import org.junit.jupiter.api.AfterEach;
 
 import static 
org.apache.hadoop.ozone.container.upgrade.UpgradeUtils.toLayoutVersionProto;
 import static 
org.apache.hadoop.hdds.upgrade.HDDSLayoutVersionManager.maxLayoutVersion;
-import static org.junit.Assert.assertEquals;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
 
 /**
@@ -92,10 +90,7 @@ public class TestContainerPlacement {
   private PipelineManager pipelineManager;
   private NodeManager nodeManager;
 
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
-
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     conf = getConf();
     testDir = GenericTestUtils.getTestDir(
@@ -113,7 +108,7 @@ public class TestContainerPlacement {
         HddsProtos.ReplicationFactor.THREE));
   }
 
-  @After
+  @AfterEach
   public void cleanup() throws Exception {
     if (dbStore != null) {
       dbStore.close();
@@ -177,7 +172,7 @@ public class TestContainerPlacement {
    * @throws InterruptedException
    */
   @Test
-  @Ignore
+  @Disabled
   public void testContainerPlacementCapacity() throws IOException,
       InterruptedException {
     final int nodeCount = 4;
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
index 30b4edce80..f781c3f13c 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
@@ -76,14 +76,10 @@ import 
org.apache.hadoop.ozone.protocol.commands.SetNodeOperationalStateCommand;
 import 
org.apache.hadoop.security.authentication.client.AuthenticationException;
 import org.apache.ozone.test.GenericTestUtils;
 import org.apache.hadoop.test.PathUtils;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
 import java.util.Map;
 import java.util.function.Predicate;
@@ -109,8 +105,11 @@ import static 
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_STALENODE_INTER
 import static org.apache.hadoop.hdds.scm.events.SCMEvents.DATANODE_COMMAND;
 import static org.apache.hadoop.hdds.scm.events.SCMEvents.NEW_NODE;
 import static 
org.apache.hadoop.ozone.container.upgrade.UpgradeUtils.toLayoutVersionProto;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -147,20 +146,13 @@ public class TestSCMNodeManager {
   private static final LayoutVersionProto CORRECT_LAYOUT_PROTO =
       toLayoutVersionProto(MAX_LV, MAX_LV);
 
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
-
-  @BeforeClass
-  public static void init() throws IOException {
-  }
-
-  @Before
+  @BeforeEach
   public void setup() {
     testDir = PathUtils.getTestDir(
         TestSCMNodeManager.class);
   }
 
-  @After
+  @AfterEach
   public void cleanup() {
     if (scm != null) {
       scm.stop();
@@ -233,9 +225,8 @@ public class TestSCMNodeManager {
 
       //TODO: wait for heartbeat to be processed
       Thread.sleep(4 * 1000);
-      assertTrue("Heartbeat thread should have picked up the" +
-              "scheduled heartbeats.",
-          nodeManager.getAllNodes().size() == registeredNodes);
+      assertEquals(nodeManager.getAllNodes().size(), registeredNodes,
+          "Heartbeat thread should have picked up the scheduled heartbeats.");
     }
   }
 
@@ -254,7 +245,7 @@ public class TestSCMNodeManager {
         1, TimeUnit.DAYS);
 
     try (SCMNodeManager nodeManager = createNodeManager(conf)) {
-      Assert.assertTrue(scm.checkLeader());
+      assertTrue(scm.checkLeader());
       // Register 2 nodes correctly.
       // These will be used with a faulty node to test pipeline creation.
       DatanodeDetails goodNode1 = registerWithCapacity(nodeManager);
@@ -308,7 +299,7 @@ public class TestSCMNodeManager {
             Arrays.asList(metadataStorageReport)),
         getRandomPipelineReports(), layout);
 
-    Assert.assertEquals(expectedResult, cmd.getError());
+    assertEquals(expectedResult, cmd.getError());
     return cmd.getDatanode();
   }
 
@@ -373,7 +364,7 @@ public class TestSCMNodeManager {
         1, TimeUnit.DAYS);
 
     try (SCMNodeManager nodeManager = createNodeManager(conf)) {
-      Assert.assertTrue(scm.checkLeader());
+      assertTrue(scm.checkLeader());
       // Nodes with mismatched SLV cannot join the cluster.
       registerWithCapacity(nodeManager,
           LARGER_SLV_LAYOUT_PROTO, errorNodeNotPermitted);
@@ -392,7 +383,7 @@ public class TestSCMNodeManager {
       DatanodeDetails goodNode = registerWithCapacity(nodeManager,
           CORRECT_LAYOUT_PROTO, success);
 
-      Assert.assertEquals(3, nodeManager.getAllNodes().size());
+      assertEquals(3, nodeManager.getAllNodes().size());
 
       scm.exitSafeMode();
 
@@ -434,9 +425,9 @@ public class TestSCMNodeManager {
               HddsProtos.ReplicationType.RATIS,
               HddsProtos.ReplicationFactor.THREE);
       scm.getPipelineManager().createPipeline(ratisThree);
-      Assert.fail("3 nodes should not have been found for a pipeline.");
+      fail("3 nodes should not have been found for a pipeline.");
     } catch (SCMException ex) {
-      Assert.assertTrue(ex.getMessage().contains("Required 3. Found " +
+      assertTrue(ex.getMessage().contains("Required 3. Found " +
           actualNodeCount));
     }
   }
@@ -479,7 +470,7 @@ public class TestSCMNodeManager {
                       "which is not in the set of allowed datanodes: %s",
                   pipeline.getId().toString(), pipelineDN.getUuidString(),
                   allowedDnIds);
-              Assert.fail(message);
+              fail(message);
             }
           }
         }
@@ -503,8 +494,8 @@ public class TestSCMNodeManager {
     try (SCMNodeManager nodeManager = createNodeManager(getConf())) {
       //TODO: wait for heartbeat to be processed
       Thread.sleep(4 * 1000);
-      assertTrue("No heartbeats, 0 nodes should be registered",
-          nodeManager.getAllNodes().size() == 0);
+      assertEquals(0, nodeManager.getAllNodes().size(),
+          "No heartbeats, 0 nodes should be registered");
     }
   }
 
@@ -641,8 +632,8 @@ public class TestSCMNodeManager {
       scm.getScmContext().updateLeaderAndTerm(true, 1);
       List<SCMCommand> commands = nodeManager.processHeartbeat(dn, layoutInfo);
 
-      Assert.assertTrue(commands.get(0).getClass().equals(
-          SetNodeOperationalStateCommand.class));
+      assertEquals(SetNodeOperationalStateCommand.class,
+          commands.get(0).getClass());
       assertEquals(1, commands.size());
 
       // If found mismatch, follower SCM update its own opState according
@@ -668,7 +659,7 @@ public class TestSCMNodeManager {
    * @throws TimeoutException
    */
   @Test
-  @Ignore("HDDS-5098")
+  @Disabled("HDDS-5098")
   public void testScmDetectStaleAndDeadNode()
       throws IOException, InterruptedException, AuthenticationException {
     final int interval = 100;
@@ -714,12 +705,12 @@ public class TestSCMNodeManager {
       Thread.sleep(2 * 1000);
       List<DatanodeDetails> staleNodeList =
           nodeManager.getNodes(NodeStatus.inServiceStale());
-      assertEquals("Expected to find 1 stale node",
-          1, nodeManager.getNodeCount(NodeStatus.inServiceStale()));
-      assertEquals("Expected to find 1 stale node",
-          1, staleNodeList.size());
-      assertEquals("Stale node is not the expected ID", staleNode
-          .getUuid(), staleNodeList.get(0).getUuid());
+      assertEquals(1, nodeManager.getNodeCount(NodeStatus.inServiceStale()),
+          "Expected to find 1 stale node");
+      assertEquals(1, staleNodeList.size(),
+          "Expected to find 1 stale node");
+      assertEquals(staleNode.getUuid(), staleNodeList.get(0).getUuid(),
+          "Stale node is not the expected ID");
       Thread.sleep(1000);
 
       Map<String, Map<String, Integer>> nodeCounts = 
nodeManager.getNodeCount();
@@ -739,10 +730,10 @@ public class TestSCMNodeManager {
       // the stale node has been removed
       staleNodeList = nodeManager.getNodes(NodeStatus.inServiceStale());
       nodeCounts = nodeManager.getNodeCount();
-      assertEquals("Expected to find 1 stale node",
-          0, nodeManager.getNodeCount(NodeStatus.inServiceStale()));
-      assertEquals("Expected to find 1 stale node",
-          0, staleNodeList.size());
+      assertEquals(0, nodeManager.getNodeCount(NodeStatus.inServiceStale()),
+          "Expected to find 1 stale node");
+      assertEquals(0, staleNodeList.size(),
+          "Expected to find 1 stale node");
       assertEquals(0,
           nodeCounts.get(HddsProtos.NodeOperationalState.IN_SERVICE.name())
               .get(HddsProtos.NodeState.STALE.name()).intValue());
@@ -750,15 +741,14 @@ public class TestSCMNodeManager {
       // Check for the dead node now.
       List<DatanodeDetails> deadNodeList =
           nodeManager.getNodes(NodeStatus.inServiceDead());
-      assertEquals("Expected to find 1 dead node", 1,
-          nodeManager.getNodeCount(NodeStatus.inServiceDead()));
-      assertEquals("Expected to find 1 dead node",
-          1, deadNodeList.size());
+      assertEquals(1, nodeManager.getNodeCount(NodeStatus.inServiceDead()),
+          "Expected to find 1 dead node");
+      assertEquals(1, deadNodeList.size(), "Expected to find 1 dead node");
       assertEquals(1,
           nodeCounts.get(HddsProtos.NodeOperationalState.IN_SERVICE.name())
               .get(HddsProtos.NodeState.DEAD.name()).intValue());
-      assertEquals("Dead node is not the expected ID", staleNode
-          .getUuid(), deadNodeList.get(0).getUuid());
+      assertEquals(staleNode.getUuid(), deadNodeList.get(0).getUuid(),
+          "Dead node is not the expected ID");
     }
   }
 
@@ -827,18 +817,17 @@ public class TestSCMNodeManager {
       Thread.sleep(MILLISECONDS.convert(staleNodeInterval, SECONDS));
 
       // Step 2 : resume health check
-      assertTrue("Unexpected, already skipped heartbeat checks",
-          (nodeManager.getSkippedHealthChecks() == 0));
+      assertEquals(0, nodeManager.getSkippedHealthChecks(),
+          "Unexpected, already skipped heartbeat checks");
       schedFuture = nodeManager.unpauseHealthCheck();
 
       // Step 3 : wait for 1 iteration of health check
       try {
         schedFuture.get();
-        assertTrue("We did not skip any heartbeat checks",
-            nodeManager.getSkippedHealthChecks() > 0);
+        assertTrue(nodeManager.getSkippedHealthChecks() > 0,
+            "We did not skip any heartbeat checks");
       } catch (ExecutionException e) {
-        assertEquals("Unexpected exception waiting for Scheduled Health Check",
-            0, 1);
+        fail("Unexpected exception waiting for Scheduled Health Check");
       }
 
       // Step 4 : all nodes should still be HEALTHY
@@ -907,7 +896,7 @@ public class TestSCMNodeManager {
             .setMetadataLayoutVersion(scmMlv + 1)
             .setSoftwareLayoutVersion(scmSlv + 1)
             .build());
-    Assert.assertTrue(logCapturer.getOutput()
+    assertTrue(logCapturer.getOutput()
         .contains("Invalid data node in the cluster"));
     nodeManager.close();
   }
@@ -979,11 +968,11 @@ public class TestSCMNodeManager {
             .addCommand(SCMCommandProto.Type.closeContainerCommand)
             .addCount(11)
             .build());
-    Assert.assertEquals(-1, nodeManager.getNodeQueuedCommandCount(
+    assertEquals(-1, nodeManager.getNodeQueuedCommandCount(
         node1, SCMCommandProto.Type.closePipelineCommand));
-    Assert.assertEquals(123, nodeManager.getNodeQueuedCommandCount(
+    assertEquals(123, nodeManager.getNodeQueuedCommandCount(
         node1, SCMCommandProto.Type.replicateContainerCommand));
-    Assert.assertEquals(11, nodeManager.getNodeQueuedCommandCount(
+    assertEquals(11, nodeManager.getNodeQueuedCommandCount(
         node1, SCMCommandProto.Type.closeContainerCommand));
   }
 
@@ -1121,9 +1110,9 @@ public class TestSCMNodeManager {
       // remain in the healthy State.
       List<DatanodeDetails> healthyList = nodeManager.getNodes(
           NodeStatus.inServiceHealthy());
-      assertEquals("Expected one healthy node", 1, healthyList.size());
-      assertEquals("Healthy node is not the expected ID", healthyNode
-          .getUuid(), healthyList.get(0).getUuid());
+      assertEquals(1, healthyList.size(), "Expected one healthy node");
+      assertEquals(healthyNode.getUuid(), healthyList.get(0).getUuid(),
+          "Healthy node is not the expected ID");
 
       assertEquals(2, nodeManager.getNodeCount(NodeStatus.inServiceStale()));
 
@@ -1152,20 +1141,17 @@ public class TestSCMNodeManager {
       assertEquals(1, nodeManager.getNodeCount(NodeStatus.inServiceStale()));
       assertEquals(1, nodeManager.getNodeCount(NodeStatus.inServiceDead()));
 
-      assertEquals("Expected one healthy node",
-          1, healthyList.size());
-      assertEquals("Healthy node is not the expected ID", healthyNode
-          .getUuid(), healthyList.get(0).getUuid());
+      assertEquals(1, healthyList.size(), "Expected one healthy node");
+      assertEquals(healthyNode.getUuid(), healthyList.get(0).getUuid(),
+          "Healthy node is not the expected ID");
 
-      assertEquals("Expected one stale node",
-          1, staleList.size());
-      assertEquals("Stale node is not the expected ID", staleNode
-          .getUuid(), staleList.get(0).getUuid());
+      assertEquals(1, staleList.size(), "Expected one stale node");
+      assertEquals(staleNode.getUuid(), staleList.get(0).getUuid(),
+          "Stale node is not the expected ID");
 
-      assertEquals("Expected one dead node",
-          1, deadList.size());
-      assertEquals("Dead node is not the expected ID", deadNode
-          .getUuid(), deadList.get(0).getUuid());
+      assertEquals(1, deadList.size(), "Expected one dead node");
+      assertEquals(deadNode.getUuid(), deadList.get(0).getUuid(),
+          "Dead node is not the expected ID");
       /**
        * Cluster State : let us heartbeat all the nodes and verify that we get
        * back all the nodes in healthy state.
@@ -1389,8 +1375,8 @@ public class TestSCMNodeManager {
 
       GenericTestUtils.waitFor(() -> findNodes(nodeManager, staleCount, STALE),
           500, 20 * 1000);
-      assertEquals("Node count mismatch",
-          healthyCount + staleCount, nodeManager.getAllNodes().size());
+      assertEquals(healthyCount + staleCount,
+          nodeManager.getAllNodes().size(), "Node count mismatch");
 
       thread1.interrupt();
       thread2.interrupt();
@@ -1690,8 +1676,8 @@ public class TestSCMNodeManager {
       List<SCMCommand> command =
           nodemanager.processHeartbeat(datanodeDetails, layoutInfo);
       // With dh registered, SCM will send create pipeline command to dn
-      Assert.assertTrue(command.size() >= 1);
-      Assert.assertTrue(command.get(0).getClass().equals(
+      assertTrue(command.size() >= 1);
+      assertTrue(command.get(0).getClass().equals(
           CloseContainerCommand.class) ||
           command.get(1).getClass().equals(CloseContainerCommand.class));
     } catch (IOException e) {
@@ -1778,10 +1764,9 @@ public class TestSCMNodeManager {
       assertEquals(nodeCount, clusterMap.getNumOfLeafNode(""));
       assertEquals(4, clusterMap.getMaxLevel());
       List<DatanodeDetails> nodeList = nodeManager.getAllNodes();
-      nodeList.stream().forEach(node ->
-          
Assert.assertTrue(node.getNetworkLocation().startsWith("/rack1/ng")));
-      nodeList.stream().forEach(node ->
-          Assert.assertTrue(node.getParent() != null));
+      nodeList.forEach(node -> assertTrue(
+          node.getNetworkLocation().startsWith("/rack1/ng")));
+      nodeList.forEach(node -> assertNotNull(node.getParent()));
     }
   }
 
@@ -1821,18 +1806,16 @@ public class TestSCMNodeManager {
       assertEquals(nodeCount, clusterMap.getNumOfLeafNode(""));
       assertEquals(3, clusterMap.getMaxLevel());
       List<DatanodeDetails> nodeList = nodeManager.getAllNodes();
-      nodeList.stream().forEach(node ->
-          Assert.assertTrue(node.getNetworkLocation().equals("/rack1")));
+      nodeList.forEach(node ->
+          assertEquals("/rack1", node.getNetworkLocation()));
 
       // test get node
       if (useHostname) {
-        Arrays.stream(hostNames).forEach(hostname ->
-            Assert.assertNotEquals(0, nodeManager.getNodesByAddress(hostname)
-                .size()));
+        Arrays.stream(hostNames).forEach(hostname -> assertNotEquals(0,
+            nodeManager.getNodesByAddress(hostname).size()));
       } else {
-        Arrays.stream(ipAddress).forEach(ip ->
-            Assert.assertNotEquals(0, nodeManager.getNodesByAddress(ip)
-                .size()));
+        Arrays.stream(ipAddress).forEach(ip -> assertNotEquals(0,
+            nodeManager.getNodesByAddress(ip).size()));
       }
     }
   }
@@ -1924,17 +1907,15 @@ public class TestSCMNodeManager {
         nodeManager.register(node, null, null);
       }
       // test get node
-      Assert.assertEquals(0, nodeManager.getNodesByAddress(null).size());
+      assertEquals(0, nodeManager.getNodesByAddress(null).size());
       if (useHostname) {
-        Assert.assertEquals(2,
-            nodeManager.getNodesByAddress("host1").size());
-        Assert.assertEquals(1, nodeManager.getNodesByAddress("host2").size());
-        Assert.assertEquals(0, 
nodeManager.getNodesByAddress("unknown").size());
+        assertEquals(2, nodeManager.getNodesByAddress("host1").size());
+        assertEquals(1, nodeManager.getNodesByAddress("host2").size());
+        assertEquals(0, nodeManager.getNodesByAddress("unknown").size());
       } else {
-        Assert.assertEquals(2,
-            nodeManager.getNodesByAddress("1.2.3.4").size());
-        Assert.assertEquals(1, 
nodeManager.getNodesByAddress("2.3.4.5").size());
-        Assert.assertEquals(0, 
nodeManager.getNodesByAddress("1.9.8.7").size());
+        assertEquals(2, nodeManager.getNodesByAddress("1.2.3.4").size());
+        assertEquals(1, nodeManager.getNodesByAddress("2.3.4.5").size());
+        assertEquals(0, nodeManager.getNodesByAddress("1.9.8.7").size());
       }
     }
   }
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeStorageStatMap.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeStorageStatMap.java
index 89d45e07e2..8b6e58da53 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeStorageStatMap.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeStorageStatMap.java
@@ -29,12 +29,9 @@ import org.apache.hadoop.hdds.scm.exceptions.SCMException;
 import org.apache.hadoop.ozone.OzoneConsts;
 import org.apache.hadoop.ozone.container.common.impl.StorageLocationReport;
 import org.apache.ozone.test.GenericTestUtils;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import java.util.Arrays;
 import java.util.Collections;
@@ -59,16 +56,12 @@ public class TestSCMNodeStorageStatMap {
   private final Map<UUID, Set<StorageLocationReport>> testData =
       new ConcurrentHashMap<>();
 
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
-
   private void generateData() {
     for (int dnIndex = 1; dnIndex <= DATANODE_COUNT; dnIndex++) {
       UUID dnId = UUID.randomUUID();
       Set<StorageLocationReport> reportSet = new HashSet<>();
       String path = GenericTestUtils.getTempPath(
-          TestSCMNodeStorageStatMap.class.getSimpleName() + "-" +
-              Integer.toString(dnIndex));
+          TestSCMNodeStorageStatMap.class.getSimpleName() + "-" + dnIndex);
       StorageLocationReport.Builder builder =
           StorageLocationReport.newBuilder();
       builder.setStorageType(StorageType.DISK).setId(dnId.toString())
@@ -83,15 +76,11 @@ public class TestSCMNodeStorageStatMap {
     return testData.keySet().iterator().next();
   }
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     generateData();
   }
 
-  @After
-  public void tearDown() throws Exception {
-  }
-
   @Test
   public void testIsKnownDatanode() throws SCMException {
     SCMNodeStorageStatMap map = new SCMNodeStorageStatMap(conf);
@@ -99,10 +88,10 @@ public class TestSCMNodeStorageStatMap {
     UUID unknownNode = UUID.randomUUID();
     Set<StorageLocationReport> report = testData.get(knownNode);
     map.insertNewDatanode(knownNode, report);
-    Assert.assertTrue("Not able to detect a known node",
-        map.isKnownDatanode(knownNode));
-    Assert.assertFalse("Unknown node detected",
-        map.isKnownDatanode(unknownNode));
+    Assertions.assertTrue(map.isKnownDatanode(knownNode),
+        "Not able to detect a known node");
+    Assertions.assertFalse(map.isKnownDatanode(unknownNode),
+        "Unknown node detected");
   }
 
   @Test
@@ -111,29 +100,28 @@ public class TestSCMNodeStorageStatMap {
     UUID knownNode = getFirstKey();
     Set<StorageLocationReport> report = testData.get(knownNode);
     map.insertNewDatanode(knownNode, report);
-    Assert.assertEquals(map.getStorageVolumes(knownNode),
+    Assertions.assertEquals(map.getStorageVolumes(knownNode),
         testData.get(knownNode));
-    thrown.expect(SCMException.class);
-    thrown.expectMessage("already exists");
-    map.insertNewDatanode(knownNode, report);
+    Throwable t = Assertions.assertThrows(SCMException.class,
+        () -> map.insertNewDatanode(knownNode, report));
+    Assertions.assertEquals("Node already exists in the map", t.getMessage());
   }
 
   @Test
-  public void testUpdateUnknownDatanode() throws SCMException {
+  public void testUpdateUnknownDatanode() {
     SCMNodeStorageStatMap map = new SCMNodeStorageStatMap(conf);
     UUID unknownNode = UUID.randomUUID();
     String path = GenericTestUtils.getTempPath(
-        TestSCMNodeStorageStatMap.class.getSimpleName() + "-" + unknownNode
-            .toString());
+        TestSCMNodeStorageStatMap.class.getSimpleName() + "-" + unknownNode);
     Set<StorageLocationReport> reportSet = new HashSet<>();
     StorageLocationReport.Builder builder = StorageLocationReport.newBuilder();
     builder.setStorageType(StorageType.DISK).setId(unknownNode.toString())
         .setStorageLocation(path).setScmUsed(used).setRemaining(remaining)
         .setCapacity(capacity).setFailed(false);
     reportSet.add(builder.build());
-    thrown.expect(SCMException.class);
-    thrown.expectMessage("No such datanode");
-    map.updateDatanodeMap(unknownNode, reportSet);
+    Throwable t = Assertions.assertThrows(SCMException.class,
+        () -> map.updateDatanodeMap(unknownNode, reportSet));
+    Assertions.assertEquals("No such datanode", t.getMessage());
   }
 
   @Test
@@ -143,7 +131,7 @@ public class TestSCMNodeStorageStatMap {
     Set<StorageLocationReport> reportSet = testData.get(key);
     SCMNodeStorageStatMap map = new SCMNodeStorageStatMap(conf);
     map.insertNewDatanode(key, reportSet);
-    Assert.assertTrue(map.isKnownDatanode(key));
+    Assertions.assertTrue(map.isKnownDatanode(key));
     UUID storageId = UUID.randomUUID();
     String path =
         GenericTestUtils.getRandomizedTempPath().concat("/" + storageId);
@@ -157,7 +145,7 @@ public class TestSCMNodeStorageStatMap {
     StorageReportResult result =
         map.processNodeReport(key, HddsTestUtils.createNodeReport(
             Arrays.asList(storageReport), Collections.emptyList()));
-    Assert.assertEquals(SCMNodeStorageStatMap.ReportStatus.ALL_IS_WELL,
+    Assertions.assertEquals(SCMNodeStorageStatMap.ReportStatus.ALL_IS_WELL,
         result.getStatus());
     StorageContainerDatanodeProtocolProtos.NodeReportProto.Builder nrb =
         NodeReportProto.newBuilder();
@@ -165,7 +153,7 @@ public class TestSCMNodeStorageStatMap {
     reportList.add(srb);
     result = map.processNodeReport(key, HddsTestUtils.createNodeReport(
         reportList, Collections.emptyList()));
-    Assert.assertEquals(SCMNodeStorageStatMap.ReportStatus.ALL_IS_WELL,
+    Assertions.assertEquals(SCMNodeStorageStatMap.ReportStatus.ALL_IS_WELL,
         result.getStatus());
 
     reportList.add(HddsTestUtils
@@ -173,7 +161,8 @@ public class TestSCMNodeStorageStatMap {
             reportCapacity, 0, null));
     result = map.processNodeReport(key, HddsTestUtils.createNodeReport(
         reportList, Collections.emptyList()));
-    
Assert.assertEquals(SCMNodeStorageStatMap.ReportStatus.STORAGE_OUT_OF_SPACE,
+    Assertions.assertEquals(
+        SCMNodeStorageStatMap.ReportStatus.STORAGE_OUT_OF_SPACE,
         result.getStatus());
     // Mark a disk failed 
     StorageReportProto srb2 = StorageReportProto.newBuilder()
@@ -183,7 +172,7 @@ public class TestSCMNodeStorageStatMap {
     reportList.add(srb2);
     nrb.addAllStorageReport(reportList);
     result = map.processNodeReport(key, nrb.addStorageReport(srb).build());
-    Assert.assertEquals(SCMNodeStorageStatMap.ReportStatus
+    Assertions.assertEquals(SCMNodeStorageStatMap.ReportStatus
         .FAILED_AND_OUT_OF_SPACE_STORAGE, result.getStatus());
 
   }
@@ -197,11 +186,12 @@ public class TestSCMNodeStorageStatMap {
         .entrySet()) {
       map.insertNewDatanode(keyEntry.getKey(), keyEntry.getValue());
     }
-    Assert.assertEquals(DATANODE_COUNT * capacity, map.getTotalCapacity());
-    Assert.assertEquals(DATANODE_COUNT * remaining, map.getTotalFreeSpace());
-    Assert.assertEquals(DATANODE_COUNT * used, map.getTotalSpaceUsed());
+    Assertions.assertEquals(DATANODE_COUNT * capacity, map.getTotalCapacity());
+    Assertions.assertEquals(DATANODE_COUNT * remaining,
+        map.getTotalFreeSpace());
+    Assertions.assertEquals(DATANODE_COUNT * used, map.getTotalSpaceUsed());
 
-    // upadate 1/4th of the datanode to be full
+    // update 1/4th of the datanode to be full
     for (Map.Entry<UUID, Set<StorageLocationReport>> keyEntry : testData
         .entrySet()) {
       Set<StorageLocationReport> reportSet = new HashSet<>();
@@ -222,20 +212,21 @@ public class TestSCMNodeStorageStatMap {
         break;
       }
     }
-    Assert.assertEquals(DATANODE_COUNT / 4,
+    Assertions.assertEquals(DATANODE_COUNT / 4,
         
map.getDatanodeList(SCMNodeStorageStatMap.UtilizationThreshold.CRITICAL)
             .size());
-    Assert.assertEquals(0,
+    Assertions.assertEquals(0,
         map.getDatanodeList(SCMNodeStorageStatMap.UtilizationThreshold.WARN)
             .size());
-    Assert.assertEquals(0.75 * DATANODE_COUNT,
+    Assertions.assertEquals(0.75 * DATANODE_COUNT,
         map.getDatanodeList(SCMNodeStorageStatMap.UtilizationThreshold.NORMAL)
             .size(), 0);
 
-    Assert.assertEquals(DATANODE_COUNT * capacity, map.getTotalCapacity(), 0);
-    Assert.assertEquals(0.75 * DATANODE_COUNT * remaining,
+    Assertions.assertEquals(DATANODE_COUNT * capacity,
+        map.getTotalCapacity(), 0);
+    Assertions.assertEquals(0.75 * DATANODE_COUNT * remaining,
         map.getTotalFreeSpace(), 0);
-    Assert.assertEquals(
+    Assertions.assertEquals(
         0.75 * DATANODE_COUNT * used + (0.25 * DATANODE_COUNT * capacity),
         map.getTotalSpaceUsed(), 0);
     counter = 1;
@@ -249,23 +240,22 @@ public class TestSCMNodeStorageStatMap {
       }
     }
 
-    Assert.assertEquals(0,
+    Assertions.assertEquals(0,
         
map.getDatanodeList(SCMNodeStorageStatMap.UtilizationThreshold.CRITICAL)
             .size());
-    Assert.assertEquals(0,
+    Assertions.assertEquals(0,
         map.getDatanodeList(SCMNodeStorageStatMap.UtilizationThreshold.WARN)
             .size());
-    Assert.assertEquals(0.75 * DATANODE_COUNT,
+    Assertions.assertEquals(0.75 * DATANODE_COUNT,
         map.getDatanodeList(SCMNodeStorageStatMap.UtilizationThreshold.NORMAL)
             .size(), 0);
 
-    Assert
-        .assertEquals(0.75 * DATANODE_COUNT * capacity, map.getTotalCapacity(),
-            0);
-    Assert.assertEquals(0.75 * DATANODE_COUNT * remaining,
+    Assertions.assertEquals(0.75 * DATANODE_COUNT * capacity,
+        map.getTotalCapacity(), 0);
+    Assertions.assertEquals(0.75 * DATANODE_COUNT * remaining,
         map.getTotalFreeSpace(), 0);
-    Assert
-        .assertEquals(0.75 * DATANODE_COUNT * used, map.getTotalSpaceUsed(), 
0);
+    Assertions.assertEquals(0.75 * DATANODE_COUNT * used,
+        map.getTotalSpaceUsed(), 0);
 
   }
 }
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/states/TestNode2ContainerMap.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/states/TestNode2ContainerMap.java
index e9b365a9c2..277cb0dd5b 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/states/TestNode2ContainerMap.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/states/TestNode2ContainerMap.java
@@ -21,12 +21,9 @@ package org.apache.hadoop.hdds.scm.node.states;
 
 import org.apache.hadoop.hdds.scm.container.ContainerID;
 import org.apache.hadoop.hdds.scm.exceptions.SCMException;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import java.util.Map;
 import java.util.Random;
@@ -44,9 +41,6 @@ public class TestNode2ContainerMap {
   private final Map<UUID, TreeSet<ContainerID>> testData = new
       ConcurrentHashMap<>();
 
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
-
   private void generateData() {
     for (int dnIndex = 1; dnIndex <= DATANODE_COUNT; dnIndex++) {
       TreeSet<ContainerID> currentSet = new TreeSet<>();
@@ -62,15 +56,11 @@ public class TestNode2ContainerMap {
     return testData.keySet().iterator().next();
   }
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     generateData();
   }
 
-  @After
-  public void tearDown() throws Exception {
-  }
-
   @Test
   public void testIsKnownDatanode() throws SCMException {
     Node2ContainerMap map = new Node2ContainerMap();
@@ -78,10 +68,10 @@ public class TestNode2ContainerMap {
     UUID unknownNode = UUID.randomUUID();
     Set<ContainerID> containerIDs = testData.get(knownNode);
     map.insertNewDatanode(knownNode, containerIDs);
-    Assert.assertTrue("Not able to detect a known node",
-        map.isKnownDatanode(knownNode));
-    Assert.assertFalse("Unknown node detected",
-        map.isKnownDatanode(unknownNode));
+    Assertions.assertTrue(map.isKnownDatanode(knownNode),
+        "Not able to detect a known node");
+    Assertions.assertFalse(map.isKnownDatanode(unknownNode),
+        "Unknown node detected");
   }
 
   @Test
@@ -95,12 +85,12 @@ public class TestNode2ContainerMap {
     // Assert that all elements are present in the set that we read back from
     // node map.
     Set newSet = new TreeSet((readSet));
-    Assert.assertTrue(newSet.removeAll(containerIDs));
-    Assert.assertTrue(newSet.size() == 0);
+    Assertions.assertTrue(newSet.removeAll(containerIDs));
+    Assertions.assertEquals(0, newSet.size());
 
-    thrown.expect(SCMException.class);
-    thrown.expectMessage("already exists");
-    map.insertNewDatanode(knownNode, containerIDs);
+    Throwable t = Assertions.assertThrows(SCMException.class,
+        () -> map.insertNewDatanode(knownNode, containerIDs));
+    Assertions.assertEquals("Node already exists in the map", t.getMessage());
 
     map.removeDatanode(knownNode);
     map.insertNewDatanode(knownNode, containerIDs);
@@ -113,9 +103,9 @@ public class TestNode2ContainerMap {
     Set<ContainerID> values = testData.get(key);
     Node2ContainerMap map = new Node2ContainerMap();
     map.insertNewDatanode(key, values);
-    Assert.assertTrue(map.isKnownDatanode(key));
+    Assertions.assertTrue(map.isKnownDatanode(key));
     ReportResult result = map.processReport(key, values);
-    Assert.assertEquals(ReportResult.ReportStatus.ALL_IS_WELL,
+    Assertions.assertEquals(ReportResult.ReportStatus.ALL_IS_WELL,
         result.getStatus());
   }
 
@@ -125,18 +115,22 @@ public class TestNode2ContainerMap {
     Set<ContainerID> values = testData.get(datanodeId);
     Node2ContainerMap map = new Node2ContainerMap();
     map.insertNewDatanode(datanodeId, values);
-    Assert.assertTrue(map.isKnownDatanode(datanodeId));
-    Assert.assertEquals(CONTAINER_COUNT, map.getContainers(datanodeId).size());
+    Assertions.assertTrue(map.isKnownDatanode(datanodeId));
+    Assertions.assertEquals(CONTAINER_COUNT,
+        map.getContainers(datanodeId).size());
 
     //remove one container
     values.remove(values.iterator().next());
-    Assert.assertEquals(CONTAINER_COUNT - 1, values.size());
-    Assert.assertEquals(CONTAINER_COUNT, map.getContainers(datanodeId).size());
+    Assertions.assertEquals(CONTAINER_COUNT - 1,
+        values.size());
+    Assertions.assertEquals(CONTAINER_COUNT,
+        map.getContainers(datanodeId).size());
 
     map.setContainersForDatanode(datanodeId, values);
 
-    Assert.assertEquals(values.size(), map.getContainers(datanodeId).size());
-    Assert.assertEquals(values, map.getContainers(datanodeId));
+    Assertions.assertEquals(values.size(),
+        map.getContainers(datanodeId).size());
+    Assertions.assertEquals(values, map.getContainers(datanodeId));
   }
 
   @Test
@@ -148,7 +142,7 @@ public class TestNode2ContainerMap {
     }
     // Assert all Keys are known datanodes.
     for (UUID key : testData.keySet()) {
-      Assert.assertTrue(map.isKnownDatanode(key));
+      Assertions.assertTrue(map.isKnownDatanode(key));
     }
   }
 
@@ -174,16 +168,16 @@ public class TestNode2ContainerMap {
    * @throws SCMException
    */
   @Test
-  public void testProcessReportDetectNewDataNode() throws SCMException {
+  public void testProcessReportDetectNewDataNode() {
     Node2ContainerMap map = new Node2ContainerMap();
     // If we attempt to process a node that is not present in the map,
     // we get a result back that says, NEW_NODE_FOUND.
     UUID key = getFirstKey();
     TreeSet<ContainerID> values = testData.get(key);
     ReportResult result = map.processReport(key, values);
-    Assert.assertEquals(ReportResult.ReportStatus.NEW_DATANODE_FOUND,
+    Assertions.assertEquals(ReportResult.ReportStatus.NEW_DATANODE_FOUND,
         result.getStatus());
-    Assert.assertEquals(result.getNewEntries().size(), values.size());
+    Assertions.assertEquals(result.getNewEntries().size(), values.size());
   }
 
   /**
@@ -216,15 +210,15 @@ public class TestNode2ContainerMap {
     ReportResult result = map.processReport(key, newContainersSet);
 
     //Assert that expected size of missing container is same as addedContainers
-    Assert.assertEquals(ReportResult.ReportStatus.NEW_ENTRIES_FOUND,
+    Assertions.assertEquals(ReportResult.ReportStatus.NEW_ENTRIES_FOUND,
         result.getStatus());
 
-    Assert.assertEquals(addedContainers.size(),
+    Assertions.assertEquals(addedContainers.size(),
         result.getNewEntries().size());
 
     // Assert that the Container IDs are the same as we added new.
-    Assert.assertTrue("All objects are not removed.",
-        result.getNewEntries().removeAll(addedContainers));
+    Assertions.assertTrue(result.getNewEntries().removeAll(addedContainers),
+        "All objects are not removed.");
   }
 
   /**
@@ -261,14 +255,15 @@ public class TestNode2ContainerMap {
 
 
     //Assert that expected size of missing container is same as addedContainers
-    Assert.assertEquals(ReportResult.ReportStatus.MISSING_ENTRIES,
+    Assertions.assertEquals(ReportResult.ReportStatus.MISSING_ENTRIES,
         result.getStatus());
-    Assert.assertEquals(removedContainers.size(),
+    Assertions.assertEquals(removedContainers.size(),
         result.getMissingEntries().size());
 
     // Assert that the Container IDs are the same as we added new.
-    Assert.assertTrue("All missing containers not found.",
-        result.getMissingEntries().removeAll(removedContainers));
+    Assertions.assertTrue(
+        result.getMissingEntries().removeAll(removedContainers),
+        "All missing containers not found.");
   }
 
   @Test
@@ -306,22 +301,23 @@ public class TestNode2ContainerMap {
     ReportResult result = map.processReport(key, newSet);
 
 
-    Assert.assertEquals(
+    Assertions.assertEquals(
             ReportResult.ReportStatus.MISSING_AND_NEW_ENTRIES_FOUND,
         result.getStatus());
-    Assert.assertEquals(removedContainers.size(),
+    Assertions.assertEquals(removedContainers.size(),
         result.getMissingEntries().size());
 
 
     // Assert that the Container IDs are the same as we added new.
-    Assert.assertTrue("All missing containers not found.",
-        result.getMissingEntries().removeAll(removedContainers));
+    Assertions.assertTrue(
+        result.getMissingEntries().removeAll(removedContainers),
+        "All missing containers not found.");
 
-    Assert.assertEquals(insertedSet.size(),
+    Assertions.assertEquals(insertedSet.size(),
         result.getNewEntries().size());
 
     // Assert that the Container IDs are the same as we added new.
-    Assert.assertTrue("All inserted containers are not found.",
-        result.getNewEntries().removeAll(insertedSet));
+    Assertions.assertTrue(result.getNewEntries().removeAll(insertedSet),
+        "All inserted containers are not found.");
   }
 }
\ No newline at end of file
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestPipelinePlacementPolicy.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestPipelinePlacementPolicy.java
index a94ebd73ad..446be34189 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestPipelinePlacementPolicy.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestPipelinePlacementPolicy.java
@@ -59,17 +59,13 @@ import org.apache.hadoop.ozone.ClientVersion;
 import org.apache.hadoop.ozone.OzoneConsts;
 import org.apache.hadoop.ozone.container.common.SCMTestUtils;
 import org.apache.ozone.test.GenericTestUtils;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+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 java.io.IOException;
 
-import static junit.framework.TestCase.assertEquals;
-import static junit.framework.TestCase.assertTrue;
 import static 
org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor.ONE;
 import static 
org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor.THREE;
 import static 
org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationType.RATIS;
@@ -79,7 +75,6 @@ import static 
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_DATANODE_PIPELINE_L
 import static org.apache.hadoop.hdds.scm.net.NetConstants.LEAF_SCHEMA;
 import static org.apache.hadoop.hdds.scm.net.NetConstants.RACK_SCHEMA;
 import static org.apache.hadoop.hdds.scm.net.NetConstants.ROOT_SCHEMA;
-import static org.junit.Assert.assertFalse;
 
 /**
  * Test for PipelinePlacementPolicy.
@@ -99,7 +94,7 @@ public class TestPipelinePlacementPolicy {
   private List<DatanodeDetails> nodesWithOutRackAwareness = new ArrayList<>();
   private List<DatanodeDetails> nodesWithRackAwareness = new ArrayList<>();
 
-  @Before
+  @BeforeEach
   public void init() throws Exception {
     cluster = initTopology();
     // start with nodes with rack awareness.
@@ -126,7 +121,7 @@ public class TestPipelinePlacementPolicy {
         nodeManager, stateManager, conf);
   }
 
-  @After
+  @AfterEach
   public void cleanup() throws Exception {
     if (dbStore != null) {
       dbStore.close();
@@ -168,7 +163,7 @@ public class TestPipelinePlacementPolicy {
   public void testChooseNodeBasedOnNetworkTopology() {
     DatanodeDetails anchor = 
placementPolicy.chooseNode(nodesWithRackAwareness);
     // anchor should be removed from healthyNodes after being chosen.
-    Assert.assertFalse(nodesWithRackAwareness.contains(anchor));
+    Assertions.assertFalse(nodesWithRackAwareness.contains(anchor));
 
     List<DatanodeDetails> excludedNodes =
         new ArrayList<>(PIPELINE_PLACEMENT_MAX_NODES_COUNT);
@@ -178,11 +173,11 @@ public class TestPipelinePlacementPolicy {
         nodeManager.getClusterNetworkTopologyMap(), anchor);
     //DatanodeDetails nextNode = placementPolicy.chooseNodeFromNetworkTopology(
     //    nodeManager.getClusterNetworkTopologyMap(), anchor, excludedNodes);
-    Assert.assertFalse(excludedNodes.contains(nextNode));
+    Assertions.assertFalse(excludedNodes.contains(nextNode));
     // next node should not be the same as anchor.
-    Assert.assertTrue(anchor.getUuid() != nextNode.getUuid());
+    Assertions.assertNotSame(anchor.getUuid(), nextNode.getUuid());
     // next node should be on the same rack based on topology.
-    Assert.assertEquals(anchor.getNetworkLocation(),
+    Assertions.assertEquals(anchor.getNetworkLocation(),
         nextNode.getNetworkLocation());
   }
 
@@ -213,13 +208,13 @@ public class TestPipelinePlacementPolicy {
         new ArrayList<>(datanodes.size()),
         nodesRequired, 0, 0);
 
-    Assert.assertEquals(nodesRequired, results.size());
+    Assertions.assertEquals(nodesRequired, results.size());
     // 3 nodes should be on different racks.
-    Assert.assertNotEquals(results.get(0).getNetworkLocation(),
+    Assertions.assertNotEquals(results.get(0).getNetworkLocation(),
         results.get(1).getNetworkLocation());
-    Assert.assertNotEquals(results.get(0).getNetworkLocation(),
+    Assertions.assertNotEquals(results.get(0).getNetworkLocation(),
         results.get(2).getNetworkLocation());
-    Assert.assertNotEquals(results.get(1).getNetworkLocation(),
+    Assertions.assertNotEquals(results.get(1).getNetworkLocation(),
         results.get(2).getNetworkLocation());
   }
 
@@ -253,9 +248,9 @@ public class TestPipelinePlacementPolicy {
       localPlacementPolicy.chooseDatanodes(new ArrayList<>(datanodes.size()),
           new ArrayList<>(datanodes.size()), nodesRequired,
           0, 10 * OzoneConsts.TB);
-      Assert.fail("SCMException should have been thrown.");
+      Assertions.fail("SCMException should have been thrown.");
     } catch (SCMException ex) {
-      Assert.assertTrue(ex.getMessage().contains(expectedMessageSubstring));
+      
Assertions.assertTrue(ex.getMessage().contains(expectedMessageSubstring));
     }
 
     try {
@@ -263,9 +258,9 @@ public class TestPipelinePlacementPolicy {
       localPlacementPolicy.chooseDatanodes(new ArrayList<>(datanodes.size()),
           new ArrayList<>(datanodes.size()), nodesRequired, 10 * 
OzoneConsts.TB,
           0);
-      Assert.fail("SCMException should have been thrown.");
+      Assertions.fail("SCMException should have been thrown.");
     } catch (SCMException ex) {
-      Assert.assertTrue(ex.getMessage().contains(expectedMessageSubstring));
+      
Assertions.assertTrue(ex.getMessage().contains(expectedMessageSubstring));
     }
   }
 
@@ -302,12 +297,12 @@ public class TestPipelinePlacementPolicy {
     int averageLoadOnNode = maxPipelineCount *
         HddsProtos.ReplicationFactor.THREE.getNumber() / healthyNodes.size();
     for (DatanodeDetails node : healthyNodes) {
-      Assert.assertTrue(nodeManager.getPipelinesCount(node)
+      Assertions.assertTrue(nodeManager.getPipelinesCount(node)
           >= averageLoadOnNode);
     }
     
     // Should max out pipeline usage.
-    Assert.assertEquals(maxPipelineCount,
+    Assertions.assertEquals(maxPipelineCount,
         stateManager
             .getPipelines(RatisReplicationConfig
                 .getInstance(ReplicationFactor.THREE))
@@ -324,9 +319,9 @@ public class TestPipelinePlacementPolicy {
     DatanodeDetails nextNode = placementPolicy.chooseNodeBasedOnRackAwareness(
         healthyNodes, new ArrayList<>(PIPELINE_PLACEMENT_MAX_NODES_COUNT),
         topologyWithDifRacks, anchor);
-    Assert.assertNotNull(nextNode);
+    Assertions.assertNotNull(nextNode);
     // next node should be on a different rack.
-    Assert.assertNotEquals(anchor.getNetworkLocation(),
+    Assertions.assertNotEquals(anchor.getNetworkLocation(),
         nextNode.getNetworkLocation());
   }
 
@@ -338,12 +333,12 @@ public class TestPipelinePlacementPolicy {
 
     // test no nodes are excluded
     node = placementPolicy.fallBackPickNodes(healthyNodes, null);
-    Assert.assertNotNull(node);
+    Assertions.assertNotNull(node);
 
     // when input nodeSet are all excluded.
     List<DatanodeDetails> exclude = healthyNodes;
     node = placementPolicy.fallBackPickNodes(healthyNodes, exclude);
-    Assert.assertNull(node);
+    Assertions.assertNull(node);
 
   }
 
@@ -354,8 +349,8 @@ public class TestPipelinePlacementPolicy {
     DatanodeDetails randomNode = placementPolicy
         .chooseNode(nodesWithOutRackAwareness);
     // rack awareness is not enabled.
-    Assert.assertTrue(anchor.getNetworkLocation().equals(
-        randomNode.getNetworkLocation()));
+    Assertions.assertEquals(anchor.getNetworkLocation(),
+        randomNode.getNetworkLocation());
 
     NetworkTopology topology =
         new NetworkTopologyImpl(new OzoneConfiguration());
@@ -363,18 +358,18 @@ public class TestPipelinePlacementPolicy {
         nodesWithOutRackAwareness, new ArrayList<>(
             PIPELINE_PLACEMENT_MAX_NODES_COUNT), topology, anchor);
     // RackAwareness should not be able to choose any node.
-    Assert.assertNull(nextNode);
+    Assertions.assertNull(nextNode);
 
     // PlacementPolicy should still be able to pick a set of 3 nodes.
     int numOfNodes = HddsProtos.ReplicationFactor.THREE.getNumber();
     List<DatanodeDetails> results = placementPolicy
         .getResultSet(numOfNodes, nodesWithOutRackAwareness);
     
-    Assert.assertEquals(numOfNodes, results.size());
+    Assertions.assertEquals(numOfNodes, results.size());
     // All nodes are on same rack.
-    Assert.assertEquals(results.get(0).getNetworkLocation(),
+    Assertions.assertEquals(results.get(0).getNetworkLocation(),
         results.get(1).getNetworkLocation());
-    Assert.assertEquals(results.get(0).getNetworkLocation(),
+    Assertions.assertEquals(results.get(0).getNetworkLocation(),
         results.get(2).getNetworkLocation());
   }
 
@@ -444,27 +439,19 @@ public class TestPipelinePlacementPolicy {
     // modify node to pipeline mapping.
     insertHeavyNodesIntoNodeManager(healthyNodes, minorityHeavy);
     // NODES should be sufficient.
-    Assert.assertEquals(nodesRequired, pickedNodes1.size());
+    Assertions.assertEquals(nodesRequired, pickedNodes1.size());
     // make sure pipeline placement policy won't select duplicated NODES.
-    Assert.assertTrue(checkDuplicateNodesUUID(pickedNodes1));
+    Assertions.assertTrue(checkDuplicateNodesUUID(pickedNodes1));
 
     // majority of healthy NODES are heavily engaged in pipelines.
     int majorityHeavy = healthyNodes.size() / 2 + 2;
     insertHeavyNodesIntoNodeManager(healthyNodes, majorityHeavy);
-    boolean thrown = false;
-    List<DatanodeDetails> pickedNodes2 = null;
-    try {
-      pickedNodes2 = placementPolicy.chooseDatanodes(
-          new ArrayList<>(PIPELINE_PLACEMENT_MAX_NODES_COUNT),
-          new ArrayList<>(PIPELINE_PLACEMENT_MAX_NODES_COUNT),
-          nodesRequired, 0, 0);
-    } catch (SCMException e) {
-      Assert.assertFalse(thrown);
-      thrown = true;
-    }
     // NODES should NOT be sufficient and exception should be thrown.
-    Assert.assertNull(pickedNodes2);
-    Assert.assertTrue(thrown);
+    Assertions.assertThrows(SCMException.class, () ->
+        placementPolicy.chooseDatanodes(
+            new ArrayList<>(PIPELINE_PLACEMENT_MAX_NODES_COUNT),
+            new ArrayList<>(PIPELINE_PLACEMENT_MAX_NODES_COUNT),
+            nodesRequired, 0, 0));
   }
 
   @Test
@@ -476,20 +463,12 @@ public class TestPipelinePlacementPolicy {
     // majority of healthy NODES are heavily engaged in pipelines.
     int majorityHeavy = healthyNodes.size() / 2 + 2;
     insertHeavyNodesIntoNodeManager(healthyNodes, majorityHeavy);
-    boolean thrown = false;
-    List<DatanodeDetails> pickedNodes2 = null;
-    try {
-      pickedNodes2 = placementPolicy.chooseDatanodes(
-          new ArrayList<>(PIPELINE_PLACEMENT_MAX_NODES_COUNT),
-          new ArrayList<>(PIPELINE_PLACEMENT_MAX_NODES_COUNT),
-          nodesRequired, 0, 0);
-    } catch (SCMException e) {
-      Assert.assertFalse(thrown);
-      thrown = true;
-    }
     // NODES should NOT be sufficient and exception should be thrown.
-    Assert.assertNull(pickedNodes2);
-    Assert.assertTrue(thrown);
+    Assertions.assertThrows(SCMException.class, () ->
+        placementPolicy.chooseDatanodes(
+            new ArrayList<>(PIPELINE_PLACEMENT_MAX_NODES_COUNT),
+            new ArrayList<>(PIPELINE_PLACEMENT_MAX_NODES_COUNT),
+            nodesRequired, 0, 0));
   }
 
   @Test
@@ -512,8 +491,8 @@ public class TestPipelinePlacementPolicy {
     }
     ContainerPlacementStatus status =
         placementPolicy.validateContainerPlacement(dns, 3);
-    assertTrue(status.isPolicySatisfied());
-    assertEquals(0, status.misReplicationCount());
+    Assertions.assertTrue(status.isPolicySatisfied());
+    Assertions.assertEquals(0, status.misReplicationCount());
 
 
     List<DatanodeDetails> subSet = new ArrayList<>();
@@ -521,22 +500,22 @@ public class TestPipelinePlacementPolicy {
     subSet.add(dns.get(0));
     subSet.add(dns.get(2));
     status = placementPolicy.validateContainerPlacement(subSet, 3);
-    assertTrue(status.isPolicySatisfied());
-    assertEquals(0, status.misReplicationCount());
+    Assertions.assertTrue(status.isPolicySatisfied());
+    Assertions.assertEquals(0, status.misReplicationCount());
 
     // Cut it down to two nodes, one racks
     subSet = new ArrayList<>();
     subSet.add(dns.get(0));
     subSet.add(dns.get(1));
     status = placementPolicy.validateContainerPlacement(subSet, 3);
-    assertFalse(status.isPolicySatisfied());
-    assertEquals(1, status.misReplicationCount());
+    Assertions.assertFalse(status.isPolicySatisfied());
+    Assertions.assertEquals(1, status.misReplicationCount());
 
     // One node, but only one replica
     subSet = new ArrayList<>();
     subSet.add(dns.get(0));
     status = placementPolicy.validateContainerPlacement(subSet, 1);
-    assertTrue(status.isPolicySatisfied());
+    Assertions.assertTrue(status.isPolicySatisfied());
   }
 
   @Test
@@ -559,8 +538,8 @@ public class TestPipelinePlacementPolicy {
     }
     ContainerPlacementStatus status =
         placementPolicy.validateContainerPlacement(dns, 3);
-    assertTrue(status.isPolicySatisfied());
-    assertEquals(0, status.misReplicationCount());
+    Assertions.assertTrue(status.isPolicySatisfied());
+    Assertions.assertEquals(0, status.misReplicationCount());
   }
 
   @Test
@@ -577,20 +556,15 @@ public class TestPipelinePlacementPolicy {
     List<DatanodeDetails> pickedDns =  placementPolicy.chooseDatanodes(
         new ArrayList<>(), new ArrayList<>(), nodesRequired, 0, 0);
 
-    assertEquals(3, pickedDns.size());
-    assertTrue(pickedDns.contains(dns.get(1)));
-    assertTrue(pickedDns.contains(dns.get(2)));
-    assertTrue(pickedDns.contains(dns.get(3)));
+    Assertions.assertEquals(3, pickedDns.size());
+    Assertions.assertTrue(pickedDns.contains(dns.get(1)));
+    Assertions.assertTrue(pickedDns.contains(dns.get(2)));
+    Assertions.assertTrue(pickedDns.contains(dns.get(3)));
   }
 
-  @Rule
-  public ExpectedException thrownExp = ExpectedException.none();
-
   @Test
   public void testExceptionIsThrownWhenRackAwarePipelineCanNotBeCreated()
       throws Exception {
-    thrownExp.expect(SCMException.class);
-    
thrownExp.expectMessage(PipelinePlacementPolicy.MULTIPLE_RACK_PIPELINE_MSG);
 
     List<DatanodeDetails> dns = setupSkewedRacks();
 
@@ -599,15 +573,16 @@ public class TestPipelinePlacementPolicy {
     insertHeavyNodesIntoNodeManager(dns, 1);
     int nodesRequired = HddsProtos.ReplicationFactor.THREE.getNumber();
 
-    placementPolicy.chooseDatanodes(
-        new ArrayList<>(), new ArrayList<>(), nodesRequired, 0, 0);
+    Throwable t = Assertions.assertThrows(SCMException.class, () ->
+        placementPolicy.chooseDatanodes(
+            new ArrayList<>(), new ArrayList<>(), nodesRequired, 0, 0));
+    Assertions.assertEquals(PipelinePlacementPolicy.MULTIPLE_RACK_PIPELINE_MSG,
+        t.getMessage());
   }
 
   @Test
   public void testExceptionThrownRackAwarePipelineCanNotBeCreatedExcludedNode()
       throws Exception {
-    thrownExp.expect(SCMException.class);
-    
thrownExp.expectMessage(PipelinePlacementPolicy.MULTIPLE_RACK_PIPELINE_MSG);
 
     List<DatanodeDetails> dns = setupSkewedRacks();
 
@@ -618,8 +593,11 @@ public class TestPipelinePlacementPolicy {
 
     List<DatanodeDetails> excluded = new ArrayList<>();
     excluded.add(dns.get(0));
-    placementPolicy.chooseDatanodes(
-        excluded, new ArrayList<>(), nodesRequired, 0, 0);
+    Throwable t = Assertions.assertThrows(SCMException.class, () ->
+        placementPolicy.chooseDatanodes(
+            excluded, new ArrayList<>(), nodesRequired, 0, 0));
+    Assertions.assertEquals(PipelinePlacementPolicy.MULTIPLE_RACK_PIPELINE_MSG,
+        t.getMessage());
   }
 
   private List<DatanodeDetails> setupSkewedRacks() {
@@ -713,7 +691,7 @@ public class TestPipelinePlacementPolicy {
 
     pipelineCount
         = placementPolicy.currentRatisThreePipelineCount(healthyNodes.get(0));
-    assertEquals(pipelineCount, 0);
+    Assertions.assertEquals(pipelineCount, 0);
 
     // Check datanode with one RATIS/ONE pipeline
     List<DatanodeDetails> ratisOneDn = new ArrayList<>();
@@ -722,7 +700,7 @@ public class TestPipelinePlacementPolicy {
 
     pipelineCount
         = placementPolicy.currentRatisThreePipelineCount(healthyNodes.get(1));
-    assertEquals(pipelineCount, 0);
+    Assertions.assertEquals(pipelineCount, 0);
 
     // Check datanode with one RATIS/THREE pipeline
     List<DatanodeDetails> ratisThreeDn = new ArrayList<>();
@@ -733,7 +711,7 @@ public class TestPipelinePlacementPolicy {
 
     pipelineCount
         = placementPolicy.currentRatisThreePipelineCount(healthyNodes.get(2));
-    assertEquals(pipelineCount, 1);
+    Assertions.assertEquals(pipelineCount, 1);
 
     // Check datanode with one RATIS/ONE and one STANDALONE/ONE pipeline
     standaloneOneDn = new ArrayList<>();
@@ -742,7 +720,7 @@ public class TestPipelinePlacementPolicy {
 
     pipelineCount
         = placementPolicy.currentRatisThreePipelineCount(healthyNodes.get(1));
-    assertEquals(pipelineCount, 0);
+    Assertions.assertEquals(pipelineCount, 0);
 
     // Check datanode with one RATIS/ONE and one STANDALONE/ONE pipeline and
     // two RATIS/THREE pipelines
@@ -755,7 +733,7 @@ public class TestPipelinePlacementPolicy {
 
     pipelineCount
         = placementPolicy.currentRatisThreePipelineCount(healthyNodes.get(1));
-    assertEquals(pipelineCount, 2);
+    Assertions.assertEquals(pipelineCount, 2);
   }
 
   private void createPipelineWithReplicationConfig(List<DatanodeDetails> 
dnList,
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestOneReplicaPipelineSafeModeRule.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestOneReplicaPipelineSafeModeRule.java
index 152a4ea42f..befc7d09d3 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestOneReplicaPipelineSafeModeRule.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestOneReplicaPipelineSafeModeRule.java
@@ -17,6 +17,7 @@
 
 package org.apache.hadoop.hdds.scm.safemode;
 
+import java.nio.file.Path;
 import java.time.Instant;
 import java.time.ZoneOffset;
 import java.util.ArrayList;
@@ -52,10 +53,9 @@ import org.apache.hadoop.hdds.server.events.EventQueue;
 import org.apache.ozone.test.GenericTestUtils;
 
 import org.apache.ozone.test.TestClock;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 import org.slf4j.LoggerFactory;
 
 /**
@@ -63,8 +63,8 @@ import org.slf4j.LoggerFactory;
  */
 public class TestOneReplicaPipelineSafeModeRule {
 
-  @Rule
-  public TemporaryFolder folder = new TemporaryFolder();
+  @TempDir
+  private Path tempDir;
   private OneReplicaPipelineSafeModeRule rule;
   private PipelineManagerImpl pipelineManager;
   private EventQueue eventQueue;
@@ -78,7 +78,7 @@ public class TestOneReplicaPipelineSafeModeRule {
     ozoneConfiguration.setBoolean(
         HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK, true);
     ozoneConfiguration.set(HddsConfigKeys.OZONE_METADATA_DIRS,
-        folder.newFolder().toString());
+        tempDir.toString());
     ozoneConfiguration.setBoolean(
         HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION, false);
 
@@ -103,7 +103,7 @@ public class TestOneReplicaPipelineSafeModeRule {
         serviceManager,
         new TestClock(Instant.now(), ZoneOffset.UTC));
 
-    PipelineProvider mockRatisProvider =
+    PipelineProvider<RatisReplicationConfig> mockRatisProvider =
         new MockRatisPipelineProvider(mockNodeManager,
             pipelineManager.getStateManager(), ozoneConfiguration);
     pipelineManager.setPipelineProvider(HddsProtos.ReplicationType.RATIS,
@@ -145,7 +145,7 @@ public class TestOneReplicaPipelineSafeModeRule {
     GenericTestUtils.waitFor(() -> logCapturer.getOutput().contains(
         "reported count is 6"), 1000, 5000);
 
-    Assert.assertFalse(rule.validate());
+    Assertions.assertFalse(rule.validate());
 
     //Fire last pipeline event from datanode.
     firePipelineEvent(pipelines.subList(pipelineFactorThreeCount - 1,
@@ -179,7 +179,7 @@ public class TestOneReplicaPipelineSafeModeRule {
         "reported count is 0"), 1000, 5000);
 
     // fired events for one node ratis pipeline, so we will be still false.
-    Assert.assertFalse(rule.validate());
+    Assertions.assertFalse(rule.validate());
 
     pipelines =
         pipelineManager.getPipelines(
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestSCMSafeModeManager.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestSCMSafeModeManager.java
index c9197ed6d7..4d2a0a767c 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestSCMSafeModeManager.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/safemode/TestSCMSafeModeManager.java
@@ -19,6 +19,7 @@ package org.apache.hadoop.hdds.scm.safemode;
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Path;
 import java.time.ZoneOffset;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -57,21 +58,22 @@ import org.apache.hadoop.hdds.server.events.EventQueue;
 import org.apache.hadoop.ozone.common.MonotonicClock;
 import org.apache.ozone.test.GenericTestUtils;
 
-import org.junit.After;
-import org.junit.Assert;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.junit.rules.Timeout;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.api.io.TempDir;
 import org.mockito.Mockito;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
 /** Test class for SCMSafeModeManager.
  */
+@Timeout(300)
 public class TestSCMSafeModeManager {
 
   private EventQueue queue;
@@ -81,32 +83,22 @@ public class TestSCMSafeModeManager {
   private OzoneConfiguration config;
   private List<ContainerInfo> containers = Collections.emptyList();
 
-  @Rule
-  public Timeout timeout = Timeout.seconds(300);
-
-  @Rule
-  public final TemporaryFolder tempDir = new TemporaryFolder();
-
   private SCMMetadataStore scmMetadataStore;
 
-  @Before
-  public void setUp() {
+  @BeforeEach
+  public void setUp(@TempDir Path tempDir) throws IOException {
     queue = new EventQueue();
     scmContext = SCMContext.emptyContext();
     serviceManager = new SCMServiceManager();
     config = new OzoneConfiguration();
     config.setBoolean(HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION,
         false);
-  }
-
-  @Before
-  public void initDbStore() throws IOException {
     config.set(HddsConfigKeys.OZONE_METADATA_DIRS,
-        tempDir.newFolder().getAbsolutePath());
+        tempDir.toAbsolutePath().toString());
     scmMetadataStore = new SCMMetadataStoreImpl(config);
   }
 
-  @After
+  @AfterEach
   public void destroyDbStore() throws Exception {
     if (scmMetadataStore.getStore() != null) {
       scmMetadataStore.getStore().close();
@@ -132,7 +124,7 @@ public class TestSCMSafeModeManager {
     containers = new ArrayList<>();
     containers.addAll(HddsTestUtils.getContainerInfo(numContainers));
 
-    // Currently only considered containers which are not in open state.
+    // Currently, only considered containers which are not in open state.
     for (ContainerInfo container : containers) {
       container.setState(HddsProtos.LifeCycleState.CLOSED);
     }
@@ -148,14 +140,13 @@ public class TestSCMSafeModeManager {
         HddsConfigKeys.HDDS_SCM_SAFEMODE_THRESHOLD_PCT,
         HddsConfigKeys.HDDS_SCM_SAFEMODE_THRESHOLD_PCT_DEFAULT));
 
-    Assert.assertEquals(cutOff, scmSafeModeManager.getSafeModeMetrics()
+    assertEquals(cutOff, scmSafeModeManager.getSafeModeMetrics()
         .getNumContainerWithOneReplicaReportedThreshold().value());
 
-    GenericTestUtils.waitFor(() -> {
-      return !scmSafeModeManager.getInSafeMode();
-    }, 100, 1000 * 5);
+    GenericTestUtils.waitFor(() -> !scmSafeModeManager.getInSafeMode(),
+        100, 1000 * 5);
 
-    Assert.assertEquals(cutOff, scmSafeModeManager.getSafeModeMetrics()
+    assertEquals(cutOff, scmSafeModeManager.getSafeModeMetrics()
         .getCurrentContainersWithOneReplicaReportedCount().value());
 
   }
@@ -178,38 +169,35 @@ public class TestSCMSafeModeManager {
         HddsConfigKeys.HDDS_SCM_SAFEMODE_THRESHOLD_PCT,
         HddsConfigKeys.HDDS_SCM_SAFEMODE_THRESHOLD_PCT_DEFAULT));
 
-    Assert.assertEquals(cutOff, scmSafeModeManager.getSafeModeMetrics()
+    assertEquals(cutOff, scmSafeModeManager.getSafeModeMetrics()
         .getNumContainerWithOneReplicaReportedThreshold().value());
 
     assertTrue(scmSafeModeManager.getInSafeMode());
 
     testContainerThreshold(containers.subList(0, 25), 0.25);
-    Assert.assertEquals(25, scmSafeModeManager.getSafeModeMetrics()
+    assertEquals(25, scmSafeModeManager.getSafeModeMetrics()
         .getCurrentContainersWithOneReplicaReportedCount().value());
     assertTrue(scmSafeModeManager.getInSafeMode());
     testContainerThreshold(containers.subList(25, 50), 0.50);
-    Assert.assertEquals(50, scmSafeModeManager.getSafeModeMetrics()
+    assertEquals(50, scmSafeModeManager.getSafeModeMetrics()
         .getCurrentContainersWithOneReplicaReportedCount().value());
     assertTrue(scmSafeModeManager.getInSafeMode());
     testContainerThreshold(containers.subList(50, 75), 0.75);
-    Assert.assertEquals(75, scmSafeModeManager.getSafeModeMetrics()
+    assertEquals(75, scmSafeModeManager.getSafeModeMetrics()
         .getCurrentContainersWithOneReplicaReportedCount().value());
     assertTrue(scmSafeModeManager.getInSafeMode());
     testContainerThreshold(containers.subList(75, 100), 1.0);
-    Assert.assertEquals(100, scmSafeModeManager.getSafeModeMetrics()
+    assertEquals(100, scmSafeModeManager.getSafeModeMetrics()
         .getCurrentContainersWithOneReplicaReportedCount().value());
 
-    GenericTestUtils.waitFor(() -> {
-      return !scmSafeModeManager.getInSafeMode();
-    }, 100, 1000 * 5);
+    GenericTestUtils.waitFor(() -> !scmSafeModeManager.getInSafeMode(),
+        100, 1000 * 5);
   }
 
 
   private OzoneConfiguration createConf(double healthyPercent,
-      double oneReplicaPercent) throws Exception {
-    OzoneConfiguration conf = new OzoneConfiguration();
-    conf.set(HddsConfigKeys.OZONE_METADATA_DIRS,
-        tempDir.newFolder().toString());
+      double oneReplicaPercent) {
+    OzoneConfiguration conf = new OzoneConfiguration(config);
     conf.setBoolean(
         HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_AVAILABILITY_CHECK,
         true);
@@ -217,7 +205,6 @@ public class TestSCMSafeModeManager {
         HDDS_SCM_SAFEMODE_HEALTHY_PIPELINE_THRESHOLD_PCT, healthyPercent);
     conf.setDouble(HddsConfigKeys.
         HDDS_SCM_SAFEMODE_ONE_NODE_REPORTED_PIPELINE_PCT, oneReplicaPercent);
-    conf.setBoolean(HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION, false);
     return conf;
   }
 
@@ -354,7 +341,7 @@ public class TestSCMSafeModeManager {
             scmContext,
             serviceManager,
             new MonotonicClock(ZoneOffset.UTC));
-    PipelineProvider mockRatisProvider =
+    PipelineProvider<RatisReplicationConfig> mockRatisProvider =
         new MockRatisPipelineProvider(mockNodeManager,
             pipelineManager.getStateManager(), config);
     pipelineManager.setPipelineProvider(HddsProtos.ReplicationType.RATIS,
@@ -394,11 +381,11 @@ public class TestSCMSafeModeManager {
         scmSafeModeManager.getOneReplicaPipelineSafeModeRule()
             .getThresholdCount();
 
-    Assert.assertEquals(healthyPipelineThresholdCount,
+    assertEquals(healthyPipelineThresholdCount,
         scmSafeModeManager.getSafeModeMetrics()
             .getNumHealthyPipelinesThreshold().value());
 
-    Assert.assertEquals(oneReplicaThresholdCount,
+    assertEquals(oneReplicaThresholdCount,
         scmSafeModeManager.getSafeModeMetrics()
             .getNumPipelinesWithAtleastOneReplicaReportedThreshold().value());
 
@@ -415,31 +402,30 @@ public class TestSCMSafeModeManager {
 
       if (i < healthyPipelineThresholdCount) {
         checkHealthy(i + 1);
-        Assert.assertEquals(i + 1,
+        assertEquals(i + 1,
             scmSafeModeManager.getSafeModeMetrics()
                 .getCurrentHealthyPipelinesCount().value());
       }
 
       if (i < oneReplicaThresholdCount) {
         checkOpen(i + 1);
-        Assert.assertEquals(i + 1,
+        assertEquals(i + 1,
             scmSafeModeManager.getSafeModeMetrics()
                 .getCurrentPipelinesWithAtleastOneReplicaCount().value());
       }
     }
 
-    Assert.assertEquals(healthyPipelineThresholdCount,
+    assertEquals(healthyPipelineThresholdCount,
         scmSafeModeManager.getSafeModeMetrics()
             .getCurrentHealthyPipelinesCount().value());
 
-    Assert.assertEquals(oneReplicaThresholdCount,
+    assertEquals(oneReplicaThresholdCount,
         scmSafeModeManager.getSafeModeMetrics()
             .getCurrentPipelinesWithAtleastOneReplicaCount().value());
 
 
-    GenericTestUtils.waitFor(() -> {
-      return !scmSafeModeManager.getInSafeMode();
-    }, 100, 1000 * 5);
+    GenericTestUtils.waitFor(() -> !scmSafeModeManager.getInSafeMode(),
+        100, 1000 * 5);
   }
 
   private void checkHealthy(int expectedCount) throws Exception {
@@ -486,7 +472,7 @@ public class TestSCMSafeModeManager {
 
 
   @Test
-  public void testDisableSafeMode() throws IOException {
+  public void testDisableSafeMode() {
     OzoneConfiguration conf = new OzoneConfiguration(config);
     conf.setBoolean(HddsConfigKeys.HDDS_SCM_SAFEMODE_ENABLED, false);
     PipelineManager pipelineManager = Mockito.mock(PipelineManager.class);
@@ -514,7 +500,7 @@ public class TestSCMSafeModeManager {
     containers = new ArrayList<>();
     // Add 100 containers to the list of containers in SCM
     containers.addAll(HddsTestUtils.getContainerInfo(25 * 4));
-    // Assign CLOSED state to first 25 containers and OPEM state to rest
+    // Assign CLOSED state to first 25 containers and OPEN state to rest
     // of the containers
     for (ContainerInfo container : containers.subList(0, 25)) {
       container.setState(HddsProtos.LifeCycleState.CLOSED);
@@ -539,9 +525,8 @@ public class TestSCMSafeModeManager {
     // threshold should be (10+15)/25.
     testContainerThreshold(containers.subList(10, 25), 1.0);
 
-    GenericTestUtils.waitFor(() -> {
-      return !scmSafeModeManager.getInSafeMode();
-    }, 100, 1000 * 5);
+    GenericTestUtils.waitFor(() -> !scmSafeModeManager.getInSafeMode(),
+        100, 1000 * 5);
   }
 
   private void testSafeModeDataNodes(int numOfDns) throws Exception {
@@ -559,21 +544,19 @@ public class TestSCMSafeModeManager {
       queue.fireEvent(SCMEvents.NODE_REGISTRATION_CONT_REPORT,
           HddsTestUtils.createNodeRegistrationContainerReport(containers));
       assertTrue(scmSafeModeManager.getInSafeMode());
-      assertTrue(scmSafeModeManager.getCurrentContainerThreshold() == 1);
+      assertEquals(1, scmSafeModeManager.getCurrentContainerThreshold());
     }
 
     if (numOfDns == 0) {
-      GenericTestUtils.waitFor(() -> {
-        return scmSafeModeManager.getInSafeMode();
-      }, 10, 1000 * 10);
+      GenericTestUtils.waitFor(() -> scmSafeModeManager.getInSafeMode(),
+          10, 1000 * 10);
       return;
     }
     // Register last DataNode and check that SCM is out of Safe mode.
     queue.fireEvent(SCMEvents.NODE_REGISTRATION_CONT_REPORT,
         HddsTestUtils.createNodeRegistrationContainerReport(containers));
-    GenericTestUtils.waitFor(() -> {
-      return !scmSafeModeManager.getInSafeMode();
-    }, 10, 1000 * 10);
+    GenericTestUtils.waitFor(() -> !scmSafeModeManager.getInSafeMode(),
+        10, 1000 * 10);
   }
 
   private void testContainerThreshold(List<ContainerInfo> dnContainers,
@@ -611,7 +594,7 @@ public class TestSCMSafeModeManager {
               serviceManager,
               new MonotonicClock(ZoneOffset.UTC));
 
-      PipelineProvider mockRatisProvider =
+      PipelineProvider<RatisReplicationConfig> mockRatisProvider =
           new MockRatisPipelineProvider(nodeManager,
               pipelineManager.getStateManager(), config);
       pipelineManager.setPipelineProvider(HddsProtos.ReplicationType.RATIS,
@@ -634,9 +617,8 @@ public class TestSCMSafeModeManager {
 
       firePipelineEvent(pipelineManager, pipeline);
 
-      GenericTestUtils.waitFor(() -> {
-        return !scmSafeModeManager.getInSafeMode();
-      }, 100, 1000 * 10);
+      GenericTestUtils.waitFor(() -> !scmSafeModeManager.getInSafeMode(),
+          100, 1000 * 10);
       pipelineManager.close();
     } finally {
       config.setBoolean(
@@ -647,7 +629,7 @@ public class TestSCMSafeModeManager {
   }
 
   @Test
-  @Ignore("The test is failing, enable after fixing it")
+  @Disabled("The test is failing, enable after fixing it")
   public void testPipelinesNotCreatedUntilPreCheckPasses()
       throws Exception {
     int numOfDns = 5;
@@ -677,7 +659,7 @@ public class TestSCMSafeModeManager {
             serviceManager,
             new MonotonicClock(ZoneOffset.UTC));
 
-    PipelineProvider mockRatisProvider =
+    PipelineProvider<RatisReplicationConfig> mockRatisProvider =
         new MockRatisPipelineProvider(nodeManager,
             pipelineManager.getStateManager(), config);
     pipelineManager.setPipelineProvider(HddsProtos.ReplicationType.RATIS,
@@ -700,17 +682,17 @@ public class TestSCMSafeModeManager {
       assertFalse(scmSafeModeManager.getPreCheckComplete());
     }
     queue.processAll(5000);
-    Assert.assertEquals(0, smHandler.getInvokedCount());
+    assertEquals(0, smHandler.getInvokedCount());
 
     // Register last DataNode and check that the SafeModeEvent gets fired, but
-    // safemode is still enabled with preCheck completed.
+    // SafeMode is still enabled with preCheck completed.
     queue.fireEvent(SCMEvents.NODE_REGISTRATION_CONT_REPORT,
         HddsTestUtils.createNodeRegistrationContainerReport(containers));
     queue.processAll(5000);
 
-    Assert.assertEquals(1, smHandler.getInvokedCount());
-    Assert.assertEquals(true, smHandler.getPreCheckComplete());
-    Assert.assertEquals(true, smHandler.getIsInSafeMode());
+    assertEquals(1, smHandler.getInvokedCount());
+    assertTrue(smHandler.getPreCheckComplete());
+    assertTrue(smHandler.getIsInSafeMode());
 
     /* There is a race condition where the background pipeline creation
      * task creates the pipeline before the following create call.
@@ -734,9 +716,9 @@ public class TestSCMSafeModeManager {
     firePipelineEvent(pipelineManager, pipeline);
 
     queue.processAll(5000);
-    Assert.assertEquals(2, smHandler.getInvokedCount());
-    Assert.assertEquals(true, smHandler.getPreCheckComplete());
-    Assert.assertEquals(false, smHandler.getIsInSafeMode());
+    assertEquals(2, smHandler.getInvokedCount());
+    assertTrue(smHandler.getPreCheckComplete());
+    assertFalse(smHandler.getIsInSafeMode());
   }
 
   private static class SafeModeEventHandler
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMCertStore.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMCertStore.java
index 7ad118ca9c..f607791e4a 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMCertStore.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMCertStore.java
@@ -32,17 +32,16 @@ import org.apache.hadoop.hdds.security.x509.crl.CRLInfo;
 import org.apache.hadoop.security.ssl.KeyStoreTestUtil;
 import org.bouncycastle.asn1.x509.CRLReason;
 import org.bouncycastle.cert.X509CertificateHolder;
-import org.junit.After;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeType;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+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.junit.jupiter.api.io.TempDir;
 
-import java.io.IOException;
 import java.math.BigInteger;
 import java.nio.file.Files;
+import java.nio.file.Path;
 import java.security.KeyPair;
 import java.security.cert.X509CRLEntry;
 import java.security.cert.X509Certificate;
@@ -58,11 +57,11 @@ import static 
org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeType.DATANODE
 import static org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeType.OM;
 import static org.apache.hadoop.hdds.protocol.proto.HddsProtos.NodeType.SCM;
 import static 
org.apache.hadoop.hdds.security.x509.certificate.authority.CertificateStore.CertType.VALID_CERTS;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.apache.hadoop.ozone.OzoneConsts.CRL_SEQUENCE_ID_KEY;
 
 /**
@@ -81,42 +80,30 @@ public class TestSCMCertStore {
   private KeyPair keyPair;
   private CRLApprover crlApprover;
 
-  @Rule
-  public final TemporaryFolder tempDir = new TemporaryFolder();
-
-  @Before
-  public void setUp() throws Exception {
+  @BeforeEach
+  public void setUp(@TempDir Path tempDir) throws Exception {
     config = new OzoneConfiguration();
 
     config.set(HddsConfigKeys.OZONE_METADATA_DIRS,
-        tempDir.newFolder().getAbsolutePath());
+        tempDir.toAbsolutePath().toString());
 
     securityConfig = new SecurityConfig(config);
     keyPair = KeyStoreTestUtil.generateKeyPair("RSA");
-  }
 
-  @Before
-  public void initDbStore() throws IOException {
     scmMetadataStore = new SCMMetadataStoreImpl(config);
     scmCertStore = new SCMCertStore.Builder().setRatisServer(null)
         .setCRLSequenceId(INITIAL_SEQUENCE_ID)
         .setMetadaStore(scmMetadataStore)
         .build();
-  }
 
-  @Before
-  public void generateCertificate() throws Exception {
     Files.createDirectories(securityConfig.getKeyLocation(COMPONENT_NAME));
     x509Certificate = generateX509Cert();
-  }
 
-  @Before
-  public void initCRLApprover() {
     crlApprover = new DefaultCRLApprover(securityConfig,
         keyPair.getPrivate());
   }
 
-  @After
+  @AfterEach
   public void destroyDbStore() throws Exception {
     if (scmMetadataStore.getStore() != null) {
       scmMetadataStore.getStore().close();
@@ -153,8 +140,8 @@ public class TestSCMCertStore {
 
     assertNotNull(certInfo);
     assertNotNull(certInfo.getX509Certificate());
-    assertTrue("Timestamp should be greater than 0",
-        certInfo.getTimestamp() > 0L);
+    assertTrue(certInfo.getTimestamp() > 0L,
+        "Timestamp should be greater than 0");
 
     long crlId = scmCertStore.getLatestCrlId();
     assertEquals(sequenceId.get().longValue(), crlId);
@@ -321,7 +308,7 @@ public class TestSCMCertStore {
   private void checkListCerts(NodeType role, int expected) throws Exception {
     List<X509Certificate> certificateList = scmCertStore.listCertificate(role,
         BigInteger.valueOf(0), 10, VALID_CERTS);
-    Assert.assertEquals(expected, certificateList.size());
+    Assertions.assertEquals(expected, certificateList.size());
   }
 
 }
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMSecurityProtocolServer.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMSecurityProtocolServer.java
index e1a4e62e22..21df4bd4f3 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMSecurityProtocolServer.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMSecurityProtocolServer.java
@@ -20,25 +20,22 @@ import static 
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_SECURITY_SERVIC
 import static 
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_SECURITY_SERVICE_BIND_HOST_DEFAULT;
 
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.Timeout;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 
 import java.io.IOException;
 
 /**
  * Test class for {@link SCMSecurityProtocolServer}.
  * */
+@Timeout(20)
 public class TestSCMSecurityProtocolServer {
   private SCMSecurityProtocolServer securityProtocolServer;
   private OzoneConfiguration config;
 
-  @Rule
-  public Timeout timeout = Timeout.seconds(20);
-
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     config = new OzoneConfiguration();
     config.set(OZONE_SCM_SECURITY_SERVICE_ADDRESS_KEY,
@@ -47,7 +44,7 @@ public class TestSCMSecurityProtocolServer {
         null, null, null);
   }
 
-  @After
+  @AfterEach
   public void tearDown() {
     if (securityProtocolServer != null) {
       securityProtocolServer.stop();
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/update/server/MockCRLStore.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/update/server/MockCRLStore.java
index 1311a17e9f..661d0e4191 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/update/server/MockCRLStore.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/update/server/MockCRLStore.java
@@ -35,12 +35,12 @@ import org.apache.hadoop.hdds.security.x509.crl.CRLInfo;
 import org.apache.hadoop.security.ssl.KeyStoreTestUtil;
 import org.bouncycastle.asn1.x509.CRLReason;
 import org.bouncycastle.cert.X509CertificateHolder;
-import org.junit.rules.TemporaryFolder;
 import org.slf4j.Logger;
 
 import java.io.IOException;
 import java.math.BigInteger;
 import java.nio.file.Files;
+import java.nio.file.Path;
 import java.security.KeyPair;
 import java.security.cert.X509Certificate;
 import java.time.Instant;
@@ -66,12 +66,12 @@ public class MockCRLStore implements CRLStore {
   private final X509CertificateHolder caCertificateHolder;
   private final Logger log;
 
-  public MockCRLStore(TemporaryFolder tempDir, Logger log) throws Exception {
+  public MockCRLStore(Path metadataDir, Logger log) throws Exception {
 
     this.log = log;
     config = new OzoneConfiguration();
     config.set(HddsConfigKeys.OZONE_METADATA_DIRS,
-        tempDir.newFolder().getAbsolutePath());
+        metadataDir.toAbsolutePath().toString());
 
     securityConfig = new SecurityConfig(config);
     keyPair = KeyStoreTestUtil.generateKeyPair("RSA");
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/update/server/TestSCMUpdateServiceGrpcServer.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/update/server/TestSCMUpdateServiceGrpcServer.java
index e7b2c57543..257ac3128d 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/update/server/TestSCMUpdateServiceGrpcServer.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/update/server/TestSCMUpdateServiceGrpcServer.java
@@ -25,21 +25,20 @@ import 
org.apache.hadoop.hdds.scm.update.client.SCMUpdateClientConfiguration;
 import org.apache.hadoop.hdds.scm.update.client.SCMUpdateServiceGrpcClient;
 import org.apache.hadoop.hdds.scm.update.client.UpdateServiceConfig;
 import org.apache.ozone.test.GenericTestUtils;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.TemporaryFolder;
-import org.junit.rules.Timeout;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.api.io.TempDir;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.event.Level;
 
 import java.io.IOException;
 import java.math.BigInteger;
+import java.nio.file.Path;
 import java.time.Duration;
 import java.time.Instant;
 import java.util.ArrayList;
@@ -50,27 +49,20 @@ import java.util.Optional;
 /**
  * Tests for SCM update Service.
  */
+@Timeout(300)
 public class TestSCMUpdateServiceGrpcServer {
   private static final Logger LOG =
       LoggerFactory.getLogger(TestSCMUpdateServiceGrpcServer.class);
-  @Rule
-  public Timeout timeout = Timeout.seconds(300);
-
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
-
-  @Rule
-  public final TemporaryFolder tempDir = new TemporaryFolder();
 
   private MockCRLStore mockCRLStore;
 
-  @Before
-  public void setUp() throws Exception {
+  @BeforeEach
+  public void setUp(@TempDir Path tempDir) throws Exception {
     mockCRLStore = new MockCRLStore(tempDir, LOG);
     GenericTestUtils.setLogLevel(CRLClientUpdateHandler.getLog(), Level.DEBUG);
   }
 
-  @After
+  @AfterEach
   public void destroyDbStore() throws Exception {
     if (mockCRLStore != null) {
       mockCRLStore.close();
@@ -83,7 +75,7 @@ public class TestSCMUpdateServiceGrpcServer {
   }
 
   @Test
-  public void testStartStop() throws Exception {
+  public void testStartStop() {
     OzoneConfiguration conf = new OzoneConfiguration();
     SCMUpdateServiceGrpcServer server = new SCMUpdateServiceGrpcServer(
         getUpdateServiceConfig(conf), mockCRLStore);
@@ -130,14 +122,14 @@ public class TestSCMUpdateServiceGrpcServer {
       server.notifyCrlUpdate();
 
       GenericTestUtils.waitFor(() -> client.getUpdateCount() == 4, 100, 2000);
-      Assert.assertEquals(4, client.getUpdateCount());
-      Assert.assertEquals(0, client.getErrorCount());
+      Assertions.assertEquals(4, client.getUpdateCount());
+      Assertions.assertEquals(0, client.getErrorCount());
 
       revokeCertNow(certIds.get(5));
       server.notifyCrlUpdate();
       GenericTestUtils.waitFor(() -> client.getUpdateCount() > 4, 100, 2000);
-      Assert.assertEquals(5, client.getUpdateCount());
-      Assert.assertEquals(0, client.getErrorCount());
+      Assertions.assertEquals(5, client.getUpdateCount());
+      Assertions.assertEquals(0, client.getErrorCount());
     } catch (Exception e) {
       e.printStackTrace();
     } finally {
@@ -146,7 +138,7 @@ public class TestSCMUpdateServiceGrpcServer {
     }
   }
 
-  @Ignore("HDDS-5319")
+  @Disabled("HDDS-5319")
   @Test
   public void testClientUpdateWithDelayedRevoke() throws Exception {
     OzoneConfiguration conf = new OzoneConfiguration();
@@ -180,22 +172,22 @@ public class TestSCMUpdateServiceGrpcServer {
 
       GenericTestUtils.waitFor(() -> client.getUpdateCount() == 1,
           100, 2000);
-      Assert.assertEquals(1, client.getUpdateCount());
-      Assert.assertEquals(0, client.getErrorCount());
+      Assertions.assertEquals(1, client.getUpdateCount());
+      Assertions.assertEquals(0, client.getErrorCount());
 
       // revoke cert 5 with 10 seconds delay
       revokeCert(certIds.get(5), Instant.now().plus(Duration.ofSeconds(5)));
       server.notifyCrlUpdate();
       GenericTestUtils.waitFor(() -> client.getUpdateCount() > 1,
           100, 2000);
-      Assert.assertTrue(2 <= client.getUpdateCount());
-      Assert.assertEquals(0, client.getErrorCount());
-      Assert.assertTrue(1 >= client.getClientCRLStore()
+      Assertions.assertTrue(2 <= client.getUpdateCount());
+      Assertions.assertEquals(0, client.getErrorCount());
+      Assertions.assertTrue(1 >= client.getClientCRLStore()
           .getPendingCrlIds().size());
 
       GenericTestUtils.waitFor(() -> client.getPendingCrlRemoveCount() == 1,
           100, 20_000);
-      Assert.assertTrue(client.getClientCRLStore()
+      Assertions.assertTrue(client.getClientCRLStore()
           .getPendingCrlIds().isEmpty());
     } catch (Exception e) {
       e.printStackTrace();
@@ -218,7 +210,7 @@ public class TestSCMUpdateServiceGrpcServer {
     return crlId.get();
   }
 
-  @Ignore("HDDS-5319")
+  @Disabled("HDDS-5319")
   @Test
   public void testClientUpdateWithRestart() throws Exception {
     OzoneConfiguration conf = new OzoneConfiguration();
@@ -245,7 +237,7 @@ public class TestSCMUpdateServiceGrpcServer {
       server.notifyCrlUpdate();
       GenericTestUtils.waitFor(() -> client.getUpdateCount() == 4,
           100, 2000);
-      Assert.assertEquals(4, client.getUpdateCount());
+      Assertions.assertEquals(4, client.getUpdateCount());
 
 
       // server restart
@@ -259,18 +251,18 @@ public class TestSCMUpdateServiceGrpcServer {
       server.start();
       GenericTestUtils.waitFor(() -> client.getErrorCount() == 1,
           100, 2000);
-      Assert.assertEquals(4, client.getUpdateCount());
-      Assert.assertEquals(1, client.getErrorCount());
-      Assert.assertEquals(4, clientCRLStore.getLatestCrlId());
+      Assertions.assertEquals(4, client.getUpdateCount());
+      Assertions.assertEquals(1, client.getErrorCount());
+      Assertions.assertEquals(4, clientCRLStore.getLatestCrlId());
       LOG.info("Test server restart end.");
 
       revokeCertNow(certIds.get(5));
       server.notifyCrlUpdate();
       GenericTestUtils.waitFor(() -> client.getUpdateCount() > 4,
           100, 5000);
-      Assert.assertEquals(5, client.getUpdateCount());
-      Assert.assertEquals(1, client.getErrorCount());
-      Assert.assertEquals(5, clientCRLStore.getLatestCrlId());
+      Assertions.assertEquals(5, client.getUpdateCount());
+      Assertions.assertEquals(1, client.getErrorCount());
+      Assertions.assertEquals(5, clientCRLStore.getLatestCrlId());
 
       // client restart
       // server onError->
@@ -281,7 +273,7 @@ public class TestSCMUpdateServiceGrpcServer {
       client.stop(true);
       client.createChannel();
       client.start();
-      Assert.assertEquals(5, clientCRLStore.getLatestCrlId());
+      Assertions.assertEquals(5, clientCRLStore.getLatestCrlId());
       GenericTestUtils.waitFor(() -> client.getUpdateCount() > 5,
           100, 2000);
       revokeCertNow(certIds.get(6));
@@ -291,9 +283,9 @@ public class TestSCMUpdateServiceGrpcServer {
 
       GenericTestUtils.waitFor(() -> client.getUpdateCount() > 6,
           100, 2000);
-      Assert.assertTrue(client.getUpdateCount() >= 6);
-      Assert.assertEquals(2, client.getErrorCount());
-      Assert.assertEquals(6, clientCRLStore.getLatestCrlId());
+      Assertions.assertTrue(client.getUpdateCount() >= 6);
+      Assertions.assertEquals(2, client.getErrorCount());
+      Assertions.assertEquals(6, clientCRLStore.getLatestCrlId());
     } catch (Exception e) {
       e.printStackTrace();
     } finally {
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/upgrade/TestScmStartupSlvLessThanMlv.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/upgrade/TestScmStartupSlvLessThanMlv.java
index 762f946d83..7a11a3a112 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/upgrade/TestScmStartupSlvLessThanMlv.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/upgrade/TestScmStartupSlvLessThanMlv.java
@@ -24,14 +24,13 @@ import 
org.apache.hadoop.hdds.scm.server.StorageContainerManager;
 import org.apache.hadoop.hdds.upgrade.HDDSLayoutFeature;
 import org.apache.hadoop.ozone.upgrade.LayoutFeature;
 import org.apache.hadoop.ozone.upgrade.UpgradeTestUtils;
-import org.apache.ozone.test.GenericTestUtils;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Path;
 
 /**
  * Tests that SCM will throw an exception on creation when it reads in a
@@ -39,18 +38,18 @@ import java.io.IOException;
  * software layout version.
  */
 public class TestScmStartupSlvLessThanMlv {
-  @Rule
-  public TemporaryFolder tempFolder = new TemporaryFolder();
 
   @Test
-  public void testStartupSlvLessThanMlv() throws Exception {
+  public void testStartupSlvLessThanMlv(@TempDir Path tempDir)
+      throws Exception {
     // Add subdirectories under the temporary folder where the version file
     // will be placed.
-    File scmSubdir = tempFolder.newFolder("scm", "current");
+    File scmSubdir = tempDir.resolve("scm").resolve("current").toFile();
+    Assertions.assertTrue(scmSubdir.mkdirs());
 
     OzoneConfiguration conf = new OzoneConfiguration();
     conf.set(ScmConfigKeys.OZONE_SCM_DB_DIRS,
-        tempFolder.getRoot().getAbsolutePath());
+        tempDir.toAbsolutePath().toString());
 
     // Set metadata layout version larger then software layout version.
     int largestSlv = 0;
@@ -63,13 +62,11 @@ public class TestScmStartupSlvLessThanMlv {
     // construction.
     UpgradeTestUtils.createVersionFile(scmSubdir, HddsProtos.NodeType.SCM, 
mlv);
 
-    try {
-      new StorageContainerManager(conf);
-      Assert.fail("Expected IOException due to incorrect MLV on SCM 
creation.");
-    } catch (IOException e) {
-      String expectedMessage = String.format("Metadata layout version (%s) > " 
+
-          "software layout version (%s)", mlv, largestSlv);
-      GenericTestUtils.assertExceptionContains(expectedMessage, e);
-    }
+    Throwable t = Assertions.assertThrows(IOException.class,
+        () -> new StorageContainerManager(conf));
+    String expectedMessage = String.format("Cannot initialize VersionManager." 
+
+            " Metadata layout version (%s) > software layout version (%s)",
+        mlv, largestSlv);
+    Assertions.assertEquals(expectedMessage, t.getMessage());
   }
 }
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to