You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ad...@apache.org on 2023/12/15 13:38:45 UTC

(ozone) branch master updated: HDDS-9494. Migrate parameterized tests in hdds-container-service to JUnit5 (#5797)

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 914b1b5f72 HDDS-9494. Migrate parameterized tests in hdds-container-service to JUnit5 (#5797)
914b1b5f72 is described below

commit 914b1b5f72ff07f2e13f92d5137ea981136f06a6
Author: Galsza <10...@users.noreply.github.com>
AuthorDate: Fri Dec 15 14:38:39 2023 +0100

    HDDS-9494. Migrate parameterized tests in hdds-container-service to JUnit5 (#5797)
---
 hadoop-hdds/container-service/pom.xml              |   4 +-
 .../container/common/TestBlockDeletingService.java | 216 ++++++------
 .../common/TestKeyValueContainerData.java          |  25 +-
 .../TestSchemaOneBackwardsCompatibility.java       | 169 +++++----
 ...stStaleRecoveringContainerScrubbingService.java |  60 ++--
 .../common/impl/TestContainerDataYaml.java         |  93 +++--
 .../impl/TestContainerDeletionChoosingPolicy.java  |  57 +--
 .../common/impl/TestContainerPersistence.java      | 392 +++++++++++----------
 .../container/common/impl/TestContainerSet.java    |  79 +++--
 .../container/common/impl/TestHddsDispatcher.java  | 114 +++---
 .../TestCloseContainerCommandHandler.java          |  92 +++--
 .../TestDeleteBlocksCommandHandler.java            |  97 ++---
 .../common/volume/TestStorageVolumeChecker.java    | 109 +++---
 .../keyvalue/TestKeyValueBlockIterator.java        | 138 ++++----
 .../container/keyvalue/TestKeyValueContainer.java  | 313 +++++++++-------
 .../keyvalue/TestKeyValueContainerCheck.java       |   8 +-
 .../TestKeyValueContainerIntegrityChecks.java      |  15 +-
 .../TestKeyValueContainerMarkUnhealthy.java        |  90 ++---
 .../TestKeyValueContainerMetadataInspector.java    |  37 +-
 .../container/keyvalue/TestKeyValueHandler.java    |  86 +++--
 .../container/keyvalue/TestTarContainerPacker.java |  96 ++---
 .../keyvalue/impl/TestBlockManagerImpl.java        |  67 ++--
 .../container/ozoneimpl/TestContainerReader.java   | 126 ++++---
 .../container/ozoneimpl/TestOzoneContainer.java    | 118 ++++---
 .../replication/TestReplicationSupervisor.java     | 219 ++++++------
 .../upgrade/TestDatanodeUpgradeToSchemaV3.java     | 237 +++++++------
 .../upgrade/TestDatanodeUpgradeToScmHA.java        | 145 ++++----
 27 files changed, 1747 insertions(+), 1455 deletions(-)

diff --git a/hadoop-hdds/container-service/pom.xml b/hadoop-hdds/container-service/pom.xml
index b129db8e8a..0c271508e3 100644
--- a/hadoop-hdds/container-service/pom.xml
+++ b/hadoop-hdds/container-service/pom.xml
@@ -27,7 +27,9 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <description>Apache Ozone Distributed Data Store Container Service</description>
   <name>Apache Ozone HDDS Container Service</name>
   <packaging>jar</packaging>
-
+  <properties>
+    <allow.junit4>false</allow.junit4>
+  </properties>
   <dependencies>
     <dependency>
       <groupId>org.apache.ozone</groupId>
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestBlockDeletingService.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestBlockDeletingService.java
index 2f953e4ced..b7c9d14678 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestBlockDeletingService.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestBlockDeletingService.java
@@ -71,17 +71,13 @@ import org.apache.hadoop.ozone.container.metadata.DatanodeStoreSchemaTwoImpl;
 import org.apache.hadoop.ozone.container.ozoneimpl.OzoneContainer;
 import org.apache.ozone.test.GenericTestUtils;
 import org.apache.ozone.test.GenericTestUtils.LogCapturer;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-import org.apache.ozone.test.JUnit5AwareTimeout;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.apache.ozone.test.tag.Unhealthy;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.slf4j.LoggerFactory;
 
 import java.io.File;
@@ -113,6 +109,9 @@ import static org.apache.hadoop.ozone.container.common.ContainerTestUtils.create
 import static org.apache.hadoop.ozone.container.common.impl.ContainerLayoutVersion.FILE_PER_BLOCK;
 import static org.apache.hadoop.ozone.container.common.states.endpoint.VersionEndpointTask.LOG;
 import static org.apache.hadoop.ozone.container.keyvalue.helpers.KeyValueContainerUtil.isSameSchemaVersion;
+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.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -120,34 +119,24 @@ import static org.mockito.Mockito.when;
 /**
  * Tests to test block deleting service.
  */
-@RunWith(Parameterized.class)
+@Timeout(30)
 public class TestBlockDeletingService {
 
-  @Rule
-  public TestRule testTimeout = new JUnit5AwareTimeout(Timeout.seconds(30));
-
   private File testRoot;
   private String scmId;
   private String datanodeUuid;
   private final OzoneConfiguration conf = new OzoneConfiguration();
 
-  private final ContainerLayoutVersion layout;
-  private final String schemaVersion;
+  private ContainerLayoutVersion layout;
+  private String schemaVersion;
   private int blockLimitPerInterval;
   private MutableVolumeSet volumeSet;
 
-  public TestBlockDeletingService(ContainerTestVersionInfo versionInfo) {
-    this.layout = versionInfo.getLayout();
-    this.schemaVersion = versionInfo.getSchemaVersion();
-    ContainerTestVersionInfo.setTestSchemaVersion(schemaVersion, conf);
-  }
-
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> versionInfo() {
     return ContainerTestVersionInfo.versionParameters();
   }
 
-  @Before
+  @BeforeEach
   public void init() throws IOException {
     CodecBuffer.enableLeakDetection();
 
@@ -165,7 +154,7 @@ public class TestBlockDeletingService {
     createDbInstancesForTestIfNeeded(volumeSet, scmId, scmId, conf);
   }
 
-  @After
+  @AfterEach
   public void cleanup() throws IOException {
     BlockUtils.shutdownCache(conf);
     FileUtils.deleteDirectory(testRoot);
@@ -437,8 +426,11 @@ public class TestBlockDeletingService {
    * there are no delete transactions in the DB, this metadata counter should
    * be reset to zero.
    */
-  @Test
-  public void testPendingDeleteBlockReset() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testPendingDeleteBlockReset(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    setLayoutAndSchemaForTest(versionInfo);
     // This test is not relevant for schema V1.
     if (isSameSchemaVersion(schemaVersion, SCHEMA_V1)) {
       return;
@@ -459,11 +451,11 @@ public class TestBlockDeletingService {
         0, 1);
     try (DBHandle db = BlockUtils.getDB(incorrectData, conf)) {
       // Check pre-create state.
-      Assert.assertEquals(0, getUnderDeletionBlocksCount(db,
+      assertEquals(0, getUnderDeletionBlocksCount(db,
           incorrectData));
-      Assert.assertEquals(0, db.getStore().getMetadataTable()
+      assertEquals(0, db.getStore().getMetadataTable()
           .get(incorrectData.getPendingDeleteBlockCountKey()).longValue());
-      Assert.assertEquals(0,
+      assertEquals(0,
           incorrectData.getNumPendingDeletionBlocks());
 
       // Alter the pending delete value in memory and the DB.
@@ -478,12 +470,12 @@ public class TestBlockDeletingService {
     KeyValueContainerData correctData = createToDeleteBlocks(containerSet,
         correctNumBlocksToDelete, 1);
     // Check its metadata was set up correctly.
-    Assert.assertEquals(correctNumBlocksToDelete,
+    assertEquals(correctNumBlocksToDelete,
         correctData.getNumPendingDeletionBlocks());
     try (DBHandle db = BlockUtils.getDB(correctData, conf)) {
-      Assert.assertEquals(correctNumBlocksToDelete,
+      assertEquals(correctNumBlocksToDelete,
           getUnderDeletionBlocksCount(db, correctData));
-      Assert.assertEquals(correctNumBlocksToDelete,
+      assertEquals(correctNumBlocksToDelete,
           db.getStore().getMetadataTable()
               .get(correctData.getPendingDeleteBlockCountKey()).longValue());
     }
@@ -507,20 +499,20 @@ public class TestBlockDeletingService {
 
     // Pending delete block count in the incorrect container should be fixed
     // and reset to 0.
-    Assert.assertEquals(0, incorrectData.getNumPendingDeletionBlocks());
+    assertEquals(0, incorrectData.getNumPendingDeletionBlocks());
     try (DBHandle db = BlockUtils.getDB(incorrectData, conf)) {
-      Assert.assertEquals(0, getUnderDeletionBlocksCount(db,
+      assertEquals(0, getUnderDeletionBlocksCount(db,
           incorrectData));
-      Assert.assertEquals(0, db.getStore().getMetadataTable()
+      assertEquals(0, db.getStore().getMetadataTable()
           .get(incorrectData.getPendingDeleteBlockCountKey()).longValue());
     }
     // Correct container should not have been processed.
-    Assert.assertEquals(correctNumBlocksToDelete,
+    assertEquals(correctNumBlocksToDelete,
         correctData.getNumPendingDeletionBlocks());
     try (DBHandle db = BlockUtils.getDB(correctData, conf)) {
-      Assert.assertEquals(correctNumBlocksToDelete,
+      assertEquals(correctNumBlocksToDelete,
           getUnderDeletionBlocksCount(db, correctData));
-      Assert.assertEquals(correctNumBlocksToDelete,
+      assertEquals(correctNumBlocksToDelete,
           db.getStore().getMetadataTable()
               .get(correctData.getPendingDeleteBlockCountKey()).longValue());
     }
@@ -531,27 +523,30 @@ public class TestBlockDeletingService {
 
     // The incorrect container should remain in the same state after being
     // fixed.
-    Assert.assertEquals(0, incorrectData.getNumPendingDeletionBlocks());
+    assertEquals(0, incorrectData.getNumPendingDeletionBlocks());
     try (DBHandle db = BlockUtils.getDB(incorrectData, conf)) {
-      Assert.assertEquals(0, getUnderDeletionBlocksCount(db,
+      assertEquals(0, getUnderDeletionBlocksCount(db,
           incorrectData));
-      Assert.assertEquals(0, db.getStore().getMetadataTable()
+      assertEquals(0, db.getStore().getMetadataTable()
           .get(incorrectData.getPendingDeleteBlockCountKey()).longValue());
     }
     // The correct container should have been processed this run and had its
     // blocks deleted.
-    Assert.assertEquals(0, correctData.getNumPendingDeletionBlocks());
+    assertEquals(0, correctData.getNumPendingDeletionBlocks());
     try (DBHandle db = BlockUtils.getDB(correctData, conf)) {
-      Assert.assertEquals(0, getUnderDeletionBlocksCount(db,
+      assertEquals(0, getUnderDeletionBlocksCount(db,
           correctData));
-      Assert.assertEquals(0, db.getStore().getMetadataTable()
+      assertEquals(0, db.getStore().getMetadataTable()
           .get(correctData.getPendingDeleteBlockCountKey()).longValue());
     }
   }
 
 
-  @Test
-  public void testBlockDeletion() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testBlockDeletion(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    setLayoutAndSchemaForTest(versionInfo);
     DatanodeConfiguration dnConf = conf.getObject(DatanodeConfiguration.class);
     dnConf.setBlockDeletionLimit(2);
     this.blockLimitPerInterval = dnConf.getBlockDeletionLimit();
@@ -572,7 +567,7 @@ public class TestBlockDeletingService {
     // Ensure 1 container was created
     List<ContainerData> containerData = Lists.newArrayList();
     containerSet.listContainer(0L, 1, containerData);
-    Assert.assertEquals(1, containerData.size());
+    assertEquals(1, containerData.size());
     KeyValueContainerData data = (KeyValueContainerData) containerData.get(0);
     KeyPrefixFilter filter = isSameSchemaVersion(schemaVersion, SCHEMA_V1) ?
         data.getDeletingBlockKeyFilter() : data.getUnprefixedKeyFilter();
@@ -596,40 +591,40 @@ public class TestBlockDeletingService {
           deletingServiceMetrics.getTotalBlockChosenCount();
       long totalContainerChosenCount =
           deletingServiceMetrics.getTotalContainerChosenCount();
-      Assert.assertEquals(0, transactionId);
+      assertEquals(0, transactionId);
 
       // Ensure there are 3 blocks under deletion and 0 deleted blocks
-      Assert.assertEquals(3, getUnderDeletionBlocksCount(meta, data));
-      Assert.assertEquals(3, meta.getStore().getMetadataTable()
+      assertEquals(3, getUnderDeletionBlocksCount(meta, data));
+      assertEquals(3, meta.getStore().getMetadataTable()
           .get(data.getPendingDeleteBlockCountKey()).longValue());
 
       // Container contains 3 blocks. So, space used by the container
       // should be greater than zero.
-      Assert.assertTrue(containerSpace > 0);
+      assertTrue(containerSpace > 0);
 
       // An interval will delete 1 * 2 blocks
       deleteAndWait(svc, 1);
 
       GenericTestUtils.waitFor(() ->
-              containerData.get(0).getBytesUsed() == containerSpace /
-                      3, 100, 3000);
+          containerData.get(0).getBytesUsed() == containerSpace /
+              3, 100, 3000);
       // After first interval 2 blocks will be deleted. Hence, current space
       // used by the container should be less than the space used by the
       // container initially(before running deletion services).
-      Assert.assertTrue(containerData.get(0).getBytesUsed() < containerSpace);
-      Assert.assertEquals(2,
+      assertTrue(containerData.get(0).getBytesUsed() < containerSpace);
+      assertEquals(2,
           deletingServiceMetrics.getSuccessCount()
               - deleteSuccessCount);
-      Assert.assertEquals(2,
+      assertEquals(2,
           deletingServiceMetrics.getTotalBlockChosenCount()
               - totalBlockChosenCount);
-      Assert.assertEquals(1,
+      assertEquals(1,
           deletingServiceMetrics.getTotalContainerChosenCount()
               - totalContainerChosenCount);
       // The value of the getTotalPendingBlockCount Metrics is obtained
       // before the deletion is processing
       // So the Pending Block count will be 3
-      Assert.assertEquals(3,
+      assertEquals(3,
           deletingServiceMetrics.getTotalPendingBlockCount());
 
       deleteAndWait(svc, 2);
@@ -641,18 +636,18 @@ public class TestBlockDeletingService {
 
       // Check finally DB counters.
       // Not checking bytes used, as handler is a mock call.
-      Assert.assertEquals(0, meta.getStore().getMetadataTable()
+      assertEquals(0, meta.getStore().getMetadataTable()
           .get(data.getPendingDeleteBlockCountKey()).longValue());
-      Assert.assertEquals(0,
+      assertEquals(0,
           meta.getStore().getMetadataTable().get(data.getBlockCountKey())
               .longValue());
-      Assert.assertEquals(3,
+      assertEquals(3,
           deletingServiceMetrics.getSuccessCount()
               - deleteSuccessCount);
-      Assert.assertEquals(3,
+      assertEquals(3,
           deletingServiceMetrics.getTotalBlockChosenCount()
               - totalBlockChosenCount);
-      Assert.assertEquals(2,
+      assertEquals(2,
           deletingServiceMetrics.getTotalContainerChosenCount()
               - totalContainerChosenCount);
 
@@ -661,17 +656,20 @@ public class TestBlockDeletingService {
       // The value of the getTotalPendingBlockCount Metrics is obtained
       // before the deletion is processing
       // So the Pending Block count will be 1
-      Assert.assertEquals(1,
+      assertEquals(1,
           deletingServiceMetrics.getTotalPendingBlockCount());
     }
     svc.shutdown();
   }
 
-  @Test
-  public void testWithUnrecordedBlocks() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testWithUnrecordedBlocks(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    setLayoutAndSchemaForTest(versionInfo);
     // Skip schemaV1, when markBlocksForDeletionSchemaV1, the unrecorded blocks
     // from received TNXs will be deleted, not in BlockDeletingService
-    Assume.assumeFalse(isSameSchemaVersion(schemaVersion, SCHEMA_V1));
+    Assumptions.assumeFalse(isSameSchemaVersion(schemaVersion, SCHEMA_V1));
 
     int numOfContainers = 2;
     int numOfChunksPerBlock = 1;
@@ -698,7 +696,7 @@ public class TestBlockDeletingService {
     // Ensure 2 container was created
     List<ContainerData> containerData = Lists.newArrayList();
     containerSet.listContainer(0L, 2, containerData);
-    Assert.assertEquals(2, containerData.size());
+    assertEquals(2, containerData.size());
     KeyValueContainerData ctr1 = (KeyValueContainerData) containerData.get(0);
     KeyValueContainerData ctr2 = (KeyValueContainerData) containerData.get(1);
     KeyPrefixFilter filter = isSameSchemaVersion(schemaVersion, SCHEMA_V1) ?
@@ -736,7 +734,7 @@ public class TestBlockDeletingService {
       for (int m = 0; m < numExistingOnDiskUnrecordedBlocks; m++) {
         File chunk = iter.next();
         createRandomContentFile(chunk.getName(), chunkDir, 100);
-        Assert.assertTrue(chunk.exists());
+        assertTrue(chunk.exists());
       }
 
       createTxn(ctr1, unrecordedBlockIds, 100, ctr1.getContainerID());
@@ -745,12 +743,12 @@ public class TestBlockDeletingService {
       updateMetaData(ctr1, (KeyValueContainer) containerSet.getContainer(
           ctr1.getContainerID()), 3, 1);
       // Ensure there are 3 + 4 = 7 blocks under deletion
-      Assert.assertEquals(7, getUnderDeletionBlocksCount(meta, ctr1));
+      assertEquals(7, getUnderDeletionBlocksCount(meta, ctr1));
     }
 
     assertBlockDataTableRecordCount(3, ctr1, filter);
     assertBlockDataTableRecordCount(3, ctr2, filter);
-    Assert.assertEquals(3, ctr2.getNumPendingDeletionBlocks());
+    assertEquals(3, ctr2.getNumPendingDeletionBlocks());
 
     // Totally 2 container * 3 blocks + 4 unrecorded block = 10 blocks
     // So we shall experience 5 rounds to delete all blocks
@@ -764,26 +762,28 @@ public class TestBlockDeletingService {
         200, 2000);
 
     // To make sure the container stat calculation is right
-    Assert.assertEquals(0, ctr1.getBlockCount());
-    Assert.assertEquals(0, ctr1.getBytesUsed());
-    Assert.assertEquals(0, ctr2.getBlockCount());
-    Assert.assertEquals(0, ctr2.getBytesUsed());
+    assertEquals(0, ctr1.getBlockCount());
+    assertEquals(0, ctr1.getBytesUsed());
+    assertEquals(0, ctr2.getBlockCount());
+    assertEquals(0, ctr2.getBytesUsed());
 
     // check if blockData get deleted
     assertBlockDataTableRecordCount(0, ctr1, filter);
     assertBlockDataTableRecordCount(0, ctr2, filter);
 
     // check if all the unreferenced chunks get deleted
-    for (File f: unrecordedChunks) {
-      Assert.assertFalse(f.exists());
+    for (File f : unrecordedChunks) {
+      assertFalse(f.exists());
     }
 
     svc.shutdown();
   }
 
-  @Test
-  @SuppressWarnings("java:S2699") // waitFor => assertion with timeout
-  public void testShutdownService() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testShutdownService(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    setLayoutAndSchemaForTest(versionInfo);
     conf.setTimeDuration(OZONE_BLOCK_DELETING_SERVICE_INTERVAL, 500,
         TimeUnit.MILLISECONDS);
     conf.setInt(OZONE_BLOCK_DELETING_CONTAINER_LIMIT_PER_INTERVAL, 10);
@@ -811,8 +811,11 @@ public class TestBlockDeletingService {
     GenericTestUtils.waitFor(() -> service.getThreadCount() == 0, 100, 1000);
   }
 
-  @Test
-  public void testBlockDeletionTimeout() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testBlockDeletionTimeout(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    setLayoutAndSchemaForTest(versionInfo);
     DatanodeConfiguration dnConf = conf.getObject(DatanodeConfiguration.class);
     dnConf.setBlockDeletionLimit(3);
     blockLimitPerInterval = dnConf.getBlockDeletionLimit();
@@ -873,7 +876,7 @@ public class TestBlockDeletingService {
 
       // The block deleting successfully and shouldn't catch timed
       // out warning log.
-      Assert.assertFalse(newLog.getOutput().contains(
+      assertFalse(newLog.getOutput().contains(
           "Background task executes timed out, retrying in next interval"));
     }
     svc.shutdown();
@@ -898,9 +901,12 @@ public class TestBlockDeletingService {
     return ozoneContainer;
   }
 
-  @Test
-  @org.junit.Ignore
-  public void testContainerThrottle() throws Exception {
+  @ParameterizedTest
+  @Unhealthy
+  @MethodSource("versionInfo")
+  public void testContainerThrottle(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    setLayoutAndSchemaForTest(versionInfo);
     // Properties :
     //  - Number of containers : 2
     //  - Number of blocks per container : 1
@@ -948,7 +954,7 @@ public class TestBlockDeletingService {
                       containerData.get(1).getBytesUsed() == 0),
               100, 3000);
 
-      Assert.assertFalse((containerData.get(0).getBytesUsed() == 0) && (
+      assertFalse((containerData.get(0).getBytesUsed() == 0) && (
           containerData.get(1).getBytesUsed() == 0));
 
       // Deleting the second container. Hence, space used by both the
@@ -957,15 +963,18 @@ public class TestBlockDeletingService {
 
       GenericTestUtils.waitFor(() ->
               (containerData.get(0).getBytesUsed() ==
-                      0 && containerData.get(1).getBytesUsed() == 0),
-              100, 3000);
+                  0 && containerData.get(1).getBytesUsed() == 0),
+          100, 3000);
     } finally {
       service.shutdown();
     }
   }
 
-  @Test
-  public void testContainerMaxLockHoldingTime() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testContainerMaxLockHoldingTime(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    setLayoutAndSchemaForTest(versionInfo);
     GenericTestUtils.LogCapturer log =
         GenericTestUtils.LogCapturer.captureLogs(
             LoggerFactory.getLogger(BlockDeletingTask.class));
@@ -1005,7 +1014,7 @@ public class TestBlockDeletingService {
         // a timeout except the last one, where a "deletion transaction"
         // will be created for each Block, so it will start
         // blocksPerContainer - 1 timeout.
-        Assert.assertEquals(blocksPerContainer - 1,
+        assertEquals(blocksPerContainer - 1,
             StringUtils.countMatches(log.getOutput(), "Max lock hold time"));
       }
     } finally {
@@ -1022,8 +1031,11 @@ public class TestBlockDeletingService {
     return totalSpaceUsed;
   }
 
-  @Test
-  public void testBlockThrottle() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testBlockThrottle(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    setLayoutAndSchemaForTest(versionInfo);
     // Properties :
     //  - Number of containers : 5
     //  - Number of blocks per container : 3
@@ -1135,9 +1147,9 @@ public class TestBlockDeletingService {
         count += 1;
       }
     }
-    Assert.assertEquals("Excepted: " + expectedCount
+    assertEquals(expectedCount, count, "Excepted: " + expectedCount
         + ", but actual: " + count + " in the blockData table of container: "
-        + containerID + ".", expectedCount, count);
+        + containerID + ".");
   }
 
   /**
@@ -1156,4 +1168,10 @@ public class TestBlockDeletingService {
       randomAccessFile.setLength(sizeInBytes);
     }
   }
+
+  private void setLayoutAndSchemaForTest(ContainerTestVersionInfo versionInfo) {
+    this.layout = versionInfo.getLayout();
+    this.schemaVersion = versionInfo.getSchemaVersion();
+    ContainerTestVersionInfo.setTestSchemaVersion(schemaVersion, conf);
+  }
 }
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestKeyValueContainerData.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestKeyValueContainerData.java
index 2edf8b01fb..be2cea7052 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestKeyValueContainerData.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestKeyValueContainerData.java
@@ -26,12 +26,11 @@ import org.apache.hadoop.ozone.container.common.volume.HddsVolume;
 import org.apache.hadoop.ozone.container.keyvalue.ContainerTestVersionInfo;
 import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
 import org.apache.hadoop.ozone.container.upgrade.VersionedDatanodeFeatures;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.mockito.Mockito;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicLong;
@@ -39,29 +38,29 @@ import java.util.concurrent.atomic.AtomicLong;
 /**
  * This class is used to test the KeyValueContainerData.
  */
-@RunWith(Parameterized.class)
 public class TestKeyValueContainerData {
 
   private static final long MAXSIZE = (long) StorageUnit.GB.toBytes(5);
 
-  private final ContainerLayoutVersion layout;
-  private final String schemaVersion;
-  private final OzoneConfiguration conf;
+  private ContainerLayoutVersion layout;
+  private String schemaVersion;
+  private OzoneConfiguration conf;
 
-  public TestKeyValueContainerData(ContainerTestVersionInfo versionInfo) {
+  private void initVersionInfo(ContainerTestVersionInfo versionInfo) {
     this.layout = versionInfo.getLayout();
     this.schemaVersion = versionInfo.getSchemaVersion();
     this.conf = new OzoneConfiguration();
     ContainerTestVersionInfo.setTestSchemaVersion(schemaVersion, conf);
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> versionInfo() {
     return ContainerTestVersionInfo.versionParameters();
   }
 
-  @Test
-  public void testKeyValueData() {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testKeyValueData(ContainerTestVersionInfo versionInfo) {
+    initVersionInfo(versionInfo);
     long containerId = 1L;
     ContainerProtos.ContainerType containerType = ContainerProtos
         .ContainerType.KeyValueContainer;
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestSchemaOneBackwardsCompatibility.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestSchemaOneBackwardsCompatibility.java
index b28c59d7e8..e815ba7e8e 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestSchemaOneBackwardsCompatibility.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestSchemaOneBackwardsCompatibility.java
@@ -47,18 +47,17 @@ import org.apache.hadoop.ozone.container.metadata.DatanodeStore;
 import org.apache.hadoop.ozone.container.metadata.SchemaOneDeletedBlocksTable;
 import org.apache.hadoop.ozone.container.ozoneimpl.OzoneContainer;
 import org.apache.ozone.test.GenericTestUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.yaml.snakeyaml.Yaml;
 
 import java.io.File;
 import java.io.IOException;
 import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.List;
 import java.util.UUID;
 import java.util.ArrayList;
@@ -68,10 +67,12 @@ import java.util.Arrays;
 import java.util.stream.Collectors;
 
 import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_BLOCK_DELETING_CONTAINER_LIMIT_PER_INTERVAL;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -91,40 +92,38 @@ import static org.mockito.Mockito.when;
  * {@link TestDB}, which is used by these tests to load a pre created schema
  * version 1 RocksDB instance from test resources.
  */
-@RunWith(Parameterized.class)
 public class TestSchemaOneBackwardsCompatibility {
   private OzoneConfiguration conf;
 
   private File metadataDir;
   private File containerFile;
 
-  @Rule
-  public TemporaryFolder tempFolder = new TemporaryFolder();
+  @TempDir
+  private Path tempFolder;
 
-  public TestSchemaOneBackwardsCompatibility(String schemaVersion) {
+  private void initSchemaVersion(String schemaVersion) {
     this.conf = new OzoneConfiguration();
     ContainerTestVersionInfo.setTestSchemaVersion(schemaVersion, conf);
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> schemaVersion() {
     return Arrays.asList(new Object[][]{
         {OzoneConsts.SCHEMA_V2},
         {OzoneConsts.SCHEMA_V3}
     });
   }
 
-  @Before
-  public void setup() throws Exception {
+  private void setup(String schemaVersion) throws Exception {
+    initSchemaVersion(schemaVersion);
     TestDB testDB = new TestDB();
 
     // Copy data to the temporary folder so it can be safely modified.
     File tempMetadataDir =
-            tempFolder.newFolder(Long.toString(TestDB.CONTAINER_ID),
-                    OzoneConsts.CONTAINER_META_PATH);
-
+        Files.createDirectories(
+            tempFolder.resolve(OzoneConsts.CONTAINER_META_PATH +
+                "/" + TestDB.CONTAINER_ID)).toFile();
     FileUtils.copyDirectoryToDirectory(testDB.getDBDirectory(),
-            tempMetadataDir);
+        tempMetadataDir);
     FileUtils.copyFileToDirectory(testDB.getContainerFile(), tempMetadataDir);
 
     metadataDir = tempMetadataDir;
@@ -136,15 +135,24 @@ public class TestSchemaOneBackwardsCompatibility {
         metadataDir.getAbsolutePath());
   }
 
+  @AfterEach
+  public void cleanup() {
+    BlockUtils.shutdownCache(conf);
+  }
+
   /**
    * Because all tables in schema version one map back to the default table,
    * directly iterating any of the table instances should be forbidden.
    * Otherwise, the iterators for each table would read the entire default
    * table, return all database contents, and yield unexpected results.
+   *
    * @throws Exception
    */
-  @Test
-  public void testDirectTableIterationDisabled() throws Exception {
+  @ParameterizedTest
+  @MethodSource("schemaVersion")
+  public void testDirectTableIterationDisabled(String schemaVersion)
+      throws Exception {
+    setup(schemaVersion);
     try (DBHandle refCountedDB = BlockUtils.getDB(newKvData(), conf)) {
       DatanodeStore store = refCountedDB.getStore();
 
@@ -155,13 +163,7 @@ public class TestSchemaOneBackwardsCompatibility {
   }
 
   private void assertTableIteratorUnsupported(Table<?, ?> table) {
-    try {
-      table.iterator();
-      Assert.fail("Table iterator should have thrown " +
-              "UnsupportedOperationException.");
-    } catch (IOException | UnsupportedOperationException ex) {
-      // Exception thrown as expected.
-    }
+    assertThrows(UnsupportedOperationException.class, table::iterator);
   }
 
   /**
@@ -169,10 +171,13 @@ public class TestSchemaOneBackwardsCompatibility {
    * database, and checks that they match the expected values.
    * Also makes sure that internal prefixes used to manage data in the schema
    * one deleted blocks table are removed from keys in iterator results.
+   *
    * @throws IOException
    */
-  @Test
-  public void testBlockIteration() throws IOException {
+  @ParameterizedTest
+  @MethodSource("schemaVersion")
+  public void testBlockIteration(String schemaVersion) throws Exception {
+    setup(schemaVersion);
     KeyValueContainerData cData = newKvData();
     try (DBHandle refCountedDB = BlockUtils.getDB(cData, conf)) {
       assertEquals(TestDB.NUM_DELETED_BLOCKS,
@@ -215,10 +220,13 @@ public class TestSchemaOneBackwardsCompatibility {
    * the container has metadata keys present.
    * The {@link KeyValueContainerUtil} will read these values to fill in a
    * {@link KeyValueContainerData} object.
+   *
    * @throws Exception
    */
-  @Test
-  public void testReadWithMetadata() throws Exception {
+  @ParameterizedTest
+  @MethodSource("schemaVersion")
+  public void testReadWithMetadata(String schemaVersion) throws Exception {
+    setup(schemaVersion);
     checkContainerData(newKvData());
   }
 
@@ -228,12 +236,15 @@ public class TestSchemaOneBackwardsCompatibility {
    * The {@link KeyValueContainerUtil} will scan the blocks in the database
    * to fill these metadata values into the database and into a
    * {@link KeyValueContainerData} object.
+   *
    * @throws Exception
    */
-  @Test
-  public void testReadWithoutMetadata() throws Exception {
+  @ParameterizedTest
+  @MethodSource("schemaVersion")
+  public void testReadWithoutMetadata(String schemaVersion) throws Exception {
     // Delete metadata keys from our copy of the DB.
     // This simulates them not being there to start with.
+    setup(schemaVersion);
     KeyValueContainerData cData = newKvData();
     try (DBHandle db = BlockUtils.getDB(cData, conf)) {
       Table<String, Long> metadataTable = db.getStore().getMetadataTable();
@@ -260,8 +271,10 @@ public class TestSchemaOneBackwardsCompatibility {
    * deleted blocks and deletes them, this test will modify its copy of the
    * database.
    */
-  @Test
-  public void testDelete() throws Exception {
+  @ParameterizedTest
+  @MethodSource("schemaVersion")
+  public void testDelete(String schemaVersion) throws Exception {
+    setup(schemaVersion);
     final long numBlocksToDelete = TestDB.NUM_PENDING_DELETION_BLOCKS;
     String datanodeUuid = UUID.randomUUID().toString();
     ContainerSet containerSet = makeContainerSet();
@@ -328,10 +341,14 @@ public class TestSchemaOneBackwardsCompatibility {
    * deleted from schema version one after the upgrade should have their
    * {@link ChunkInfoList} saved as the corresponding value in the deleted
    * blocks table. Reading these values should succeed.
+   *
    * @throws Exception
    */
-  @Test
-  public void testReadDeletedBlockChunkInfo() throws Exception {
+  @ParameterizedTest
+  @MethodSource("schemaVersion")
+  public void testReadDeletedBlockChunkInfo(String schemaVersion)
+      throws Exception {
+    setup(schemaVersion);
     String datanodeUuid = UUID.randomUUID().toString();
     ContainerSet containerSet = makeContainerSet();
     VolumeSet volumeSet = new MutableVolumeSet(datanodeUuid, conf, null,
@@ -355,14 +372,14 @@ public class TestSchemaOneBackwardsCompatibility {
         preUpgradeBlocks.add(chunkListKV.getKey());
         try {
           chunkListKV.getValue();
-          Assert.fail("No exception thrown when trying to retrieve old " +
-                  "deleted blocks values as chunk lists.");
+          fail("No exception thrown when trying to retrieve old " +
+              "deleted blocks values as chunk lists.");
         } catch (IOException ex) {
           // Exception thrown as expected.
         }
       }
 
-      Assert.assertEquals(TestDB.NUM_DELETED_BLOCKS, preUpgradeBlocks.size());
+      assertEquals(TestDB.NUM_DELETED_BLOCKS, preUpgradeBlocks.size());
 
       long initialTotalSpace = newKvData().getBytesUsed();
       long blockSpace = initialTotalSpace / TestDB.KEY_COUNT;
@@ -386,23 +403,25 @@ public class TestSchemaOneBackwardsCompatibility {
 
       // The blocks that were originally marked for deletion should now be
       // deleted.
-      Assert.assertEquals(TestDB.NUM_PENDING_DELETION_BLOCKS,
-              numberOfBlocksDeleted);
+      assertEquals(TestDB.NUM_PENDING_DELETION_BLOCKS,
+          numberOfBlocksDeleted);
     }
   }
 
-  @Test
-  public void testReadBlockData() throws Exception {
+  @ParameterizedTest
+  @MethodSource("schemaVersion")
+  public void testReadBlockData(String schemaVersion) throws Exception {
+    setup(schemaVersion);
     KeyValueContainerData cData = newKvData();
     try (DBHandle refCountedDB = BlockUtils.getDB(cData, conf)) {
       Table<String, BlockData> blockDataTable =
           refCountedDB.getStore().getBlockDataTable();
 
       // Test encoding keys and decoding database values.
-      for (String blockID: TestDB.BLOCK_IDS) {
+      for (String blockID : TestDB.BLOCK_IDS) {
         String blockKey = cData.getBlockKey(Long.parseLong(blockID));
         BlockData blockData = blockDataTable.get(blockKey);
-        Assert.assertEquals(Long.toString(blockData.getLocalID()), blockID);
+        assertEquals(Long.toString(blockData.getLocalID()), blockID);
       }
 
       // Test decoding keys from the database.
@@ -412,16 +431,16 @@ public class TestSchemaOneBackwardsCompatibility {
 
       List<String> decodedKeys = new ArrayList<>();
 
-      for (Table.KeyValue<String, BlockData> blockDataKV:
-           blockKeyValues) {
+      for (Table.KeyValue<String, BlockData> blockDataKV :
+          blockKeyValues) {
         decodedKeys.add(blockDataKV.getKey());
       }
 
-      Assert.assertEquals(TestDB.BLOCK_IDS, decodedKeys);
+      assertEquals(TestDB.BLOCK_IDS, decodedKeys);
 
       // Test reading blocks with block iterator.
       try (BlockIterator<BlockData> iter =
-              refCountedDB.getStore().getBlockIterator(TestDB.CONTAINER_ID)) {
+               refCountedDB.getStore().getBlockIterator(TestDB.CONTAINER_ID)) {
 
         List<String> iteratorBlockIDs = new ArrayList<>();
 
@@ -430,23 +449,25 @@ public class TestSchemaOneBackwardsCompatibility {
           iteratorBlockIDs.add(Long.toString(localID));
         }
 
-        Assert.assertEquals(TestDB.BLOCK_IDS, iteratorBlockIDs);
+        assertEquals(TestDB.BLOCK_IDS, iteratorBlockIDs);
       }
     }
   }
 
-  @Test
-  public void testReadDeletingBlockData() throws Exception {
+  @ParameterizedTest
+  @MethodSource("schemaVersion")
+  public void testReadDeletingBlockData(String schemaVersion) throws Exception {
+    setup(schemaVersion);
     KeyValueContainerData cData = newKvData();
     try (DBHandle refCountedDB = BlockUtils.getDB(cData, conf)) {
       Table<String, BlockData> blockDataTable =
           refCountedDB.getStore().getBlockDataTable();
 
-      for (String blockID: TestDB.DELETING_BLOCK_IDS) {
+      for (String blockID : TestDB.DELETING_BLOCK_IDS) {
         String blockKey = cData.getDeletingBlockKey(
             Long.parseLong(blockID));
         BlockData blockData = blockDataTable.get(blockKey);
-        Assert.assertEquals(Long.toString(blockData.getLocalID()), blockID);
+        assertEquals(Long.toString(blockData.getLocalID()), blockID);
       }
 
       // Test decoding keys from the database.
@@ -467,7 +488,7 @@ public class TestSchemaOneBackwardsCompatibility {
           .map(key -> cData.getDeletingBlockKey(Long.parseLong(key)))
           .collect(Collectors.toList());
 
-      Assert.assertEquals(expectedKeys, decodedKeys);
+      assertEquals(expectedKeys, decodedKeys);
 
       // Test reading deleting blocks with block iterator.
       KeyPrefixFilter filter = cData.getDeletingBlockKeyFilter();
@@ -483,39 +504,43 @@ public class TestSchemaOneBackwardsCompatibility {
           iteratorBlockIDs.add(Long.toString(localID));
         }
 
-        Assert.assertEquals(TestDB.DELETING_BLOCK_IDS, iteratorBlockIDs);
+        assertEquals(TestDB.DELETING_BLOCK_IDS, iteratorBlockIDs);
       }
     }
   }
 
-  @Test
-  public void testReadMetadata() throws Exception {
+  @ParameterizedTest
+  @MethodSource("schemaVersion")
+  public void testReadMetadata(String schemaVersion) throws Exception {
+    setup(schemaVersion);
     KeyValueContainerData cData = newKvData();
     try (DBHandle refCountedDB = BlockUtils.getDB(cData, conf)) {
       Table<String, Long> metadataTable =
           refCountedDB.getStore().getMetadataTable();
 
-      Assert.assertEquals(TestDB.KEY_COUNT,
+      assertEquals(TestDB.KEY_COUNT,
           metadataTable.get(cData.getBlockCountKey()).longValue());
-      Assert.assertEquals(TestDB.BYTES_USED,
+      assertEquals(TestDB.BYTES_USED,
           metadataTable.get(cData.getBytesUsedKey()).longValue());
-      Assert.assertEquals(TestDB.NUM_PENDING_DELETION_BLOCKS,
+      assertEquals(TestDB.NUM_PENDING_DELETION_BLOCKS,
           metadataTable.get(cData.getPendingDeleteBlockCountKey())
               .longValue());
     }
   }
 
-  @Test
-  public void testReadDeletedBlocks() throws Exception {
+  @ParameterizedTest
+  @MethodSource("schemaVersion")
+  public void testReadDeletedBlocks(String schemaVersion) throws Exception {
+    setup(schemaVersion);
     KeyValueContainerData cData = newKvData();
     try (DBHandle refCountedDB = BlockUtils.getDB(cData, conf)) {
       Table<String, ChunkInfoList> deletedBlocksTable =
           refCountedDB.getStore().getDeletedBlocksTable();
 
-      for (String blockID: TestDB.DELETED_BLOCK_IDS) {
+      for (String blockID : TestDB.DELETED_BLOCK_IDS) {
         // Since chunk info for deleted blocks was not stored in schema
         // version 1, there is no value to retrieve here.
-        Assert.assertTrue(deletedBlocksTable.isExist(blockID));
+        assertTrue(deletedBlocksTable.isExist(blockID));
       }
 
       // Test decoding keys from the database.
@@ -530,7 +555,7 @@ public class TestSchemaOneBackwardsCompatibility {
         decodedKeys.add(kv.getKey());
       }
 
-      Assert.assertEquals(TestDB.DELETED_BLOCK_IDS, decodedKeys);
+      assertEquals(TestDB.DELETED_BLOCK_IDS, decodedKeys);
     }
   }
 
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestStaleRecoveringContainerScrubbingService.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestStaleRecoveringContainerScrubbingService.java
index b335973b77..ac1e3b17df 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestStaleRecoveringContainerScrubbingService.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/TestStaleRecoveringContainerScrubbingService.java
@@ -35,18 +35,17 @@ import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
 import org.apache.hadoop.ozone.container.keyvalue.helpers.BlockUtils;
 import org.apache.hadoop.ozone.container.keyvalue.statemachine.background.StaleRecoveringContainerScrubbingService;
 import org.apache.ozone.test.TestClock;
-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.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.mockito.Mockito;
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.time.Duration;
 import java.time.Instant;
 import java.time.ZoneOffset;
@@ -68,17 +67,16 @@ import static org.mockito.Mockito.mock;
 /**
  * Tests to stale recovering container scrubbing service.
  */
-@RunWith(Parameterized.class)
 public class TestStaleRecoveringContainerScrubbingService {
 
-  @Rule
-  public final TemporaryFolder tempDir = new TemporaryFolder();
+  @TempDir
+  private Path tempDir;
   private String datanodeUuid;
   private OzoneConfiguration conf;
   private HddsVolume hddsVolume;
 
-  private final ContainerLayoutVersion layout;
-  private final String schemaVersion;
+  private ContainerLayoutVersion layout;
+  private String schemaVersion;
   private String clusterID;
   private int containerIdNum = 0;
   private MutableVolumeSet volumeSet;
@@ -86,22 +84,22 @@ public class TestStaleRecoveringContainerScrubbingService {
   private final TestClock testClock =
       new TestClock(Instant.now(), ZoneOffset.UTC);
 
-  public TestStaleRecoveringContainerScrubbingService(
-      ContainerTestVersionInfo versionInfo) {
+  private void initVersionInfo(ContainerTestVersionInfo versionInfo)
+      throws IOException {
     this.layout = versionInfo.getLayout();
     this.schemaVersion = versionInfo.getSchemaVersion();
     conf = new OzoneConfiguration();
     ContainerTestVersionInfo.setTestSchemaVersion(schemaVersion, conf);
+    init();
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> versionInfo() {
     return ContainerTestVersionInfo.versionParameters();
   }
 
-  @Before
-  public void init() throws IOException {
-    File volumeDir = tempDir.newFolder();
+  private void init() throws IOException {
+    File volumeDir =
+        Files.createDirectory(tempDir.resolve("volumeDir")).toFile();
     conf.set(ScmConfigKeys.HDDS_DATANODE_DIR_KEY, volumeDir.getAbsolutePath());
     conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, volumeDir.getAbsolutePath());
     datanodeUuid = UUID.randomUUID().toString();
@@ -117,7 +115,7 @@ public class TestStaleRecoveringContainerScrubbingService {
         .thenReturn(hddsVolume);
   }
 
-  @After
+  @AfterEach
   public void cleanup() throws IOException {
     BlockUtils.shutdownCache(conf);
   }
@@ -150,9 +148,11 @@ public class TestStaleRecoveringContainerScrubbingService {
     return createdIds;
   }
 
-  @Test
-  public void testScrubbingStaleRecoveringContainers()
-      throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testScrubbingStaleRecoveringContainers(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    initVersionInfo(versionInfo);
     ContainerSet containerSet = new ContainerSet(10);
     containerSet.setClock(testClock);
     StaleRecoveringContainerScrubbingService srcss =
@@ -162,14 +162,14 @@ public class TestStaleRecoveringContainerScrubbingService {
             containerSet);
     testClock.fastForward(1000L);
     Map<Long, ContainerProtos.ContainerDataProto.State> containerStateMap =
-            new HashMap<>();
+        new HashMap<>();
     containerStateMap.putAll(createTestContainers(containerSet, 5, CLOSED)
             .stream().collect(Collectors.toMap(i -> i, i -> CLOSED)));
 
     testClock.fastForward(1000L);
     srcss.runPeriodicalTaskNow();
     //closed container should not be scrubbed
-    Assert.assertTrue(containerSet.containerCount() == 5);
+    Assertions.assertTrue(containerSet.containerCount() == 5);
 
     containerStateMap.putAll(createTestContainers(containerSet, 5,
             RECOVERING).stream()
@@ -177,9 +177,9 @@ public class TestStaleRecoveringContainerScrubbingService {
     testClock.fastForward(1000L);
     srcss.runPeriodicalTaskNow();
     //recovering container should be scrubbed since recovering timeout
-    Assert.assertEquals(10, containerSet.containerCount());
+    Assertions.assertEquals(10, containerSet.containerCount());
     for (Container<?> entry : containerSet) {
-      Assert.assertEquals(entry.getContainerState(),
+      Assertions.assertEquals(entry.getContainerState(),
               containerStateMap.get(entry.getContainerData().getContainerID()));
     }
 
@@ -191,9 +191,9 @@ public class TestStaleRecoveringContainerScrubbingService {
     testClock.fastForward(1000L);
     srcss.runPeriodicalTaskNow();
     //recovering container should not be scrubbed
-    Assert.assertEquals(15, containerSet.containerCount());
+    Assertions.assertEquals(15, containerSet.containerCount());
     for (Container<?> entry : containerSet) {
-      Assert.assertEquals(entry.getContainerState(),
+      Assertions.assertEquals(entry.getContainerState(),
               containerStateMap.get(entry.getContainerData().getContainerID()));
     }
   }
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerDataYaml.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerDataYaml.java
index c0843abb47..93f2a11a59 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerDataYaml.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerDataYaml.java
@@ -29,12 +29,11 @@ import org.apache.hadoop.ozone.OzoneConsts;
 import org.apache.hadoop.ozone.container.common.helpers.ContainerUtils;
 import org.apache.hadoop.ozone.container.keyvalue.ContainerLayoutTestInfo;
 import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
 import org.apache.hadoop.ozone.container.upgrade.VersionedDatanodeFeatures;
 import org.apache.ozone.test.GenericTestUtils;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import java.io.File;
 import java.io.IOException;
@@ -43,15 +42,14 @@ import java.time.Instant;
 import java.util.UUID;
 
 import static org.apache.hadoop.ozone.container.common.impl.ContainerLayoutVersion.FILE_PER_CHUNK;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 
 /**
  * This class tests create/read .container files.
  */
-@RunWith(Parameterized.class)
 public class TestContainerDataYaml {
 
   private long testContainerID = 1234;
@@ -64,15 +62,14 @@ public class TestContainerDataYaml {
   private static final String VOLUME_OWNER = "hdfs";
   private static final String CONTAINER_DB_TYPE = "RocksDB";
 
-  private final ContainerLayoutVersion layout;
+  private ContainerLayoutVersion layoutVersion;
   private OzoneConfiguration conf = new OzoneConfiguration();
-    
-  public TestContainerDataYaml(ContainerLayoutVersion layout) {
-    this.layout = layout;
+
+  private void setLayoutVersion(ContainerLayoutVersion layoutVersion) {
+    this.layoutVersion = layoutVersion;
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> layoutVersion() {
     return ContainerLayoutTestInfo.containerLayoutParameters();
   }
 
@@ -87,7 +84,7 @@ public class TestContainerDataYaml {
     String containerPath = containerID + ".container";
 
     KeyValueContainerData keyValueContainerData = new KeyValueContainerData(
-        containerID, layout, MAXSIZE,
+        containerID, layoutVersion, MAXSIZE,
         UUID.randomUUID().toString(),
         UUID.randomUUID().toString());
     keyValueContainerData.setContainerDBType(CONTAINER_DB_TYPE);
@@ -114,8 +111,11 @@ public class TestContainerDataYaml {
     FileUtil.fullyDelete(new File(testRoot));
   }
 
-  @Test
-  public void testCreateContainerFile() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testCreateContainerFile(ContainerLayoutVersion layout)
+      throws IOException {
+    setLayoutVersion(layout);
     long containerID = testContainerID++;
 
     File containerFile = createContainerFile(containerID, 7);
@@ -174,13 +174,16 @@ public class TestContainerDataYaml {
     assertEquals(MAXSIZE, kvData.getMaxSize());
     assertTrue(kvData.lastDataScanTime().isPresent());
     assertEquals(SCAN_TIME.toEpochMilli(),
-                 kvData.lastDataScanTime().get().toEpochMilli());
+        kvData.lastDataScanTime().get().toEpochMilli());
     assertEquals(SCAN_TIME.toEpochMilli(),
-                 kvData.getDataScanTimestamp().longValue());
+        kvData.getDataScanTimestamp().longValue());
   }
 
-  @Test
-  public void testCreateContainerFileWithoutReplicaIndex() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testCreateContainerFileWithoutReplicaIndex(
+      ContainerLayoutVersion layout) throws IOException {
+    setLayoutVersion(layout);
     long containerID = testContainerID++;
 
     File containerFile = createContainerFile(containerID, 0);
@@ -188,14 +191,17 @@ public class TestContainerDataYaml {
     final String content =
         FileUtils.readFileToString(containerFile, Charset.defaultCharset());
 
-    Assert.assertFalse("ReplicaIndex shouldn't be persisted if zero",
-        content.contains("replicaIndex"));
+    Assertions.assertFalse(content.contains("replicaIndex"),
+        "ReplicaIndex shouldn't be persisted if zero");
     cleanup();
   }
 
 
-  @Test
-  public void testIncorrectContainerFile() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testIncorrectContainerFile(ContainerLayoutVersion layout)
+      throws IOException {
+    setLayoutVersion(layout);
     try {
       String containerFile = "incorrect.container";
       //Get file from resources folder
@@ -210,9 +216,11 @@ public class TestContainerDataYaml {
   }
 
 
-  @Test
-  public void testCheckBackWardCompatibilityOfContainerFile() throws
-      IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testCheckBackWardCompatibilityOfContainerFile(
+      ContainerLayoutVersion layout) {
+    setLayoutVersion(layout);
     // This test is for if we upgrade, and then .container files added by new
     // server will have new fields added to .container file, after a while we
     // decided to rollback. Then older ozone can read .container files
@@ -250,8 +258,11 @@ public class TestContainerDataYaml {
   /**
    * Test to verify {@link ContainerUtils#verifyChecksum(ContainerData)}.
    */
-  @Test
-  public void testChecksumInContainerFile() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testChecksumInContainerFile(ContainerLayoutVersion layout)
+      throws IOException {
+    setLayoutVersion(layout);
     long containerID = testContainerID++;
 
     File containerFile = createContainerFile(containerID, 0);
@@ -267,8 +278,11 @@ public class TestContainerDataYaml {
   /**
    * Test to verify {@link ContainerUtils#verifyChecksum(ContainerData)}.
    */
-  @Test
-  public void testChecksumInContainerFileWithReplicaIndex() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testChecksumInContainerFileWithReplicaIndex(
+      ContainerLayoutVersion layout) throws IOException {
+    setLayoutVersion(layout);
     long containerID = testContainerID++;
 
     File containerFile = createContainerFile(containerID, 10);
@@ -292,8 +306,10 @@ public class TestContainerDataYaml {
   /**
    * Test to verify incorrect checksum is detected.
    */
-  @Test
-  public void testIncorrectChecksum() {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testIncorrectChecksum(ContainerLayoutVersion layout) {
+    setLayoutVersion(layout);
     try {
       KeyValueContainerData kvData = getKeyValueContainerData();
       ContainerUtils.verifyChecksum(kvData, conf);
@@ -307,11 +323,14 @@ public class TestContainerDataYaml {
   /**
    * Test to verify disabled checksum with incorrect checksum.
    */
-  @Test
-  public void testDisabledChecksum() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testDisabledChecksum(ContainerLayoutVersion layout)
+      throws IOException {
+    setLayoutVersion(layout);
     KeyValueContainerData kvData = getKeyValueContainerData();
     conf.setBoolean(HddsConfigKeys.
-                    HDDS_CONTAINER_CHECKSUM_VERIFICATION_ENABLED, false);
+        HDDS_CONTAINER_CHECKSUM_VERIFICATION_ENABLED, false);
     ContainerUtils.verifyChecksum(kvData, conf);
   }
 }
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerDeletionChoosingPolicy.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerDeletionChoosingPolicy.java
index 67338f860d..b4eb706453 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerDeletionChoosingPolicy.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerDeletionChoosingPolicy.java
@@ -41,17 +41,15 @@ import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
 import org.apache.hadoop.ozone.container.common.impl.BlockDeletingService.ContainerBlockInfo;
 import org.apache.hadoop.ozone.container.ozoneimpl.OzoneContainer;
 import org.apache.ozone.test.GenericTestUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.mockito.Mockito;
 
 /**
  * The class for testing container deletion choosing policy.
  */
-@RunWith(Parameterized.class)
 public class TestContainerDeletionChoosingPolicy {
   private String path;
   private OzoneContainer ozoneContainer;
@@ -62,31 +60,33 @@ public class TestContainerDeletionChoosingPolicy {
   private static final int SERVICE_TIMEOUT_IN_MILLISECONDS = 0;
   private static final int SERVICE_INTERVAL_IN_MILLISECONDS = 1000;
 
-  private final ContainerLayoutVersion layout;
+  private ContainerLayoutVersion layoutVersion;
 
-  public TestContainerDeletionChoosingPolicy(ContainerLayoutVersion layout) {
-    this.layout = layout;
+  public void setLayoutVersion(ContainerLayoutVersion layout) {
+    this.layoutVersion = layout;
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> layoutVersion() {
     return ContainerLayoutTestInfo.containerLayoutParameters();
   }
 
-  @Before
+  @BeforeEach
   public void init() throws Throwable {
     conf = new OzoneConfiguration();
     path = GenericTestUtils
         .getTempPath(TestContainerDeletionChoosingPolicy.class.getSimpleName());
   }
 
-  @Test
-  public void testRandomChoosingPolicy() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testRandomChoosingPolicy(ContainerLayoutVersion layout)
+      throws IOException {
+    setLayoutVersion(layout);
     File containerDir = new File(path);
     if (containerDir.exists()) {
       FileUtils.deleteDirectory(new File(path));
     }
-    Assert.assertTrue(containerDir.mkdirs());
+    Assertions.assertTrue(containerDir.mkdirs());
 
     conf.set(
         ScmConfigKeys.OZONE_SCM_KEY_VALUE_CONTAINER_DELETION_CHOOSING_POLICY,
@@ -105,7 +105,7 @@ public class TestContainerDeletionChoosingPolicy {
       data.closeContainer();
       KeyValueContainer container = new KeyValueContainer(data, conf);
       containerSet.addContainer(container);
-      Assert.assertTrue(
+      Assertions.assertTrue(
           containerSet.getContainerMapCopy()
               .containsKey(data.getContainerID()));
     }
@@ -121,7 +121,7 @@ public class TestContainerDeletionChoosingPolicy {
     for (ContainerBlockInfo pr : result0) {
       totPendingBlocks += pr.getNumBlocksToDelete();
     }
-    Assert.assertTrue(totPendingBlocks >= blockLimitPerInterval);
+    Assertions.assertTrue(totPendingBlocks >= blockLimitPerInterval);
 
     // test random choosing. We choose 100 times the 3 datanodes twice.
     //We expect different order at least once.
@@ -133,22 +133,25 @@ public class TestContainerDeletionChoosingPolicy {
       boolean hasShuffled = false;
       for (int i = 0; i < result1.size(); i++) {
         if (result1.get(i).getContainerData().getContainerID() != result2.get(i)
-                .getContainerData().getContainerID()) {
+            .getContainerData().getContainerID()) {
           return;
         }
       }
     }
-    Assert.fail("Chosen container results were same 100 times");
+    Assertions.fail("Chosen container results were same 100 times");
 
   }
 
-  @Test
-  public void testTopNOrderedChoosingPolicy() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testTopNOrderedChoosingPolicy(ContainerLayoutVersion layout)
+      throws IOException {
+    setLayoutVersion(layout);
     File containerDir = new File(path);
     if (containerDir.exists()) {
       FileUtils.deleteDirectory(new File(path));
     }
-    Assert.assertTrue(containerDir.mkdirs());
+    Assertions.assertTrue(containerDir.mkdirs());
 
     conf.set(
         ScmConfigKeys.OZONE_SCM_KEY_VALUE_CONTAINER_DELETION_CHOOSING_POLICY,
@@ -179,7 +182,7 @@ public class TestContainerDeletionChoosingPolicy {
       KeyValueContainer container = new KeyValueContainer(data, conf);
       data.closeContainer();
       containerSet.addContainer(container);
-      Assert.assertTrue(
+      Assertions.assertTrue(
           containerSet.getContainerMapCopy().containsKey(containerId));
     }
     numberOfBlocks.sort(Collections.reverseOrder());
@@ -193,7 +196,7 @@ public class TestContainerDeletionChoosingPolicy {
     for (ContainerBlockInfo pr : result0) {
       totPendingBlocks += pr.getNumBlocksToDelete();
     }
-    Assert.assertTrue(totPendingBlocks >= blockLimitPerInterval);
+    Assertions.assertTrue(totPendingBlocks >= blockLimitPerInterval);
 
 
     List<ContainerBlockInfo> result1 = blockDeletingService
@@ -208,7 +211,7 @@ public class TestContainerDeletionChoosingPolicy {
         break;
       }
     }
-    Assert.assertEquals(containerCount, result1.size());
+    Assertions.assertEquals(containerCount, result1.size());
 
     // verify the order of return list
     int initialName2CountSize = name2Count.size();
@@ -217,11 +220,11 @@ public class TestContainerDeletionChoosingPolicy {
       int currentCount =
           name2Count.remove(data.getContainerData().getContainerID());
       // previous count should not smaller than next one
-      Assert.assertTrue(currentCount > 0 && currentCount <= lastCount);
+      Assertions.assertTrue(currentCount > 0 && currentCount <= lastCount);
       lastCount = currentCount;
     }
     // ensure all the container data are compared
-    Assert.assertEquals(result1.size(),
+    Assertions.assertEquals(result1.size(),
         initialName2CountSize - name2Count.size());
   }
 
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java
index 72d8b33c9a..a3312f6773 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java
@@ -77,30 +77,31 @@ import org.apache.ozone.test.GenericTestUtils;
 
 import com.google.common.collect.Maps;
 import org.apache.commons.io.FileUtils;
+
 import static org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.Result.BCSID_MISMATCH;
 import static org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.Result.UNKNOWN_BCSID;
 import static org.apache.hadoop.ozone.container.ContainerTestHelper.getChunk;
 import static org.apache.hadoop.ozone.container.ContainerTestHelper.getData;
 import static org.apache.hadoop.ozone.container.ContainerTestHelper.setDataChecksum;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Assert;
+
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
 
 import static org.apache.hadoop.ozone.container.keyvalue.helpers.KeyValueContainerUtil.isSameSchemaVersion;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeFalse;
-import static org.junit.Assume.assumeTrue;
-
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-import org.apache.ozone.test.JUnit5AwareTimeout;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -109,11 +110,11 @@ import org.slf4j.LoggerFactory;
  * these tests are specific to {@link KeyValueContainer}. If a new {@link
  * ContainerProtos.ContainerType} is added, the tests need to be modified.
  */
-@RunWith(Parameterized.class)
+@Timeout(300)
 public class TestContainerPersistence {
   private static final String DATANODE_UUID = UUID.randomUUID().toString();
   private static final String SCM_ID = UUID.randomUUID().toString();
-  private static Logger log =
+  private static final Logger LOGGER =
       LoggerFactory.getLogger(TestContainerPersistence.class);
   private static String hddsPath;
   private static OzoneConfiguration conf;
@@ -124,29 +125,24 @@ public class TestContainerPersistence {
   private BlockManager blockManager;
   private ChunkManager chunkManager;
 
-  @Rule
-  public ExpectedException exception = ExpectedException.none();
   /**
    * Set the timeout for every test.
    */
-  @Rule
-  public TestRule testTimeout = new JUnit5AwareTimeout(Timeout.seconds(300));
 
-  private final ContainerLayoutVersion layout;
-  private final String schemaVersion;
+  private ContainerLayoutVersion layout;
+  private String schemaVersion;
 
-  public TestContainerPersistence(ContainerTestVersionInfo versionInfo) {
+  private void initSchemaAndVersionInfo(ContainerTestVersionInfo versionInfo) {
     this.layout = versionInfo.getLayout();
     this.schemaVersion = versionInfo.getSchemaVersion();
     ContainerTestVersionInfo.setTestSchemaVersion(schemaVersion, conf);
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> versionInfo() {
     return ContainerTestVersionInfo.versionParameters();
   }
 
-  @BeforeClass
+  @BeforeAll
   public static void init() {
     conf = new OzoneConfiguration();
     hddsPath = GenericTestUtils
@@ -156,12 +152,12 @@ public class TestContainerPersistence {
     volumeChoosingPolicy = new RoundRobinVolumeChoosingPolicy();
   }
 
-  @AfterClass
+  @AfterAll
   public static void shutdown() throws IOException {
     FileUtils.deleteDirectory(new File(hddsPath));
   }
 
-  @Before
+  @BeforeEach
   public void setupPaths() throws IOException {
     containerSet = new ContainerSet(1000);
     volumeSet = new MutableVolumeSet(DATANODE_UUID, conf, null,
@@ -171,7 +167,7 @@ public class TestContainerPersistence {
         volumeSet.getVolumesList())) {
       boolean success = StorageVolumeUtil.checkVolume(volume, SCM_ID, SCM_ID,
           conf, null, null);
-      Assert.assertTrue(success);
+      Assertions.assertTrue(success);
     }
     blockManager = new BlockManagerImpl(conf);
     chunkManager = ChunkManagerFactory.createChunkManager(conf, blockManager,
@@ -183,13 +179,13 @@ public class TestContainerPersistence {
     }
   }
 
-  @After
+  @AfterEach
   public void cleanupDir() throws IOException {
     // Cleanup cache
     BlockUtils.shutdownCache(conf);
 
     // Clean up SCM metadata
-    log.info("Deleting {}", hddsPath);
+    LOGGER.info("Deleting {}", hddsPath);
     FileUtils.deleteDirectory(new File(hddsPath));
 
     // Clean up SCM datanode container metadata/data
@@ -223,42 +219,42 @@ public class TestContainerPersistence {
         .getVolume().getCommittedBytes();
     commitIncrement = commitBytesAfter - commitBytesBefore;
     // did we commit space for the new container?
-    Assert.assertTrue(commitIncrement ==
+    assertEquals(commitIncrement,
         ContainerTestHelper.CONTAINER_MAX_SIZE);
     return container;
   }
 
-  @Test
-  public void testCreateContainer() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testCreateContainer(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    initSchemaAndVersionInfo(versionInfo);
     long testContainerID = getTestContainerID();
     addContainer(containerSet, testContainerID);
-    Assert.assertTrue(containerSet.getContainerMapCopy()
+    Assertions.assertTrue(containerSet.getContainerMapCopy()
         .containsKey(testContainerID));
     KeyValueContainerData kvData =
         (KeyValueContainerData) containerSet.getContainer(testContainerID)
             .getContainerData();
 
-    Assert.assertNotNull(kvData);
-    Assert.assertTrue(new File(kvData.getMetadataPath()).exists());
-    Assert.assertTrue(new File(kvData.getChunksPath()).exists());
-    Assert.assertTrue(kvData.getDbFile().exists());
+    Assertions.assertNotNull(kvData);
+    Assertions.assertTrue(new File(kvData.getMetadataPath()).exists());
+    Assertions.assertTrue(new File(kvData.getChunksPath()).exists());
+    Assertions.assertTrue(kvData.getDbFile().exists());
 
     Path meta = kvData.getDbFile().toPath().getParent();
-    Assert.assertTrue(meta != null && Files.exists(meta));
+    Assertions.assertTrue(meta != null && Files.exists(meta));
 
-    DBHandle store = null;
-    try {
-      store = BlockUtils.getDB(kvData, conf);
-      Assert.assertNotNull(store);
-    } finally {
-      if (store != null) {
-        store.close();
-      }
+    try (DBHandle store = BlockUtils.getDB(kvData, conf)) {
+      Assertions.assertNotNull(store);
     }
   }
 
-  @Test
-  public void testCreateDuplicateContainer() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testCreateDuplicateContainer(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    initSchemaAndVersionInfo(versionInfo);
     long testContainerID = getTestContainerID();
 
     Container container = addContainer(containerSet, testContainerID);
@@ -266,12 +262,15 @@ public class TestContainerPersistence {
       containerSet.addContainer(container);
       fail("Expected Exception not thrown.");
     } catch (IOException ex) {
-      Assert.assertNotNull(ex);
+      Assertions.assertNotNull(ex);
     }
   }
 
-  @Test
-  public void testAddingBlockToDeletedContainer() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testAddingBlockToDeletedContainer(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    initSchemaAndVersionInfo(versionInfo);
     // With schema v3, we don't have a container dedicated db,
     // so skip check the behaviors related to it.
     assumeFalse(isSameSchemaVersion(schemaVersion, OzoneConsts.SCHEMA_V3));
@@ -283,32 +282,36 @@ public class TestContainerPersistence {
         addContainer(containerSet, testContainerID);
     container.close();
 
-    Assert.assertTrue(containerSet.getContainerMapCopy()
+    Assertions.assertTrue(containerSet.getContainerMapCopy()
         .containsKey(testContainerID));
 
     KeyValueContainerUtil.removeContainer(container.getContainerData(), conf);
     container.delete();
     containerSet.removeContainer(testContainerID);
-    Assert.assertFalse(containerSet.getContainerMapCopy()
+    Assertions.assertFalse(containerSet.getContainerMapCopy()
         .containsKey(testContainerID));
 
     // Adding block to a deleted container should fail.
-    exception.expect(StorageContainerException.class);
-    exception.expectMessage("Error opening DB.");
     BlockID blockID = ContainerTestHelper.getTestBlockID(testContainerID);
     BlockData someKey = new BlockData(blockID);
     someKey.setChunks(new LinkedList<>());
-    blockManager.putBlock(container, someKey);
+    Exception exception = assertThrows(StorageContainerException.class,
+        () -> blockManager.putBlock(container, someKey));
+    assertThat(exception.getMessage(),
+        Matchers.containsString("Error opening DB."));
   }
 
-  @Test
-  public void testDeleteNonEmptyContainer() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testDeleteNonEmptyContainer(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    initSchemaAndVersionInfo(versionInfo);
     long testContainerID = getTestContainerID();
     Container<KeyValueContainerData> container =
         addContainer(containerSet, testContainerID);
     container.close();
 
-    Assert.assertTrue(containerSet.getContainerMapCopy()
+    Assertions.assertTrue(containerSet.getContainerMapCopy()
         .containsKey(testContainerID));
 
     // Deleting a non-empty container should fail.
@@ -327,23 +330,28 @@ public class TestContainerPersistence {
         datanodeId, containerSet, volumeSet, metrics,
         c -> icrReceived.incrementAndGet());
 
-    exception.expect(StorageContainerException.class);
-    exception.expectMessage(
-        "Non-force deletion of non-empty container is not allowed.");
-    kvHandler.deleteContainer(container, false);
-    Assert.assertTrue(containerSet.getContainerMapCopy()
+    Exception exception = Assertions.assertThrows(
+        StorageContainerException.class,
+        () -> kvHandler.deleteContainer(container, false));
+    Assertions.assertTrue(containerSet.getContainerMapCopy()
         .containsKey(testContainerID));
+    assertThat(exception.getMessage(),
+        Matchers.containsString(
+            "Non-force deletion of non-empty container is not allowed."));
   }
 
-  @Test
-  public void testDeleteContainer() throws IOException {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testDeleteContainer(ContainerTestVersionInfo versionInfo)
+      throws IOException {
+    initSchemaAndVersionInfo(versionInfo);
     assumeTrue(isSameSchemaVersion(schemaVersion, OzoneConsts.SCHEMA_V3));
     long testContainerID = getTestContainerID();
     Container<KeyValueContainerData> container = addContainer(containerSet,
         testContainerID);
     BlockID blockID = addBlockToContainer(container);
     container.close();
-    Assert.assertTrue(containerSet.getContainerMapCopy()
+    Assertions.assertTrue(containerSet.getContainerMapCopy()
         .containsKey(testContainerID));
     KeyValueContainerData containerData = container.getContainerData();
 
@@ -355,7 +363,7 @@ public class TestContainerPersistence {
         container.getContainerData().getVolume().getConf());
     container.delete();
     containerSet.removeContainer(testContainerID);
-    Assert.assertFalse(containerSet.getContainerMapCopy()
+    Assertions.assertFalse(containerSet.getContainerMapCopy()
         .containsKey(testContainerID));
 
     // Block data and metadata tables should be cleared.
@@ -376,9 +384,9 @@ public class TestContainerPersistence {
       Table<String, Long> metadataTable = store.getMetadataTable();
 
       // Block data and metadata tables should have data.
-      Assert.assertNotNull(blockTable
+      Assertions.assertNotNull(blockTable
           .getIfExist(containerData.getBlockKey(testBlock.getLocalID())));
-      Assert.assertNotNull(metadataTable
+      Assertions.assertNotNull(metadataTable
           .getIfExist(containerData.getBlockCountKey()));
     }
   }
@@ -398,9 +406,9 @@ public class TestContainerPersistence {
       Table<String, Long> metadataTable = store.getMetadataTable();
 
       // Block data and metadata tables should have data.
-      Assert.assertNull(blockTable
+      Assertions.assertNull(blockTable
           .getIfExist(containerData.getBlockKey(testBlock.getLocalID())));
-      Assert.assertNull(metadataTable
+      Assertions.assertNull(metadataTable
           .getIfExist(containerData.getBlockCountKey()));
     }
   }
@@ -423,11 +431,14 @@ public class TestContainerPersistence {
    * If SchemaV3 is enabled, HddsVolume has already been
    * formatted and initialized in
    * setupPaths#createDbInstancesForTestIfNeeded.
+   *
    * @throws Exception
    */
-  @Test
-  public void testDeleteContainerWithRenaming()
-      throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testDeleteContainerWithRenaming(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    initSchemaAndVersionInfo(versionInfo);
     // Set up container 1.
     long testContainerID1 = getTestContainerID();
     Container<KeyValueContainerData> container1 =
@@ -446,9 +457,9 @@ public class TestContainerPersistence {
     KeyValueContainerData container2Data = container2.getContainerData();
     assertContainerInSchema3DB(container2Data, container2Block);
 
-    Assert.assertTrue(containerSet.getContainerMapCopy()
+    Assertions.assertTrue(containerSet.getContainerMapCopy()
         .containsKey(testContainerID1));
-    Assert.assertTrue(containerSet.getContainerMapCopy()
+    Assertions.assertTrue(containerSet.getContainerMapCopy()
         .containsKey(testContainerID2));
 
     // Since this test only uses one volume, both containers will reside in
@@ -457,11 +468,12 @@ public class TestContainerPersistence {
     // Volume setup should have created the tmp directory for container
     // deletion.
     File volumeTmpDir = hddsVolume.getTmpDir();
-    Assert.assertTrue(String.format("Volume level tmp dir %s not created.",
-            volumeTmpDir), volumeTmpDir.exists());
+    Assertions.assertTrue(volumeTmpDir.exists(), String.format("Volume level " +
+        "tmp dir %s not created.", volumeTmpDir));
     File deletedContainerDir = hddsVolume.getDeletedContainerDir();
-    Assert.assertTrue(String.format("Volume level container deleted directory" +
-        " %s not created.", deletedContainerDir), deletedContainerDir.exists());
+    Assertions.assertTrue(deletedContainerDir.exists(),
+        String.format("Volume level container deleted directory" +
+            " %s not created.", deletedContainerDir));
 
     // Move containers to delete directory. RocksDB should not yet be updated.
     KeyValueContainerUtil.moveToDeletedContainerDir(container1Data, hddsVolume);
@@ -471,17 +483,17 @@ public class TestContainerPersistence {
 
     // Both containers should be present in the deleted directory.
     File[] deleteDirFilesArray = deletedContainerDir.listFiles();
-    Assert.assertNotNull(deleteDirFilesArray);
+    Assertions.assertNotNull(deleteDirFilesArray);
     Set<File> deleteDirFiles = Arrays.stream(deleteDirFilesArray)
         .collect(Collectors.toSet());
-    Assert.assertEquals(2, deleteDirFiles.size());
+    assertEquals(2, deleteDirFiles.size());
 
     File container1Dir = KeyValueContainerUtil.getTmpDirectoryPath(
         container1Data, hddsVolume).toFile();
-    Assert.assertTrue(deleteDirFiles.contains(container1Dir));
+    Assertions.assertTrue(deleteDirFiles.contains(container1Dir));
     File container2Dir = KeyValueContainerUtil.getTmpDirectoryPath(
         container2Data, hddsVolume).toFile();
-    Assert.assertTrue(deleteDirFiles.contains(container2Dir));
+    Assertions.assertTrue(deleteDirFiles.contains(container2Dir));
 
     // Delete container1 from the disk. Container2 should remain in the
     // deleted containers directory.
@@ -494,9 +506,9 @@ public class TestContainerPersistence {
 
     // Check the delete directory again. Only container 2 should remain.
     deleteDirFilesArray = deletedContainerDir.listFiles();
-    Assert.assertNotNull(deleteDirFilesArray);
-    Assert.assertEquals(1, deleteDirFilesArray.length);
-    Assert.assertEquals(deleteDirFilesArray[0], container2Dir);
+    Assertions.assertNotNull(deleteDirFilesArray);
+    assertEquals(1, deleteDirFilesArray.length);
+    assertEquals(deleteDirFilesArray[0], container2Dir);
 
     // Delete container2 from the disk.
     KeyValueContainerUtil.removeContainerDB(
@@ -509,19 +521,22 @@ public class TestContainerPersistence {
     // Remove containers from containerSet
     containerSet.removeContainer(testContainerID1);
     containerSet.removeContainer(testContainerID2);
-    Assert.assertFalse(containerSet.getContainerMapCopy()
+    Assertions.assertFalse(containerSet.getContainerMapCopy()
         .containsKey(testContainerID1));
-    Assert.assertFalse(containerSet.getContainerMapCopy()
+    Assertions.assertFalse(containerSet.getContainerMapCopy()
         .containsKey(testContainerID2));
 
     // Deleted containers directory should now be empty.
     deleteDirFilesArray = deletedContainerDir.listFiles();
-    Assert.assertNotNull(deleteDirFilesArray);
-    Assert.assertEquals(0, deleteDirFilesArray.length);
+    Assertions.assertNotNull(deleteDirFilesArray);
+    assertEquals(0, deleteDirFilesArray.length);
   }
 
-  @Test
-  public void testGetContainerReports() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testGetContainerReports(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    initSchemaAndVersionInfo(versionInfo);
     final int count = 10;
     List<Long> containerIDs = new ArrayList<>();
 
@@ -540,13 +555,13 @@ public class TestContainerPersistence {
     // and closed) reports.
     List<StorageContainerDatanodeProtocolProtos.ContainerReplicaProto> reports =
         containerSet.getContainerReport().getReportsList();
-    Assert.assertEquals(10, reports.size());
+    assertEquals(10, reports.size());
     for (StorageContainerDatanodeProtocolProtos.ContainerReplicaProto report :
         reports) {
       long actualContainerID = report.getContainerID();
-      Assert.assertTrue(containerIDs.remove(actualContainerID));
+      Assertions.assertTrue(containerIDs.remove(actualContainerID));
     }
-    Assert.assertTrue(containerIDs.isEmpty());
+    Assertions.assertTrue(containerIDs.isEmpty());
   }
 
   /**
@@ -555,8 +570,11 @@ public class TestContainerPersistence {
    *
    * @throws IOException
    */
-  @Test
-  public void testListContainer() throws IOException {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testListContainer(ContainerTestVersionInfo versionInfo)
+      throws IOException {
+    initSchemaAndVersionInfo(versionInfo);
     final int count = 10;
     final int step = 5;
 
@@ -579,13 +597,13 @@ public class TestContainerPersistence {
       long nextKey = results.get(results.size() - 1).getContainerID();
 
       //Assert that container is returning results in a sorted fashion.
-      Assert.assertTrue(prevKey < nextKey);
+      Assertions.assertTrue(prevKey < nextKey);
       prevKey = nextKey + 1;
       results.clear();
     }
     // Assert that we listed all the keys that we had put into
     // container.
-    Assert.assertTrue(testMap.isEmpty());
+    Assertions.assertTrue(testMap.isEmpty());
   }
 
   private ChunkInfo writeChunkHelper(BlockID blockID) throws IOException {
@@ -610,7 +628,7 @@ public class TestContainerPersistence {
         .getVolume().getCommittedBytes();
     commitDecrement = commitBytesBefore - commitBytesAfter;
     // did we decrement commit bytes by the amount of data we wrote?
-    Assert.assertTrue(commitDecrement == info.getLen());
+    Assertions.assertTrue(commitDecrement == info.getLen());
     return info;
 
   }
@@ -621,9 +639,11 @@ public class TestContainerPersistence {
    * @throws IOException
    * @throws NoSuchAlgorithmException
    */
-  @Test
-  public void testWriteChunk() throws IOException,
-      NoSuchAlgorithmException {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testWriteChunk(ContainerTestVersionInfo versionInfo)
+      throws IOException {
+    initSchemaAndVersionInfo(versionInfo);
     BlockID blockID = ContainerTestHelper.
         getTestBlockID(getTestContainerID());
     writeChunkHelper(blockID);
@@ -636,8 +656,11 @@ public class TestContainerPersistence {
    * @throws IOException
    * @throws NoSuchAlgorithmException
    */
-  @Test
-  public void testWritReadManyChunks() throws IOException {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testWritReadManyChunks(ContainerTestVersionInfo versionInfo)
+      throws IOException {
+    initSchemaAndVersionInfo(versionInfo);
     final int datalen = 1024;
     final int chunkCount = 1024;
 
@@ -660,7 +683,7 @@ public class TestContainerPersistence {
 
     KeyValueContainerData cNewData =
         (KeyValueContainerData) container.getContainerData();
-    Assert.assertNotNull(cNewData);
+    Assertions.assertNotNull(cNewData);
     Path dataDir = Paths.get(cNewData.getChunksPath());
 
     // Read chunk via file system and verify.
@@ -672,7 +695,7 @@ public class TestContainerPersistence {
       final ChunkBuffer data = chunkManager.readChunk(container, blockID, info,
           DispatcherContext.getHandleReadChunk());
       ChecksumData checksumData = checksum.computeChecksum(data);
-      Assert.assertEquals(info.getChecksumData(), checksumData);
+      assertEquals(info.getChecksumData(), checksumData);
     }
   }
 
@@ -681,11 +704,12 @@ public class TestContainerPersistence {
    * flag then re-tries with overwrite flag.
    *
    * @throws IOException
-   * @throws NoSuchAlgorithmException
    */
-  @Test
-  public void testOverWrite() throws IOException,
-      NoSuchAlgorithmException {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testOverWrite(ContainerTestVersionInfo versionInfo)
+      throws IOException {
+    initSchemaAndVersionInfo(versionInfo);
     final int datalen = 1024;
 
     long testContainerID = getTestContainerID();
@@ -707,21 +731,22 @@ public class TestContainerPersistence {
     chunkManager.writeChunk(container, blockID, info, data,
         DispatcherContext.getHandleWriteChunk());
     long bytesUsed = container.getContainerData().getBytesUsed();
-    Assert.assertEquals(datalen, bytesUsed);
+    assertEquals(datalen, bytesUsed);
 
     long bytesWrite = container.getContainerData().getWriteBytes();
-    Assert.assertEquals(datalen * 3, bytesWrite);
+    assertEquals(datalen * 3, bytesWrite);
   }
 
   /**
    * Writes a chunk and deletes it, re-reads to make sure it is gone.
    *
    * @throws IOException
-   * @throws NoSuchAlgorithmException
    */
-  @Test
-  public void testDeleteChunk() throws IOException,
-      NoSuchAlgorithmException {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testDeleteChunk(ContainerTestVersionInfo versionInfo)
+      throws IOException {
+    initSchemaAndVersionInfo(versionInfo);
     final int datalen = 1024;
     long testContainerID = getTestContainerID();
     Container container = addContainer(containerSet, testContainerID);
@@ -734,19 +759,21 @@ public class TestContainerPersistence {
     chunkManager.writeChunk(container, blockID, info, data,
         DispatcherContext.getHandleWriteChunk());
     chunkManager.deleteChunk(container, blockID, info);
-    exception.expect(StorageContainerException.class);
-    chunkManager.readChunk(container, blockID, info,
-        DispatcherContext.getHandleReadChunk());
+    Assertions.assertThrows(StorageContainerException.class,
+        () -> chunkManager.readChunk(
+            container, blockID, info, DispatcherContext.getHandleReadChunk()));
   }
 
   /**
    * Tests a put block and read block.
    *
    * @throws IOException
-   * @throws NoSuchAlgorithmException
    */
-  @Test
-  public void testPutBlock() throws IOException, NoSuchAlgorithmException {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testPutBlock(ContainerTestVersionInfo versionInfo)
+      throws IOException {
+    initSchemaAndVersionInfo(versionInfo);
     long testContainerID = getTestContainerID();
     Container container = addContainer(containerSet, testContainerID);
 
@@ -761,18 +788,19 @@ public class TestContainerPersistence {
         getBlock(container, blockData.getBlockID());
     ChunkInfo readChunk =
         ChunkInfo.getFromProtoBuf(readBlockData.getChunks().get(0));
-    Assert.assertEquals(info.getChecksumData(), readChunk.getChecksumData());
+    assertEquals(info.getChecksumData(), readChunk.getChecksumData());
   }
 
   /**
    * Tests a put block and read block with invalid bcsId.
    *
    * @throws IOException
-   * @throws NoSuchAlgorithmException
    */
-  @Test
-  public void testPutBlockWithInvalidBCSId()
-      throws IOException, NoSuchAlgorithmException {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testPutBlockWithInvalidBCSId(ContainerTestVersionInfo versionInfo)
+      throws IOException {
+    initSchemaAndVersionInfo(versionInfo);
     long testContainerID = getTestContainerID();
     Container container = addContainer(containerSet, testContainerID);
 
@@ -800,9 +828,9 @@ public class TestContainerPersistence {
       // read with bcsId higher than container bcsId
       blockManager.
           getBlock(container, blockID1);
-      Assert.fail("Expected exception not thrown");
+      Assertions.fail("Expected exception not thrown");
     } catch (StorageContainerException sce) {
-      Assert.assertTrue(sce.getResult() == UNKNOWN_BCSID);
+      Assertions.assertTrue(sce.getResult() == UNKNOWN_BCSID);
     }
 
     try {
@@ -811,26 +839,27 @@ public class TestContainerPersistence {
       // bcsId.
       blockManager.
           getBlock(container, blockID1);
-      Assert.fail("Expected exception not thrown");
+      Assertions.fail("Expected exception not thrown");
     } catch (StorageContainerException sce) {
-      Assert.assertTrue(sce.getResult() == BCSID_MISMATCH);
+      Assertions.assertTrue(sce.getResult() == BCSID_MISMATCH);
     }
     readBlockData = blockManager.
         getBlock(container, blockData.getBlockID());
     ChunkInfo readChunk =
         ChunkInfo.getFromProtoBuf(readBlockData.getChunks().get(0));
-    Assert.assertEquals(info.getChecksumData(), readChunk.getChecksumData());
+    assertEquals(info.getChecksumData(), readChunk.getChecksumData());
   }
 
   /**
    * Tests a put block and read block.
    *
    * @throws IOException
-   * @throws NoSuchAlgorithmException
    */
-  @Test
-  public void testPutBlockWithLotsOfChunks() throws IOException,
-      NoSuchAlgorithmException {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testPutBlockWithLotsOfChunks(ContainerTestVersionInfo versionInfo)
+      throws IOException {
+    initSchemaAndVersionInfo(versionInfo);
     final int chunkCount = 2;
     final int datalen = 1024;
     long totalSize = 0L;
@@ -850,13 +879,13 @@ public class TestContainerPersistence {
     }
 
     long bytesUsed = container.getContainerData().getBytesUsed();
-    Assert.assertEquals(totalSize, bytesUsed);
+    assertEquals(totalSize, bytesUsed);
     long writeBytes = container.getContainerData().getWriteBytes();
-    Assert.assertEquals(chunkCount * datalen, writeBytes);
+    assertEquals(chunkCount * datalen, writeBytes);
     long readCount = container.getContainerData().getReadCount();
-    Assert.assertEquals(0, readCount);
+    assertEquals(0, readCount);
     long writeCount = container.getContainerData().getWriteCount();
-    Assert.assertEquals(chunkCount, writeCount);
+    assertEquals(chunkCount, writeCount);
 
     BlockData blockData = new BlockData(blockID);
     List<ContainerProtos.ChunkInfo> chunkProtoList = new LinkedList<>();
@@ -871,7 +900,7 @@ public class TestContainerPersistence {
     ChunkInfo readChunk =
         ChunkInfo.getFromProtoBuf(readBlockData.getChunks().get(readBlockData
             .getChunks().size() - 1));
-    Assert.assertEquals(
+    assertEquals(
         lastChunk.getChecksumData(), readChunk.getChecksumData());
   }
 
@@ -881,14 +910,17 @@ public class TestContainerPersistence {
    *
    * @throws IOException
    */
-  @Test
-  public void testUpdateContainer() throws IOException {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testUpdateContainer(ContainerTestVersionInfo versionInfo)
+      throws IOException {
+    initSchemaAndVersionInfo(versionInfo);
     long testContainerID = ContainerTestHelper.getTestContainerID();
     KeyValueContainer container =
         (KeyValueContainer) addContainer(containerSet, testContainerID);
 
     File orgContainerFile = container.getContainerFile();
-    Assert.assertTrue(orgContainerFile.exists());
+    Assertions.assertTrue(orgContainerFile.exists());
 
     Map<String, String> newMetadata = Maps.newHashMap();
     newMetadata.put("VOLUME", "shire_new");
@@ -896,33 +928,33 @@ public class TestContainerPersistence {
 
     container.update(newMetadata, false);
 
-    Assert.assertEquals(1, containerSet.getContainerMapCopy().size());
-    Assert.assertTrue(containerSet.getContainerMapCopy()
+    assertEquals(1, containerSet.getContainerMapCopy().size());
+    Assertions.assertTrue(containerSet.getContainerMapCopy()
         .containsKey(testContainerID));
 
     // Verify in-memory map
     KeyValueContainerData actualNewData = (KeyValueContainerData)
         containerSet.getContainer(testContainerID).getContainerData();
-    Assert.assertEquals("shire_new",
+    assertEquals("shire_new",
         actualNewData.getMetadata().get("VOLUME"));
-    Assert.assertEquals("bilbo_new",
+    assertEquals("bilbo_new",
         actualNewData.getMetadata().get("owner"));
 
     // Verify container data on disk
     File containerBaseDir = new File(actualNewData.getMetadataPath())
         .getParentFile();
     File newContainerFile = ContainerUtils.getContainerFile(containerBaseDir);
-    Assert.assertTrue("Container file should exist.",
-        newContainerFile.exists());
-    Assert.assertEquals("Container file should be in same location.",
-        orgContainerFile.getAbsolutePath(),
-        newContainerFile.getAbsolutePath());
+    Assertions.assertTrue(newContainerFile.exists(),
+        "Container file should exist.");
+    assertEquals(
+        orgContainerFile.getAbsolutePath(), newContainerFile.getAbsolutePath(),
+        "Container file should be in same location.");
 
     ContainerData actualContainerData = ContainerDataYaml.readContainerFile(
         newContainerFile);
-    Assert.assertEquals("shire_new",
+    assertEquals("shire_new",
         actualContainerData.getMetadata().get("VOLUME"));
-    Assert.assertEquals("bilbo_new",
+    assertEquals("bilbo_new",
         actualContainerData.getMetadata().get("owner"));
 
 
@@ -932,7 +964,7 @@ public class TestContainerPersistence {
     try {
       container.update(newMetadata, false);
     } catch (StorageContainerException ex) {
-      Assert.assertEquals("Updating a closed container without " +
+      assertEquals("Updating a closed container without " +
           "force option is not allowed. ContainerID: " +
           testContainerID, ex.getMessage());
     }
@@ -945,26 +977,29 @@ public class TestContainerPersistence {
     // Verify in-memory map
     actualNewData = (KeyValueContainerData)
         containerSet.getContainer(testContainerID).getContainerData();
-    Assert.assertEquals("shire_new_1",
+    assertEquals("shire_new_1",
         actualNewData.getMetadata().get("VOLUME"));
-    Assert.assertEquals("bilbo_new_1",
+    assertEquals("bilbo_new_1",
         actualNewData.getMetadata().get("owner"));
 
   }
 
   private BlockData writeBlockHelper(BlockID blockID, int i)
-      throws IOException, NoSuchAlgorithmException {
+      throws IOException {
     ChunkInfo info = writeChunkHelper(blockID);
     BlockData blockData = new BlockData(blockID);
-    blockData.setBlockCommitSequenceId((long) i);
+    blockData.setBlockCommitSequenceId(i);
     List<ContainerProtos.ChunkInfo> chunkList = new LinkedList<>();
     chunkList.add(info.getProtoBufMessage());
     blockData.setChunks(chunkList);
     return blockData;
   }
 
-  @Test
-  public void testListBlock() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testListBlock(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    initSchemaAndVersionInfo(versionInfo);
     long testContainerID = getTestContainerID();
     Container container = addContainer(containerSet, testContainerID);
     List<BlockID> expectedBlocks = new ArrayList<>();
@@ -978,13 +1013,13 @@ public class TestContainerPersistence {
     // List all blocks
     List<BlockData> result = blockManager.listBlock(
         container, 0, 100);
-    Assert.assertEquals(10, result.size());
+    assertEquals(10, result.size());
 
     int index = 0;
     for (int i = index; i < result.size(); i++) {
       BlockData data = result.get(i);
-      Assert.assertEquals(testContainerID, data.getContainerID());
-      Assert.assertEquals(expectedBlocks.get(i).getLocalID(),
+      assertEquals(testContainerID, data.getContainerID());
+      assertEquals(expectedBlocks.get(i).getLocalID(),
           data.getLocalID());
       index++;
     }
@@ -993,15 +1028,16 @@ public class TestContainerPersistence {
     long k6 = expectedBlocks.get(6).getLocalID();
     result = blockManager.listBlock(container, k6, 100);
 
-    Assert.assertEquals(4, result.size());
+    assertEquals(4, result.size());
     for (int i = 6; i < 10; i++) {
-      Assert.assertEquals(expectedBlocks.get(i).getLocalID(),
+      assertEquals(expectedBlocks.get(i).getLocalID(),
           result.get(i - 6).getLocalID());
     }
 
     // Count must be >0
-    exception.expect(IllegalArgumentException.class);
-    exception.expectMessage("Count must be a positive number.");
-    blockManager.listBlock(container, 0, -1);
+    Exception exception = assertThrows(IllegalArgumentException.class,
+        () -> blockManager.listBlock(container, 0, -1));
+    assertThat(exception.getMessage(),
+        Matchers.containsString("Count must be a positive number."));
   }
 }
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerSet.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerSet.java
index b9396e5cde..e075cd66ae 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerSet.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerSet.java
@@ -30,9 +30,8 @@ import org.apache.hadoop.ozone.container.keyvalue.ContainerLayoutTestInfo;
 import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainer;
 import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
 import org.apache.ozone.test.GenericTestUtils;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.mockito.Mockito;
 
 import java.io.IOException;
@@ -46,34 +45,35 @@ import java.util.Random;
 import java.util.UUID;
 import java.util.stream.LongStream;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+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.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * Class used to test ContainerSet operations.
  */
-@RunWith(Parameterized.class)
 public class TestContainerSet {
 
   private static final int FIRST_ID = 2;
 
-  private final ContainerLayoutVersion layout;
+  private ContainerLayoutVersion layoutVersion;
 
-  public TestContainerSet(ContainerLayoutVersion layout) {
-    this.layout = layout;
+  private void setLayoutVersion(ContainerLayoutVersion layoutVersion) {
+    this.layoutVersion = layoutVersion;
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> layoutVersion() {
     return ContainerLayoutTestInfo.containerLayoutParameters();
   }
 
-  @Test
-  public void testAddGetRemoveContainer() throws StorageContainerException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testAddGetRemoveContainer(ContainerLayoutVersion layout)
+      throws StorageContainerException {
+    setLayoutVersion(layout);
     ContainerSet containerSet = new ContainerSet(1000);
     long containerId = 100L;
     ContainerProtos.ContainerDataProto.State state = ContainerProtos
@@ -112,8 +112,11 @@ public class TestContainerSet {
     assertFalse(containerSet.removeContainer(1000L));
   }
 
-  @Test
-  public void testIteratorsAndCount() throws StorageContainerException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testIteratorsAndCount(ContainerLayoutVersion layout)
+      throws StorageContainerException {
+    setLayoutVersion(layout);
 
     ContainerSet containerSet = createContainerSet();
 
@@ -156,8 +159,11 @@ public class TestContainerSet {
 
   }
 
-  @Test
-  public void testIteratorPerVolume() throws StorageContainerException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testIteratorPerVolume(ContainerLayoutVersion layout)
+      throws StorageContainerException {
+    setLayoutVersion(layout);
     HddsVolume vol1 = Mockito.mock(HddsVolume.class);
     Mockito.when(vol1.getStorageID()).thenReturn("uuid-1");
     HddsVolume vol2 = Mockito.mock(HddsVolume.class);
@@ -199,8 +205,11 @@ public class TestContainerSet {
     assertEquals(5, count2);
   }
 
-  @Test
-  public void iteratorIsOrderedByScanTime() throws StorageContainerException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void iteratorIsOrderedByScanTime(ContainerLayoutVersion layout)
+      throws StorageContainerException {
+    setLayoutVersion(layout);
     HddsVolume vol = Mockito.mock(HddsVolume.class);
     Mockito.when(vol.getStorageID()).thenReturn("uuid-1");
     Random random = new Random();
@@ -250,8 +259,11 @@ public class TestContainerSet {
     assertEquals(containerCount, containersToBeScanned);
   }
 
-  @Test
-  public void testGetContainerReport() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testGetContainerReport(ContainerLayoutVersion layout)
+      throws IOException {
+    setLayoutVersion(layout);
 
     ContainerSet containerSet = createContainerSet();
 
@@ -262,9 +274,11 @@ public class TestContainerSet {
   }
 
 
-
-  @Test
-  public void testListContainer() throws StorageContainerException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testListContainer(ContainerLayoutVersion layout)
+      throws StorageContainerException {
+    setLayoutVersion(layout);
     ContainerSet containerSet = createContainerSet();
     int count = 5;
     int startId = FIRST_ID + 3;
@@ -275,8 +289,11 @@ public class TestContainerSet {
     assertContainerIds(startId, count, result);
   }
 
-  @Test
-  public void testListContainerFromFirstKey() throws StorageContainerException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testListContainerFromFirstKey(ContainerLayoutVersion layout)
+      throws StorageContainerException {
+    setLayoutVersion(layout);
     ContainerSet containerSet = createContainerSet();
     int count = 6;
     List<ContainerData> result = new ArrayList<>(count);
@@ -301,7 +318,7 @@ public class TestContainerSet {
     ContainerSet containerSet = new ContainerSet(1000);
     for (int i = FIRST_ID; i < FIRST_ID + 10; i++) {
       KeyValueContainerData kvData = new KeyValueContainerData(i,
-          layout,
+          layoutVersion,
           (long) StorageUnit.GB.toBytes(5), UUID.randomUUID().toString(),
           UUID.randomUUID().toString());
       if (i % 2 == 0) {
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestHddsDispatcher.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestHddsDispatcher.java
index 3d4495d1d5..3215271245 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestHddsDispatcher.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestHddsDispatcher.java
@@ -62,10 +62,9 @@ import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
 import org.apache.hadoop.security.token.Token;
 import org.apache.ozone.test.GenericTestUtils;
 import org.apache.ratis.thirdparty.com.google.protobuf.ByteString;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.mockito.Mockito;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -86,36 +85,33 @@ import static org.apache.hadoop.hdds.fs.MockSpaceUsageSource.fixed;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.HDDS_DATANODE_DIR_KEY;
 import static org.apache.hadoop.hdds.scm.protocolPB.ContainerCommandResponseBuilders.getContainerCommandResponse;
 import static org.apache.hadoop.ozone.container.common.ContainerTestUtils.COMMIT_STAGE;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
 /**
  * Test-cases to verify the functionality of HddsDispatcher.
  */
-@RunWith(Parameterized.class)
 public class TestHddsDispatcher {
   private static final Logger LOG = LoggerFactory.getLogger(
       TestHddsDispatcher.class);
 
-  public static final IncrementalReportSender<Container>
-      NO_OP_ICR_SENDER = c -> { };
-
-  private final ContainerLayoutVersion layout;
-
-  public TestHddsDispatcher(ContainerLayoutVersion layout) {
-    this.layout = layout;
-  }
+  public static final IncrementalReportSender<Container> NO_OP_ICR_SENDER =
+      c -> {
+      };
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> layoutVersion() {
     return ContainerLayoutTestInfo.containerLayoutParameters();
   }
 
-  @Test
-  public void testContainerCloseActionWhenFull() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testContainerCloseActionWhenFull(
+      ContainerLayoutVersion layout) throws IOException {
+
     String testDir = GenericTestUtils.getTempPath(
         TestHddsDispatcher.class.getSimpleName());
     OzoneConfiguration conf = new OzoneConfiguration();
@@ -150,7 +146,7 @@ public class TestHddsDispatcher {
       hddsDispatcher.setClusterId(scmId.toString());
       ContainerCommandResponseProto responseOne = hddsDispatcher
           .dispatch(getWriteChunkRequest(dd.getUuidString(), 1L, 1L), null);
-      Assert.assertEquals(ContainerProtos.Result.SUCCESS,
+      assertEquals(ContainerProtos.Result.SUCCESS,
           responseOne.getResult());
       verify(context, times(0))
           .addContainerActionIfAbsent(Mockito.any(ContainerAction.class));
@@ -158,7 +154,7 @@ public class TestHddsDispatcher {
           StorageUnit.MB.toBytes(950)).longValue());
       ContainerCommandResponseProto responseTwo = hddsDispatcher
           .dispatch(getWriteChunkRequest(dd.getUuidString(), 1L, 2L), null);
-      Assert.assertEquals(ContainerProtos.Result.SUCCESS,
+      assertEquals(ContainerProtos.Result.SUCCESS,
           responseTwo.getResult());
       verify(context, times(1))
           .addContainerActionIfAbsent(Mockito.any(ContainerAction.class));
@@ -170,8 +166,10 @@ public class TestHddsDispatcher {
     }
   }
 
-  @Test
-  public void testContainerCloseActionWhenVolumeFull() throws Exception {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testContainerCloseActionWhenVolumeFull(
+      ContainerLayoutVersion layoutVersion) throws Exception {
     String testDir = GenericTestUtils.getTempPath(
         TestHddsDispatcher.class.getSimpleName());
     OzoneConfiguration conf = new OzoneConfiguration();
@@ -198,8 +196,8 @@ public class TestHddsDispatcher {
       StateContext context = ContainerTestUtils.getMockContext(dd, conf);
       // create a 50 byte container
       KeyValueContainerData containerData = new KeyValueContainerData(1L,
-          layout,
-           50, UUID.randomUUID().toString(),
+          layoutVersion,
+          50, UUID.randomUUID().toString(),
           dd.getUuidString());
       Container container = new KeyValueContainer(containerData, conf);
       container.create(volumeSet, new RoundRobinVolumeChoosingPolicy(),
@@ -220,7 +218,7 @@ public class TestHddsDispatcher {
           .ifPresent(volumeInfo -> volumeInfo.incrementUsedSpace(50));
       ContainerCommandResponseProto response = hddsDispatcher
           .dispatch(getWriteChunkRequest(dd.getUuidString(), 1L, 1L), null);
-      Assert.assertEquals(ContainerProtos.Result.SUCCESS,
+      assertEquals(ContainerProtos.Result.SUCCESS,
           response.getResult());
       verify(context, times(1))
           .addContainerActionIfAbsent(Mockito.any(ContainerAction.class));
@@ -229,7 +227,7 @@ public class TestHddsDispatcher {
       // threshold
 
       KeyValueContainerData containerData2 = new KeyValueContainerData(1L,
-          layout,
+          layoutVersion,
           50, UUID.randomUUID().toString(),
           dd.getUuidString());
       Container container2 = new KeyValueContainer(containerData2, conf);
@@ -262,38 +260,38 @@ public class TestHddsDispatcher {
       // send read chunk request and make sure container does not exist
       ContainerCommandResponseProto response =
           hddsDispatcher.dispatch(getReadChunkRequest(writeChunkRequest), null);
-      Assert.assertEquals(response.getResult(),
+      assertEquals(response.getResult(),
           ContainerProtos.Result.CONTAINER_NOT_FOUND);
       // send write chunk request without sending create container
       response = hddsDispatcher.dispatch(writeChunkRequest, null);
       // container should be created as part of write chunk request
-      Assert.assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
+      assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
       // send read chunk request to read the chunk written above
       response =
           hddsDispatcher.dispatch(getReadChunkRequest(writeChunkRequest), null);
-      Assert.assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
+      assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
       ByteString responseData = BufferUtils.concatByteStrings(
           response.getReadChunk().getDataBuffers().getBuffersList());
-      Assert.assertEquals(writeChunkRequest.getWriteChunk().getData(),
+      assertEquals(writeChunkRequest.getWriteChunk().getData(),
           responseData);
       // put block
       ContainerCommandRequestProto putBlockRequest =
           ContainerTestHelper.getPutBlockRequest(writeChunkRequest);
-      response =  hddsDispatcher.dispatch(putBlockRequest, null);
-      Assert.assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
+      response = hddsDispatcher.dispatch(putBlockRequest, null);
+      assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
       // send list block request
       ContainerCommandRequestProto listBlockRequest =
           ContainerTestHelper.getListBlockRequest(writeChunkRequest);
-      response =  hddsDispatcher.dispatch(listBlockRequest, null);
-      Assert.assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
-      Assert.assertEquals(1, response.getListBlock().getBlockDataList().size());
+      response = hddsDispatcher.dispatch(listBlockRequest, null);
+      assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
+      assertEquals(1, response.getListBlock().getBlockDataList().size());
       for (ContainerProtos.BlockData blockData :
           response.getListBlock().getBlockDataList()) {
-        Assert.assertEquals(writeChunkRequest.getWriteChunk().getBlockID(),
+        assertEquals(writeChunkRequest.getWriteChunk().getBlockID(),
             blockData.getBlockID());
-        Assert.assertEquals(writeChunkRequest.getWriteChunk().getChunkData()
+        assertEquals(writeChunkRequest.getWriteChunk().getChunkData()
             .getLen(), blockData.getSize());
-        Assert.assertEquals(1, blockData.getChunksCount());
+        assertEquals(1, blockData.getChunksCount());
       }
     } finally {
       ContainerMetrics.remove();
@@ -318,7 +316,7 @@ public class TestHddsDispatcher {
       // send read chunk request and make sure container does not exist
       ContainerCommandResponseProto response =
           hddsDispatcher.dispatch(getReadChunkRequest(writeChunkRequest), null);
-      Assert.assertEquals(
+      assertEquals(
           ContainerProtos.Result.CONTAINER_NOT_FOUND, response.getResult());
 
       GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer
@@ -326,7 +324,7 @@ public class TestHddsDispatcher {
       // send write chunk request without sending create container
       response = hddsDispatcher.dispatch(writeChunkRequest, COMMIT_STAGE);
       // container should not be found
-      Assert.assertEquals(
+      assertEquals(
           ContainerProtos.Result.CONTAINER_NOT_FOUND, response.getResult());
 
       assertTrue(logCapturer.getOutput().contains(
@@ -394,15 +392,15 @@ public class TestHddsDispatcher {
       hddsDispatcher.dispatch(writeChunkRequest, null);
       response = hddsDispatcher.dispatch(writeChunkRequest, null);
 
-      Assert.assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
+      assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
       // Send Read Chunk request for written chunk.
       response =
           hddsDispatcher.dispatch(getReadChunkRequest(writeChunkRequest), null);
-      Assert.assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
+      assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
 
       ByteString responseData = BufferUtils.concatByteStrings(
           response.getReadChunk().getDataBuffers().getBuffersList());
-      Assert.assertEquals(writeChunkRequest.getWriteChunk().getData(),
+      assertEquals(writeChunkRequest.getWriteChunk().getData(),
           responseData);
 
       // Put Block
@@ -412,22 +410,22 @@ public class TestHddsDispatcher {
       //Send same PutBlockRequest
       hddsDispatcher.dispatch(putBlockRequest, null);
       hddsDispatcher.dispatch(putBlockRequest, null);
-      response =  hddsDispatcher.dispatch(putBlockRequest, null);
-      Assert.assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
+      response = hddsDispatcher.dispatch(putBlockRequest, null);
+      assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
 
       // Check PutBlock Data
       ContainerCommandRequestProto listBlockRequest =
           ContainerTestHelper.getListBlockRequest(writeChunkRequest);
-      response =  hddsDispatcher.dispatch(listBlockRequest, null);
-      Assert.assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
-      Assert.assertEquals(1, response.getListBlock().getBlockDataList().size());
+      response = hddsDispatcher.dispatch(listBlockRequest, null);
+      assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
+      assertEquals(1, response.getListBlock().getBlockDataList().size());
       for (ContainerProtos.BlockData blockData :
           response.getListBlock().getBlockDataList()) {
-        Assert.assertEquals(writeChunkRequest.getWriteChunk().getBlockID(),
+        assertEquals(writeChunkRequest.getWriteChunk().getBlockID(),
             blockData.getBlockID());
-        Assert.assertEquals(writeChunkRequest.getWriteChunk().getChunkData()
+        assertEquals(writeChunkRequest.getWriteChunk().getChunkData()
             .getLen(), blockData.getSize());
-        Assert.assertEquals(1, blockData.getChunksCount());
+        assertEquals(1, blockData.getChunksCount());
       }
     } finally {
       ContainerMetrics.remove();
@@ -565,7 +563,7 @@ public class TestHddsDispatcher {
       final TokenVerifier tokenVerifier = new TokenVerifier() {
         private void verify() {
           final boolean previous = verified.getAndSet(true);
-          Assert.assertFalse(previous);
+          assertFalse(previous);
         }
 
         @Override
@@ -594,9 +592,9 @@ public class TestHddsDispatcher {
       };
       for (DispatcherContext context : notVerify) {
         LOG.info("notVerify {}", context);
-        Assert.assertFalse(verified.get());
+        assertFalse(verified.get());
         dispatcher.dispatch(request, context);
-        Assert.assertFalse(verified.get());
+        assertFalse(verified.get());
       }
 
       final Op[] verify = {
@@ -610,9 +608,9 @@ public class TestHddsDispatcher {
 
       for (Op op : verify) {
         final DispatcherContext context = newContext(op);
-        Assert.assertFalse(verified.get());
+        assertFalse(verified.get());
         dispatcher.dispatch(request, context);
-        Assert.assertTrue(verified.getAndSet(false));
+        assertTrue(verified.getAndSet(false));
       }
     } finally {
       ContainerMetrics.remove();
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCloseContainerCommandHandler.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCloseContainerCommandHandler.java
index d286016946..343341f26a 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCloseContainerCommandHandler.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCloseContainerCommandHandler.java
@@ -35,10 +35,8 @@ import org.apache.hadoop.ozone.container.ozoneimpl.ContainerController;
 import org.apache.hadoop.ozone.container.ozoneimpl.OzoneContainer;
 import org.apache.hadoop.ozone.protocol.commands.CloseContainerCommand;
 import org.apache.ozone.test.GenericTestUtils;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import java.io.IOException;
 import java.util.UUID;
@@ -55,7 +53,6 @@ import static org.mockito.Mockito.when;
 /**
  * Test cases to verify CloseContainerCommandHandler in datanode.
  */
-@RunWith(Parameterized.class)
 public class TestCloseContainerCommandHandler {
 
   private static final long CONTAINER_ID = 123L;
@@ -72,25 +69,25 @@ public class TestCloseContainerCommandHandler {
   private CloseContainerCommandHandler subject =
       new CloseContainerCommandHandler(1, 1000, "");
 
-  private final ContainerLayoutVersion layout;
+  private ContainerLayoutVersion layoutVersion;
 
-  public TestCloseContainerCommandHandler(ContainerLayoutVersion layout) {
-    this.layout = layout;
+  public void initLayoutVerison(ContainerLayoutVersion layout)
+      throws Exception {
+    this.layoutVersion = layout;
+    init();
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> layoutVersion() {
     return ContainerLayoutTestInfo.containerLayoutParameters();
   }
 
-  @Before
-  public void before() throws Exception {
+  private void init() throws Exception {
     OzoneConfiguration conf = new OzoneConfiguration();
     context = ContainerTestUtils.getMockContext(randomDatanodeDetails(), conf);
     pipelineID = PipelineID.randomId();
 
     KeyValueContainerData data = new KeyValueContainerData(CONTAINER_ID,
-        layout, GB,
+        layoutVersion, GB,
         pipelineID.getId().toString(), null);
 
     container = new KeyValueContainer(data, conf);
@@ -112,8 +109,11 @@ public class TestCloseContainerCommandHandler {
         .thenReturn(false);
   }
 
-  @Test
-  public void closeContainerWithPipeline() throws Exception {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void closeContainerWithPipeline(ContainerLayoutVersion layout)
+      throws Exception {
+    initLayoutVerison(layout);
     // close a container that's associated with an existing pipeline
     subject.handle(closeWithKnownPipeline(), ozoneContainer, context, null);
     waitTillFinishExecution(subject);
@@ -125,8 +125,11 @@ public class TestCloseContainerCommandHandler {
         .quasiCloseContainer(eq(container), any());
   }
 
-  @Test
-  public void closeContainerWithoutPipeline() throws Exception {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void closeContainerWithoutPipeline(ContainerLayoutVersion layout)
+      throws Exception {
+    initLayoutVerison(layout);
     // close a container that's NOT associated with an open pipeline
     subject.handle(closeWithUnknownPipeline(), ozoneContainer, context, null);
     waitTillFinishExecution(subject);
@@ -141,8 +144,11 @@ public class TestCloseContainerCommandHandler {
         .quasiCloseContainer(eq(container), any());
   }
 
-  @Test
-  public void closeContainerWithForceFlagSet() throws Exception {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void closeContainerWithForceFlagSet(ContainerLayoutVersion layout)
+      throws Exception {
+    initLayoutVerison(layout);
     // close a container that's associated with an existing pipeline
     subject.handle(forceCloseWithoutPipeline(), ozoneContainer, context, null);
     waitTillFinishExecution(subject);
@@ -153,8 +159,11 @@ public class TestCloseContainerCommandHandler {
     verify(containerHandler).closeContainer(container);
   }
 
-  @Test
-  public void forceCloseQuasiClosedContainer() throws Exception {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void forceCloseQuasiClosedContainer(ContainerLayoutVersion layout)
+      throws Exception {
+    initLayoutVerison(layout);
     // force-close a container that's already quasi closed
     container.getContainerData()
         .setState(ContainerProtos.ContainerDataProto.State.QUASI_CLOSED);
@@ -168,8 +177,11 @@ public class TestCloseContainerCommandHandler {
         .closeContainer(container);
   }
 
-  @Test
-  public void forceCloseOpenContainer() throws Exception {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void forceCloseOpenContainer(ContainerLayoutVersion layout)
+      throws Exception {
+    initLayoutVerison(layout);
     // force-close a container that's NOT associated with an open pipeline
     subject.handle(forceCloseWithoutPipeline(), ozoneContainer, context, null);
     waitTillFinishExecution(subject);
@@ -182,8 +194,11 @@ public class TestCloseContainerCommandHandler {
         .closeContainer(container);
   }
 
-  @Test
-  public void forceCloseOpenContainerWithPipeline() throws Exception {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void forceCloseOpenContainerWithPipeline(ContainerLayoutVersion layout)
+      throws Exception {
+    initLayoutVerison(layout);
     // force-close a container that's associated with an existing pipeline
     subject.handle(forceCloseWithPipeline(), ozoneContainer, context, null);
     waitTillFinishExecution(subject);
@@ -198,8 +213,11 @@ public class TestCloseContainerCommandHandler {
         .closeContainer(container);
   }
 
-  @Test
-  public void closeAlreadyClosedContainer() throws Exception {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void closeAlreadyClosedContainer(ContainerLayoutVersion layout)
+      throws Exception {
+    initLayoutVerison(layout);
     container.getContainerData()
         .setState(ContainerProtos.ContainerDataProto.State.CLOSED);
 
@@ -220,28 +238,34 @@ public class TestCloseContainerCommandHandler {
         .submitRequest(any(), any());
   }
 
-  @Test
-  public void closeNonExistenceContainer() {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void closeNonExistenceContainer(ContainerLayoutVersion layout)
+      throws Exception {
+    initLayoutVerison(layout);
     long containerID = 1L;
     try {
       controller.markContainerForClose(containerID);
     } catch (IOException e) {
 
       GenericTestUtils.assertExceptionContains("The Container " +
-                      "is not found. ContainerID: " + containerID, e);
+          "is not found. ContainerID: " + containerID, e);
     }
   }
 
-  @Test
-  public void closeMissingContainer() {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void closeMissingContainer(ContainerLayoutVersion layout)
+      throws Exception {
+    initLayoutVerison(layout);
     long containerID = 2L;
     containerSet.getMissingContainerSet().add(containerID);
     try {
       controller.markContainerForClose(containerID);
     } catch (IOException e) {
       GenericTestUtils.assertExceptionContains("The Container is in " +
-              "the MissingContainerSet hence we can't close it. " +
-              "ContainerID: " + containerID, e);
+          "the MissingContainerSet hence we can't close it. " +
+          "ContainerID: " + containerID, e);
     }
   }
 
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestDeleteBlocksCommandHandler.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestDeleteBlocksCommandHandler.java
index 083a8eb016..5f0b867c28 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestDeleteBlocksCommandHandler.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestDeleteBlocksCommandHandler.java
@@ -30,16 +30,11 @@ import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainer;
 import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
 import org.apache.hadoop.ozone.container.common.statemachine.commandhandler.DeleteBlocksCommandHandler.SchemaHandler;
 import org.apache.hadoop.ozone.container.ozoneimpl.OzoneContainer;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-import org.apache.ozone.test.JUnit5AwareTimeout;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
@@ -74,35 +69,32 @@ import static org.mockito.Mockito.when;
 /**
  * Test cases for TestDeleteBlocksCommandHandler.
  */
-@RunWith(Parameterized.class)
+@Timeout(300)
 public class TestDeleteBlocksCommandHandler {
 
-  @Rule
-  public TestRule testTimeout = new JUnit5AwareTimeout(Timeout.seconds(300));
-
   private OzoneConfiguration conf;
   private ContainerLayoutVersion layout;
   private OzoneContainer ozoneContainer;
   private ContainerSet containerSet;
   private DeleteBlocksCommandHandler handler;
-  private final String schemaVersion;
+  private String schemaVersion;
   private HddsVolume volume1;
   private BlockDeletingServiceMetrics blockDeleteMetrics;
 
-  public TestDeleteBlocksCommandHandler(ContainerTestVersionInfo versionInfo) {
+  private void prepareTest(ContainerTestVersionInfo versionInfo)
+      throws Exception {
     this.layout = versionInfo.getLayout();
     this.schemaVersion = versionInfo.getSchemaVersion();
     conf = new OzoneConfiguration();
     ContainerTestVersionInfo.setTestSchemaVersion(schemaVersion, conf);
+    setup();
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> versionInfo() {
     return ContainerTestVersionInfo.versionParameters();
   }
 
-  @Before
-  public void setup() throws Exception {
+  private void setup() throws Exception {
     conf = new OzoneConfiguration();
     layout = ContainerLayoutVersion.FILE_PER_BLOCK;
     ozoneContainer = Mockito.mock(OzoneContainer.class);
@@ -138,16 +130,18 @@ public class TestDeleteBlocksCommandHandler {
     handler.getSchemaHandlers().put(SCHEMA_V3, testSchemaHandler3);
   }
 
-  @After
+  @AfterEach
   public void tearDown() {
     handler.stop();
     BlockDeletingServiceMetrics.unRegister();
   }
 
-  @Test
-  public void testDeleteBlocksCommandHandler()
-      throws IOException {
-    Assert.assertTrue(containerSet.containerCount() > 0);
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testDeleteBlocksCommandHandler(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    prepareTest(versionInfo);
+    Assertions.assertTrue(containerSet.containerCount() > 0);
     Container<?> container = containerSet.getContainerIterator(volume1).next();
     DeletedBlocksTransaction transaction = createDeletedBlocksTransaction(1,
         container.getContainerData().getContainerID());
@@ -163,16 +157,18 @@ public class TestDeleteBlocksCommandHandler {
     Mockito.verify(handler,
         times(1)).submitTasks(any());
 
-    Assert.assertEquals(1, results.size());
-    Assert.assertTrue(results.get(0).getSuccess());
-    Assert.assertEquals(0,
+    Assertions.assertEquals(1, results.size());
+    Assertions.assertTrue(results.get(0).getSuccess());
+    Assertions.assertEquals(0,
         blockDeleteMetrics.getTotalLockTimeoutTransactionCount());
   }
 
-  @Test
-  public void testDeleteBlocksCommandHandlerWithTimeoutFailed()
-      throws IOException {
-    Assert.assertTrue(containerSet.containerCount() >= 2);
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testDeleteBlocksCommandHandlerWithTimeoutFailed(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    prepareTest(versionInfo);
+    Assertions.assertTrue(containerSet.containerCount() >= 2);
     Iterator<Container<?>> iterator =
         containerSet.getContainerIterator(volume1);
     Container<?> lockedContainer = iterator.next();
@@ -204,22 +200,24 @@ public class TestDeleteBlocksCommandHandler {
         times(1)).submitTasks(eq(transactions));
     Mockito.verify(handler,
         times(1)).submitTasks(eq(Arrays.asList(transaction1)));
-    Assert.assertEquals(2, results.size());
+    Assertions.assertEquals(2, results.size());
 
     // Only one transaction will succeed
     Map<Long, DeleteBlockTransactionResult> resultsMap = new HashMap<>();
     results.forEach(result -> resultsMap.put(result.getTxID(), result));
-    Assert.assertFalse(resultsMap.get(transaction1.getTxID()).getSuccess());
-    Assert.assertTrue(resultsMap.get(transaction2.getTxID()).getSuccess());
+    Assertions.assertFalse(resultsMap.get(transaction1.getTxID()).getSuccess());
+    Assertions.assertTrue(resultsMap.get(transaction2.getTxID()).getSuccess());
 
-    Assert.assertEquals(1,
+    Assertions.assertEquals(1,
         blockDeleteMetrics.getTotalLockTimeoutTransactionCount());
   }
 
-  @Test
-  public void testDeleteBlocksCommandHandlerSuccessfulAfterFirstTimeout()
-      throws IOException {
-    Assert.assertTrue(containerSet.containerCount() > 0);
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testDeleteBlocksCommandHandlerSuccessfulAfterFirstTimeout(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    prepareTest(versionInfo);
+    Assertions.assertTrue(containerSet.containerCount() > 0);
     Container<?> lockedContainer =
         containerSet.getContainerIterator(volume1).next();
     DeletedBlocksTransaction transaction = createDeletedBlocksTransaction(1,
@@ -258,15 +256,18 @@ public class TestDeleteBlocksCommandHandler {
         times(2)).submitTasks(any());
     Mockito.verify(handler.getSchemaHandlers().get(schemaVersionOrDefault),
         times(1)).handle(any(), any());
-    Assert.assertEquals(1, results.size());
-    Assert.assertTrue(results.get(0).getSuccess());
+    Assertions.assertEquals(1, results.size());
+    Assertions.assertTrue(results.get(0).getSuccess());
 
-    Assert.assertEquals(0,
+    Assertions.assertEquals(0,
         blockDeleteMetrics.getTotalLockTimeoutTransactionCount());
   }
 
-  @Test
-  public void testDeleteCmdWorkerInterval() {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testDeleteCmdWorkerInterval(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    prepareTest(versionInfo);
     OzoneConfiguration tmpConf = new OzoneConfiguration();
     tmpConf.setTimeDuration(BLOCK_DELETE_COMMAND_WORKER_INTERVAL, 3,
         TimeUnit.SECONDS);
@@ -275,15 +276,15 @@ public class TestDeleteBlocksCommandHandler {
         tmpConf.getObject(DatanodeConfiguration.class);
     DeleteBlocksCommandHandler commandHandler =
         spy(new DeleteBlocksCommandHandler(
-        container, tmpConf, dnConf, "test"));
+            container, tmpConf, dnConf, "test"));
 
-    Assert.assertEquals(tmpConf.getTimeDuration(
+    Assertions.assertEquals(tmpConf.getTimeDuration(
         BLOCK_DELETE_COMMAND_WORKER_INTERVAL,
         BLOCK_DELETE_COMMAND_WORKER_INTERVAL_DEFAULT.getSeconds(),
         TimeUnit.SECONDS), 3);
     DeleteBlocksCommandHandler.DeleteCmdWorker deleteCmdWorker =
         commandHandler.new DeleteCmdWorker(4000);
-    Assert.assertEquals(deleteCmdWorker.getInterval(), 4000);
+    Assertions.assertEquals(deleteCmdWorker.getInterval(), 4000);
   }
 
   private DeletedBlocksTransaction createDeletedBlocksTransaction(long txID,
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestStorageVolumeChecker.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestStorageVolumeChecker.java
index 29804e1e7e..e9f691e99d 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestStorageVolumeChecker.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestStorageVolumeChecker.java
@@ -39,27 +39,20 @@ import org.apache.hadoop.ozone.container.ozoneimpl.OzoneContainer;
 import org.apache.ozone.test.GenericTestUtils;
 import org.apache.hadoop.util.DiskChecker.DiskErrorException;
 import org.apache.hadoop.util.FakeTimer;
-import org.junit.Rule;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.rules.TemporaryFolder;
-import org.junit.Test;
-import org.junit.rules.TestName;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-import org.apache.ozone.test.JUnit5AwareTimeout;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.File;
-import java.io.IOException;
+import java.nio.file.Path;
 import java.time.Duration;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 import java.util.Set;
 import java.util.Optional;
@@ -69,8 +62,8 @@ import java.util.concurrent.atomic.AtomicLong;
 
 import static org.apache.hadoop.hdfs.server.datanode.checker.VolumeCheckResult.FAILED;
 import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.Matchers.anyObject;
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.isNull;
@@ -83,63 +76,49 @@ import static org.mockito.Mockito.when;
 /**
  * Tests for {@link StorageVolumeChecker}.
  */
-@RunWith(Parameterized.class)
+@Timeout(300)
 public class TestStorageVolumeChecker {
   public static final Logger LOG = LoggerFactory.getLogger(
       TestStorageVolumeChecker.class);
 
   private static final int NUM_VOLUMES = 2;
 
-  @Rule
-  public TemporaryFolder folder = new TemporaryFolder();
-
-  @Rule
-  public TestName testName = new TestName();
-
-  @Rule
-  public TestRule globalTimeout = new JUnit5AwareTimeout(Timeout.seconds(30));
+  @TempDir
+  private Path folder;
 
   private OzoneConfiguration conf = new OzoneConfiguration();
 
   /**
    * When null, the check call should throw an exception.
    */
-  private final VolumeCheckResult expectedVolumeHealth;
+  private VolumeCheckResult expectedVolumeHealth;
 
-  private final ContainerLayoutVersion layout;
+  private ContainerLayoutVersion layoutVersion;
 
-  public TestStorageVolumeChecker(VolumeCheckResult result,
+  private void initTest(VolumeCheckResult result,
       ContainerLayoutVersion layout) {
     this.expectedVolumeHealth = result;
-    this.layout = layout;
+    this.layoutVersion = layout;
+    setup();
   }
 
-  @Before
-  public void setup() throws IOException {
+  private void setup() {
     conf = new OzoneConfiguration();
-    conf.set(ScmConfigKeys.HDDS_DATANODE_DIR_KEY, folder.getRoot()
-        .getAbsolutePath());
-    conf.set(HddsConfigKeys.OZONE_METADATA_DIRS,
-        folder.newFolder().getAbsolutePath());
-  }
-
-  @After
-  public void cleanup() throws IOException {
-    FileUtils.deleteDirectory(folder.getRoot());
+    conf.set(ScmConfigKeys.HDDS_DATANODE_DIR_KEY, folder.toString());
+    conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, folder.toString());
   }
 
   /**
    * Run each test case for each possible value of {@link VolumeCheckResult}.
    * Including "null" for 'throw exception'.
    */
-  @Parameters
-  public static Collection<Object[]> data() {
-    List<Object[]> values = new ArrayList<>();
+  private static List<Arguments> provideTestData() {
+    List<Arguments> values = new ArrayList<>();
     for (ContainerLayoutVersion layout : ContainerLayoutVersion.values()) {
       for (VolumeCheckResult result : VolumeCheckResult.values()) {
-        values.add(new Object[]{result, layout});
+        values.add(Arguments.of(result, layout));
       }
-      values.add(new Object[]{null, layout});
+      values.add(Arguments.of(null, layout));
     }
     return values;
   }
@@ -151,9 +130,13 @@ public class TestStorageVolumeChecker {
    *
    * @throws Exception
    */
-  @Test
-  public void testCheckOneVolume() throws Exception {
-    LOG.info("Executing {}", testName.getMethodName());
+  @ParameterizedTest
+  @MethodSource("provideTestData")
+  public void testCheckOneVolume(
+      VolumeCheckResult checkResult, ContainerLayoutVersion layout,
+      TestInfo testInfo) throws Exception {
+    initTest(checkResult, layout);
+    LOG.info("Executing {}", testInfo.getTestMethod());
     final HddsVolume volume = makeVolumes(1, expectedVolumeHealth).get(0);
     final StorageVolumeChecker checker =
         new StorageVolumeChecker(new OzoneConfiguration(), new FakeTimer(), "");
@@ -193,9 +176,12 @@ public class TestStorageVolumeChecker {
    *
    * @throws Exception
    */
-  @Test
-  public void testCheckAllVolumes() throws Exception {
-    LOG.info("Executing {}", testName.getMethodName());
+  @ParameterizedTest
+  @MethodSource("provideTestData")
+  public void testCheckAllVolumes(VolumeCheckResult checkResult,
+      ContainerLayoutVersion layout, TestInfo testInfo) throws Exception {
+    initTest(checkResult, layout);
+    LOG.info("Executing {}", testInfo.getTestMethod());
 
     final List<HddsVolume> volumes = makeVolumes(
         NUM_VOLUMES, expectedVolumeHealth);
@@ -228,9 +214,12 @@ public class TestStorageVolumeChecker {
    *
    * @throws Exception
    */
-  @Test
-  public void testVolumeDeletion() throws Exception {
-    LOG.info("Executing {}", testName.getMethodName());
+  @ParameterizedTest
+  @MethodSource("provideTestData")
+  public void testVolumeDeletion(VolumeCheckResult checkResult,
+      ContainerLayoutVersion layout, TestInfo testInfo) throws Exception {
+    initTest(checkResult, layout);
+    LOG.info("Executing {}", testInfo.getTestMethod());
 
     DatanodeConfiguration dnConf =
         conf.getObject(DatanodeConfiguration.class);
@@ -247,7 +236,7 @@ public class TestStorageVolumeChecker {
     StorageVolumeChecker volumeChecker = volumeSet.getVolumeChecker();
     volumeChecker.setDelegateChecker(new DummyChecker());
     File volParentDir =
-        new File(folder.getRoot(), UUID.randomUUID().toString());
+        new File(folder.toString(), UUID.randomUUID().toString());
     volumeSet.addVolume(volParentDir.getPath());
     File volRootDir = new File(volParentDir, "hdds");
 
@@ -269,14 +258,14 @@ public class TestStorageVolumeChecker {
     // delete the volume directory
     FileUtils.deleteDirectory(volParentDir);
 
-    Assert.assertEquals(2, volumeSet.getVolumesList().size());
+    Assertions.assertEquals(2, volumeSet.getVolumesList().size());
     volumeSet.checkAllVolumes();
     // failed volume should be removed from volumeSet volume list
-    Assert.assertEquals(1, volumeSet.getVolumesList().size());
-    Assert.assertEquals(1, volumeSet.getFailedVolumesList().size());
+    Assertions.assertEquals(1, volumeSet.getVolumesList().size());
+    Assertions.assertEquals(1, volumeSet.getFailedVolumesList().size());
 
     // All containers should be removed from containerSet
-    Assert.assertEquals(0, containerSet.getContainerMap().size());
+    Assertions.assertEquals(0, containerSet.getContainerMap().size());
 
     ozoneContainer.stop();
   }
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueBlockIterator.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueBlockIterator.java
index 3734c5b1f5..6e8ad7196d 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueBlockIterator.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueBlockIterator.java
@@ -51,21 +51,20 @@ import org.apache.ozone.test.GenericTestUtils;
 import static java.util.stream.Collectors.toList;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.HDDS_DATANODE_DIR_KEY;
 
-import org.junit.After;
+import org.junit.jupiter.api.AfterEach;
 
 import static org.apache.hadoop.ozone.container.common.ContainerTestUtils.createDbInstancesForTestIfNeeded;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+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 org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
 /**
  * This class is used to test KeyValue container block iterator.
  */
-@RunWith(Parameterized.class)
 public class TestKeyValueBlockIterator {
 
   private static final long CONTAINER_ID = 105L;
@@ -76,13 +75,13 @@ public class TestKeyValueBlockIterator {
   private OzoneConfiguration conf;
   private File testRoot;
   private DBHandle db;
-  private final ContainerLayoutVersion layout;
+  private ContainerLayoutVersion layout;
   private String schemaVersion;
   private String datanodeID = UUID.randomUUID().toString();
   private String clusterID = UUID.randomUUID().toString();
 
-  public TestKeyValueBlockIterator(ContainerTestVersionInfo versionInfo,
-      String keySeparator) {
+  private void initTest(ContainerTestVersionInfo versionInfo,
+      String keySeparator) throws Exception {
     this.layout = versionInfo.getLayout();
     this.schemaVersion = versionInfo.getSchemaVersion();
     this.conf = new OzoneConfiguration();
@@ -90,26 +89,25 @@ public class TestKeyValueBlockIterator {
     DatanodeConfiguration dc = conf.getObject(DatanodeConfiguration.class);
     dc.setContainerSchemaV3KeySeparator(keySeparator);
     conf.setFromObject(dc);
+    setup();
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> data() {
-    List listA =
+  private static List<Arguments> provideTestData() {
+    List<Arguments> listA =
         ContainerTestVersionInfo.getLayoutList().stream().map(
-            each -> new Object[] {each, ""})
+                each -> Arguments.of(each, ""))
             .collect(toList());
-    List listB =
+    List<Arguments> listB =
         ContainerTestVersionInfo.getLayoutList().stream().map(
-            each -> new Object[] {each,
-                new DatanodeConfiguration().getContainerSchemaV3KeySeparator()})
+                each -> Arguments.of(each, new DatanodeConfiguration()
+                    .getContainerSchemaV3KeySeparator()))
             .collect(toList());
 
     listB.addAll(listA);
     return listB;
   }
 
-  @Before
-  public void setUp() throws Exception {
+  public void setup() throws Exception {
     testRoot = GenericTestUtils.getRandomizedTestDir();
     conf.set(HDDS_DATANODE_DIR_KEY, testRoot.getAbsolutePath());
     conf.set(OzoneConfigKeys.OZONE_METADATA_DIRS, testRoot.getAbsolutePath());
@@ -118,9 +116,9 @@ public class TestKeyValueBlockIterator {
     createDbInstancesForTestIfNeeded(volumeSet, clusterID, clusterID, conf);
 
     containerData = new KeyValueContainerData(105L,
-            layout,
-            (long) StorageUnit.GB.toBytes(1), UUID.randomUUID().toString(),
-            UUID.randomUUID().toString());
+        layout,
+        (long) StorageUnit.GB.toBytes(1), UUID.randomUUID().toString(),
+        UUID.randomUUID().toString());
     // Init the container.
     container = new KeyValueContainer(containerData, conf);
     container.create(volumeSet, new RoundRobinVolumeChoosingPolicy(),
@@ -129,7 +127,7 @@ public class TestKeyValueBlockIterator {
   }
 
 
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     db.close();
     db.cleanup();
@@ -138,22 +136,26 @@ public class TestKeyValueBlockIterator {
     FileUtil.fullyDelete(testRoot);
   }
 
-  @Test
-  public void testKeyValueBlockIteratorWithMixedBlocks() throws Exception {
+  @ParameterizedTest
+  @MethodSource("provideTestData")
+  public void testKeyValueBlockIteratorWithMixedBlocks(
+      ContainerTestVersionInfo versionInfo, String keySeparator)
+      throws Exception {
+    initTest(versionInfo, keySeparator);
     int deletingBlocks = 5;
     int normalBlocks = 5;
     Map<String, List<Long>> blockIDs = createContainerWithBlocks(CONTAINER_ID,
-            normalBlocks, deletingBlocks);
+        normalBlocks, deletingBlocks);
 
     // Default filter used is all unprefixed blocks.
     List<Long> unprefixedBlockIDs = blockIDs.get("");
     try (BlockIterator<BlockData> keyValueBlockIterator =
-                db.getStore().getBlockIterator(CONTAINER_ID)) {
+             db.getStore().getBlockIterator(CONTAINER_ID)) {
 
       Iterator<Long> blockIDIter = unprefixedBlockIDs.iterator();
       while (keyValueBlockIterator.hasNext()) {
         BlockData blockData = keyValueBlockIterator.nextBlock();
-        assertEquals(blockData.getLocalID(), (long)blockIDIter.next());
+        assertEquals(blockData.getLocalID(), (long) blockIDIter.next());
       }
       assertFalse(keyValueBlockIterator.hasNext());
       assertFalse(blockIDIter.hasNext());
@@ -176,15 +178,19 @@ public class TestKeyValueBlockIterator {
     }
   }
 
-  @Test
-  public void testKeyValueBlockIteratorWithNextBlock() throws Exception {
+  @ParameterizedTest
+  @MethodSource("provideTestData")
+  public void testKeyValueBlockIteratorWithNextBlock(
+      ContainerTestVersionInfo versionInfo, String keySeparator)
+      throws Exception {
+    initTest(versionInfo, keySeparator);
     List<Long> blockIDs = createContainerWithBlocks(CONTAINER_ID, 2);
     try (BlockIterator<BlockData> keyValueBlockIterator =
-                db.getStore().getBlockIterator(CONTAINER_ID)) {
-      assertEquals((long)blockIDs.get(0),
-              keyValueBlockIterator.nextBlock().getLocalID());
-      assertEquals((long)blockIDs.get(1),
-              keyValueBlockIterator.nextBlock().getLocalID());
+             db.getStore().getBlockIterator(CONTAINER_ID)) {
+      assertEquals((long) blockIDs.get(0),
+          keyValueBlockIterator.nextBlock().getLocalID());
+      assertEquals((long) blockIDs.get(1),
+          keyValueBlockIterator.nextBlock().getLocalID());
 
       try {
         keyValueBlockIterator.nextBlock();
@@ -195,11 +201,15 @@ public class TestKeyValueBlockIterator {
     }
   }
 
-  @Test
-  public void testKeyValueBlockIteratorWithHasNext() throws Exception {
+  @ParameterizedTest
+  @MethodSource("provideTestData")
+  public void testKeyValueBlockIteratorWithHasNext(
+      ContainerTestVersionInfo versionInfo, String keySeparator)
+      throws Exception {
+    initTest(versionInfo, keySeparator);
     List<Long> blockIDs = createContainerWithBlocks(CONTAINER_ID, 2);
     try (BlockIterator<BlockData> blockIter =
-                db.getStore().getBlockIterator(CONTAINER_ID)) {
+             db.getStore().getBlockIterator(CONTAINER_ID)) {
 
       // Even calling multiple times hasNext() should not move entry forward.
       assertTrue(blockIter.hasNext());
@@ -207,18 +217,18 @@ public class TestKeyValueBlockIterator {
       assertTrue(blockIter.hasNext());
       assertTrue(blockIter.hasNext());
       assertTrue(blockIter.hasNext());
-      assertEquals((long)blockIDs.get(0),
-              blockIter.nextBlock().getLocalID());
+      assertEquals((long) blockIDs.get(0),
+          blockIter.nextBlock().getLocalID());
 
       assertTrue(blockIter.hasNext());
       assertTrue(blockIter.hasNext());
       assertTrue(blockIter.hasNext());
       assertTrue(blockIter.hasNext());
       assertTrue(blockIter.hasNext());
-      assertEquals((long)blockIDs.get(1), blockIter.nextBlock().getLocalID());
+      assertEquals((long) blockIDs.get(1), blockIter.nextBlock().getLocalID());
 
       blockIter.seekToFirst();
-      assertEquals((long)blockIDs.get(0), blockIter.nextBlock().getLocalID());
+      assertEquals((long) blockIDs.get(0), blockIter.nextBlock().getLocalID());
       assertEquals((long)blockIDs.get(1), blockIter.nextBlock().getLocalID());
 
       try {
@@ -230,22 +240,26 @@ public class TestKeyValueBlockIterator {
     }
   }
 
-  @Test
-  public void testKeyValueBlockIteratorWithFilter() throws Exception {
+  @ParameterizedTest
+  @MethodSource("provideTestData")
+  public void testKeyValueBlockIteratorWithFilter(
+      ContainerTestVersionInfo versionInfo, String keySeparator)
+      throws Exception {
+    initTest(versionInfo, keySeparator);
     int normalBlocks = 5;
     int deletingBlocks = 5;
     Map<String, List<Long>> blockIDs = createContainerWithBlocks(CONTAINER_ID,
-            normalBlocks, deletingBlocks);
+        normalBlocks, deletingBlocks);
     try (BlockIterator<BlockData> keyValueBlockIterator =
-                db.getStore().getBlockIterator(CONTAINER_ID,
-                        containerData.getDeletingBlockKeyFilter())) {
+             db.getStore().getBlockIterator(CONTAINER_ID,
+                 containerData.getDeletingBlockKeyFilter())) {
       List<Long> deletingBlockIDs =
-              blockIDs.get(OzoneConsts.DELETING_KEY_PREFIX);
+          blockIDs.get(OzoneConsts.DELETING_KEY_PREFIX);
       int counter = 0;
       while (keyValueBlockIterator.hasNext()) {
         BlockData blockData = keyValueBlockIterator.nextBlock();
-        assertEquals((long)deletingBlockIDs.get(counter),
-                blockData.getLocalID());
+        assertEquals((long) deletingBlockIDs.get(counter),
+            blockData.getLocalID());
         counter++;
       }
 
@@ -253,12 +267,15 @@ public class TestKeyValueBlockIterator {
     }
   }
 
-  @Test
-  public void testKeyValueBlockIteratorWithOnlyDeletedBlocks() throws
-      Exception {
+  @ParameterizedTest
+  @MethodSource("provideTestData")
+  public void testKeyValueBlockIteratorWithOnlyDeletedBlocks(
+      ContainerTestVersionInfo versionInfo, String keySeparator)
+      throws Exception {
+    initTest(versionInfo, keySeparator);
     createContainerWithBlocks(CONTAINER_ID, 0, 5);
     try (BlockIterator<BlockData> keyValueBlockIterator =
-                db.getStore().getBlockIterator(CONTAINER_ID)) {
+             db.getStore().getBlockIterator(CONTAINER_ID)) {
       //As all blocks are deleted blocks, blocks does not match with normal key
       // filter.
       assertFalse(keyValueBlockIterator.hasNext());
@@ -285,9 +302,12 @@ public class TestKeyValueBlockIterator {
    *
    * @throws Exception
    */
-  @Test
-  public void testKeyValueBlockIteratorWithAdvancedFilter() throws
-          Exception {
+  @ParameterizedTest
+  @MethodSource("provideTestData")
+  public void testKeyValueBlockIteratorWithAdvancedFilter(
+      ContainerTestVersionInfo versionInfo, String keySeparator)
+      throws Exception {
+    initTest(versionInfo, keySeparator);
     // Block data table currently only uses one prefix type.
     // Introduce a second prefix type to make sure the iterator functions
     // correctly if more prefixes were to be added in the future.
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainer.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainer.java
index 6d3c95822f..616cbf5807 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainer.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainer.java
@@ -57,17 +57,13 @@ import org.apache.ozone.test.GenericTestUtils;
 import org.apache.hadoop.util.DiskChecker;
 
 import org.assertj.core.api.Fail;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
-import org.junit.rules.TemporaryFolder;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.Assume;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.mockito.Mockito;
 import org.rocksdb.ColumnFamilyOptions;
 import org.rocksdb.LiveFileMetaData;
@@ -99,10 +95,10 @@ import static org.apache.hadoop.ozone.container.common.statemachine.DatanodeConf
 import static org.apache.hadoop.ozone.container.keyvalue.helpers.KeyValueContainerUtil.isSameSchemaVersion;
 import static org.apache.hadoop.ozone.container.replication.CopyContainerCompression.NO_COMPRESSION;
 import static org.apache.ratis.util.Preconditions.assertTrue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+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.junit.jupiter.api.Assertions.fail;
 import static org.mockito.ArgumentMatchers.anyList;
 import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.Mockito.mock;
@@ -110,11 +106,10 @@ import static org.mockito.Mockito.mock;
 /**
  * Class to test KeyValue Container operations.
  */
-@RunWith(Parameterized.class)
 public class TestKeyValueContainer {
 
-  @Rule
-  public TemporaryFolder folder = new TemporaryFolder();
+  @TempDir
+  private Path folder;
 
   private String scmId = UUID.randomUUID().toString();
   private VolumeSet volumeSet;
@@ -123,7 +118,7 @@ public class TestKeyValueContainer {
   private KeyValueContainer keyValueContainer;
   private UUID datanodeId;
 
-  private final ContainerLayoutVersion layout;
+  private ContainerLayoutVersion layout;
   private String schemaVersion;
   private List<HddsVolume> hddsVolumes;
 
@@ -132,19 +127,18 @@ public class TestKeyValueContainer {
   // cache for testContainersShareColumnFamilyOptions.
   private static final OzoneConfiguration CONF = new OzoneConfiguration();
 
-  public TestKeyValueContainer(ContainerTestVersionInfo versionInfo) {
+  private void setVersionInfo(ContainerTestVersionInfo versionInfo) {
     this.layout = versionInfo.getLayout();
     this.schemaVersion = versionInfo.getSchemaVersion();
     ContainerTestVersionInfo.setTestSchemaVersion(schemaVersion, CONF);
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> versionInfo() {
     return ContainerTestVersionInfo.versionParameters();
   }
 
-  @Before
-  public void setUp() throws Exception {
+  private void init(ContainerTestVersionInfo versionInfo) throws Exception {
+    setVersionInfo(versionInfo);
     CodecBuffer.enableLeakDetection();
 
     DatanodeConfiguration dc = CONF.getObject(DatanodeConfiguration.class);
@@ -156,9 +150,9 @@ public class TestKeyValueContainer {
 
     hddsVolumes = new ArrayList<>();
 
-    hddsVolumes.add(new HddsVolume.Builder(folder.getRoot()
-        .getAbsolutePath()).conf(CONF).datanodeUuid(datanodeId
-        .toString()).build());
+    hddsVolumes.add(new HddsVolume.Builder(folder.toString())
+        .conf(CONF).datanodeUuid(datanodeId
+            .toString()).build());
     StorageVolumeUtil.checkVolume(hddsVolumes.get(0), scmId, scmId, CONF,
         null, null);
 
@@ -183,13 +177,20 @@ public class TestKeyValueContainer {
     keyValueContainer = new KeyValueContainer(keyValueContainerData, CONF);
   }
 
-  @After
+  @AfterEach
   public void after() {
     CodecBuffer.assertNoLeaks();
   }
 
-  @Test
-  public void testCreateContainer() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testCreateContainer(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    init(versionInfo);
+    testCreateContainer();
+  }
+
+  private void testCreateContainer() throws StorageContainerException {
     createContainer();
 
     String containerMetaDataPath = keyValueContainerData.getMetadataPath();
@@ -208,8 +209,11 @@ public class TestKeyValueContainer {
   /**
    * Tests repair of containers affected by the bug reported in HDDS-6235.
    */
-  @Test
-  public void testMissingChunksDirCreated() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testMissingChunksDirCreated(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    init(versionInfo);
     // Create an empty container and delete its chunks directory.
     createContainer();
     closeContainer();
@@ -217,18 +221,23 @@ public class TestKeyValueContainer {
     populate(0);
     KeyValueContainerData data = keyValueContainer.getContainerData();
     File chunksDir = new File(data.getChunksPath());
-    Assert.assertTrue(chunksDir.delete());
+    Assertions.assertTrue(chunksDir.delete());
 
     // When the container is loaded, the missing chunks directory should
     // be created.
     KeyValueContainerUtil.parseKVContainerData(data, CONF);
-    Assert.assertTrue(chunksDir.exists());
+    Assertions.assertTrue(chunksDir.exists());
   }
 
-  @Test
-  public void testNextVolumeTriedOnWriteFailure() throws Exception {
-    HddsVolume newVolume = new HddsVolume.Builder(
-        folder.newFolder().getAbsolutePath())
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testNextVolumeTriedOnWriteFailure(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    init(versionInfo);
+    String volumeDirPath =
+        Files.createDirectory(folder.resolve("volumeDir"))
+            .toFile().getAbsolutePath();
+    HddsVolume newVolume = new HddsVolume.Builder(volumeDirPath)
         .conf(CONF).datanodeUuid(datanodeId.toString()).build();
     StorageVolumeUtil.checkVolume(newVolume, scmId, scmId, CONF, null, null);
     hddsVolumes.add(newVolume);
@@ -237,7 +246,7 @@ public class TestKeyValueContainer {
     // simulating a disk or write failure. The second time it should be ok
 
     final AtomicInteger callCount = new AtomicInteger(0);
-    keyValueContainer = new KeyValueContainer(keyValueContainerData, CONF)  {
+    keyValueContainer = new KeyValueContainer(keyValueContainerData, CONF) {
 
       @Override
       protected void createContainerMetaData(File containerMetaDataPath,
@@ -259,8 +268,11 @@ public class TestKeyValueContainer {
     assertEquals(2, callCount.get());
   }
 
-  @Test
-  public void testEmptyContainerImportExport() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testEmptyContainerImportExport(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    init(versionInfo);
     createContainer();
     closeContainer();
 
@@ -270,7 +282,8 @@ public class TestKeyValueContainer {
     checkContainerFilesPresent(data, 0);
 
     //destination path
-    File exportTar = folder.newFile("exported.tar");
+    File exportTar = Files.createFile(
+        folder.resolve("export.tar")).toFile();
     TarContainerPacker packer = new TarContainerPacker(NO_COMPRESSION);
     //export the container
     try (FileOutputStream fos = new FileOutputStream(exportTar)) {
@@ -290,8 +303,11 @@ public class TestKeyValueContainer {
     checkContainerFilesPresent(data, 0);
   }
 
-  @Test
-  public void testUnhealthyContainerImportExport() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testUnhealthyContainerImportExport(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    init(versionInfo);
     createContainer();
     long numberOfKeysToWrite = 12;
     populate(numberOfKeysToWrite);
@@ -301,7 +317,7 @@ public class TestKeyValueContainer {
     keyValueContainer.update(data.getMetadata(), true);
 
     //destination path
-    File exportTar = folder.newFile("exported.tar");
+    File exportTar = Files.createFile(folder.resolve("export.tar")).toFile();
     TarContainerPacker packer = new TarContainerPacker(NO_COMPRESSION);
     //export the container
     try (FileOutputStream fos = new FileOutputStream(exportTar)) {
@@ -327,8 +343,11 @@ public class TestKeyValueContainer {
     assertEquals(numberOfKeysToWrite, keyValueContainerData.getBlockCount());
   }
 
-  @Test
-  public void testContainerImportExport() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testContainerImportExport(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    init(versionInfo);
     long containerId = keyValueContainer.getContainerData().getContainerID();
     createContainer();
     long numberOfKeysToWrite = 12;
@@ -336,7 +355,8 @@ public class TestKeyValueContainer {
     populate(numberOfKeysToWrite);
 
     //destination path
-    File folderToExport = folder.newFile("exported.tar");
+    File folderToExport = Files.createFile(
+        folder.resolve("export.tar")).toFile();
     for (CopyContainerCompression compr : CopyContainerCompression.values()) {
       TarContainerPacker packer = new TarContainerPacker(compr);
 
@@ -423,13 +443,13 @@ public class TestKeyValueContainer {
   private void checkContainerFilesPresent(KeyValueContainerData data,
       long expectedNumFilesInChunksDir) throws IOException {
     File chunksDir = new File(data.getChunksPath());
-    Assert.assertTrue(Files.isDirectory(chunksDir.toPath()));
+    assertTrue(Files.isDirectory(chunksDir.toPath()));
     try (Stream<Path> stream = Files.list(chunksDir.toPath())) {
-      Assert.assertEquals(expectedNumFilesInChunksDir, stream.count());
+      assertEquals(expectedNumFilesInChunksDir, stream.count());
     }
-    Assert.assertTrue(data.getDbFile().exists());
-    Assert.assertTrue(KeyValueContainer.getContainerFile(data.getMetadataPath(),
-        data.getContainerID()).exists());
+    assertTrue(data.getDbFile().exists());
+    assertTrue(KeyValueContainer.getContainerFile(
+        data.getMetadataPath(), data.getContainerID()).exists());
   }
 
   /**
@@ -498,8 +518,11 @@ public class TestKeyValueContainer {
         ContainerProtos.ContainerDataProto.State.CLOSED);
   }
 
-  @Test
-  public void concurrentExport() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void concurrentExport(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    init(versionInfo);
     createContainer();
     populate(100);
     closeContainer();
@@ -510,8 +533,9 @@ public class TestKeyValueContainer {
     List<Thread> threads = IntStream.range(0, 20)
         .mapToObj(i -> new Thread(() -> {
           try {
-            File file = folder.newFile("concurrent" + i + ".tar");
-            try (OutputStream out = new FileOutputStream(file)) {
+            File file = Files.createFile(
+                folder.resolve("concurrent" + i + ".tar")).toFile();
+            try (OutputStream out = Files.newOutputStream(file.toPath())) {
               keyValueContainer.exportContainerData(out, packer);
             }
           } catch (Exception e) {
@@ -528,8 +552,11 @@ public class TestKeyValueContainer {
     assertNull(failed.get());
   }
 
-  @Test
-  public void testDuplicateContainer() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testDuplicateContainer(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    init(versionInfo);
     try {
       // Create Container.
       keyValueContainer.create(volumeSet, volumeChoosingPolicy, scmId);
@@ -543,9 +570,11 @@ public class TestKeyValueContainer {
     }
   }
 
-  @Test
-  public void testDiskFullExceptionCreateContainer() throws Exception {
-
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testDiskFullExceptionCreateContainer(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    init(versionInfo);
     Mockito.reset(volumeChoosingPolicy);
     Mockito.when(volumeChoosingPolicy.chooseVolume(anyList(), anyLong()))
         .thenThrow(DiskChecker.DiskOutOfSpaceException.class);
@@ -559,8 +588,11 @@ public class TestKeyValueContainer {
     }
   }
 
-  @Test
-  public void testDeleteContainer() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testDeleteContainer(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    init(versionInfo);
     closeContainer();
     keyValueContainer = new KeyValueContainer(
         keyValueContainerData, CONF);
@@ -573,22 +605,25 @@ public class TestKeyValueContainer {
         .getMetadataPath();
     File containerMetaDataLoc = new File(containerMetaDataPath);
 
-    assertFalse("Container directory still exists", containerMetaDataLoc
-        .getParentFile().exists());
+    assertFalse(containerMetaDataLoc
+        .getParentFile().exists(), "Container directory still exists");
 
-    assertFalse("Container File still exists",
-        keyValueContainer.getContainerFile().exists());
+    assertFalse(keyValueContainer.getContainerFile().exists(),
+        "Container File still exists");
 
     if (isSameSchemaVersion(schemaVersion, OzoneConsts.SCHEMA_V3)) {
       assertTrue(keyValueContainer.getContainerDBFile().exists());
     } else {
-      assertFalse("Container DB file still exists",
-          keyValueContainer.getContainerDBFile().exists());
+      assertFalse(keyValueContainer.getContainerDBFile().exists(),
+          "Container DB file still exists");
     }
   }
 
-  @Test
-  public void testCloseContainer() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testCloseContainer(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    init(versionInfo);
     keyValueContainer.create(volumeSet, volumeChoosingPolicy, scmId);
     keyValueContainer.close();
 
@@ -607,21 +642,28 @@ public class TestKeyValueContainer {
         keyValueContainerData.getState());
   }
 
-  @Test
-  public void testReportOfUnhealthyContainer() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testReportOfUnhealthyContainer(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    init(versionInfo);
     keyValueContainer.create(volumeSet, volumeChoosingPolicy, scmId);
-    Assert.assertNotNull(keyValueContainer.getContainerReport());
+    Assertions.assertNotNull(keyValueContainer.getContainerReport());
     keyValueContainer.markContainerUnhealthy();
     File containerFile = keyValueContainer.getContainerFile();
     keyValueContainerData = (KeyValueContainerData) ContainerDataYaml
         .readContainerFile(containerFile);
     assertEquals(ContainerProtos.ContainerDataProto.State.UNHEALTHY,
         keyValueContainerData.getState());
-    Assert.assertNotNull(keyValueContainer.getContainerReport());
+    Assertions.assertNotNull(keyValueContainer.getContainerReport());
   }
 
-  @Test
-  public void testUpdateContainer() throws IOException {
+
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testUpdateContainer(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    init(versionInfo);
     keyValueContainer.create(volumeSet, volumeChoosingPolicy, scmId);
     Map<String, String> metadata = new HashMap<>();
     metadata.put(OzoneConsts.VOLUME, OzoneConsts.OZONE);
@@ -642,8 +684,11 @@ public class TestKeyValueContainer {
 
   }
 
-  @Test
-  public void testUpdateContainerUnsupportedRequest() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testUpdateContainerUnsupportedRequest(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    init(versionInfo);
     try {
       closeContainer();
       keyValueContainer = new KeyValueContainer(keyValueContainerData, CONF);
@@ -660,8 +705,12 @@ public class TestKeyValueContainer {
     }
   }
 
-  @Test
-  public void testContainerRocksDB() throws IOException {
+
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testContainerRocksDB(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    init(versionInfo);
     closeContainer();
     keyValueContainer = new KeyValueContainer(
         keyValueContainerData, CONF);
@@ -672,11 +721,11 @@ public class TestKeyValueContainer {
       long defaultCacheSize = 64 * OzoneConsts.MB;
       long cacheSize = Long.parseLong(store
           .getProperty("rocksdb.block-cache-capacity"));
-      Assert.assertEquals(defaultCacheSize, cacheSize);
+      Assertions.assertEquals(defaultCacheSize, cacheSize);
       for (ColumnFamily handle : store.getColumnFamilies()) {
         cacheSize = Long.parseLong(
             store.getProperty(handle, "rocksdb.block-cache-capacity"));
-        Assert.assertEquals(defaultCacheSize, cacheSize);
+        Assertions.assertEquals(defaultCacheSize, cacheSize);
       }
     }
   }
@@ -693,7 +742,7 @@ public class TestKeyValueContainer {
           .getColumnFamilyOptions(new OzoneConfiguration());
       ColumnFamilyOptions columnFamilyOptions2 = dbProfileSupplier.get()
           .getColumnFamilyOptions(new OzoneConfiguration());
-      Assert.assertEquals(columnFamilyOptions1, columnFamilyOptions2);
+      Assertions.assertEquals(columnFamilyOptions1, columnFamilyOptions2);
 
       // ColumnFamilyOptions should be same when queried multiple times
       // for a particulat configuration
@@ -701,30 +750,32 @@ public class TestKeyValueContainer {
           .getColumnFamilyOptions(conf);
       columnFamilyOptions2 = dbProfileSupplier.get()
           .getColumnFamilyOptions(conf);
-      Assert.assertEquals(columnFamilyOptions1, columnFamilyOptions2);
+      Assertions.assertEquals(columnFamilyOptions1, columnFamilyOptions2);
     }
 
     // Make sure ColumnFamilyOptions are different for different db profile
     DatanodeDBProfile diskProfile = new DatanodeDBProfile.Disk();
     DatanodeDBProfile ssdProfile = new DatanodeDBProfile.SSD();
-    Assert.assertNotEquals(
+    Assertions.assertNotEquals(
         diskProfile.getColumnFamilyOptions(new OzoneConfiguration()),
         ssdProfile.getColumnFamilyOptions(new OzoneConfiguration()));
-    Assert.assertNotEquals(diskProfile.getColumnFamilyOptions(conf),
+    Assertions.assertNotEquals(diskProfile.getColumnFamilyOptions(conf),
         ssdProfile.getColumnFamilyOptions(conf));
   }
 
-
-  @Test
-  public void testDBProfileAffectsDBOptions() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testDBProfileAffectsDBOptions(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    init(versionInfo);
     // Create Container 1
     keyValueContainer.create(volumeSet, volumeChoosingPolicy, scmId);
 
     DatanodeDBProfile outProfile1;
     try (DBHandle db1 =
-        BlockUtils.getDB(keyValueContainer.getContainerData(), CONF)) {
+             BlockUtils.getDB(keyValueContainer.getContainerData(), CONF)) {
       DatanodeStore store1 = db1.getStore();
-      Assert.assertTrue(store1 instanceof AbstractDatanodeStore);
+      Assertions.assertTrue(store1 instanceof AbstractDatanodeStore);
       outProfile1 = ((AbstractDatanodeStore) store1).getDbProfile();
     }
 
@@ -745,24 +796,27 @@ public class TestKeyValueContainer {
     try (DBHandle db2 =
         BlockUtils.getDB(keyValueContainer.getContainerData(), otherConf)) {
       DatanodeStore store2 = db2.getStore();
-      Assert.assertTrue(store2 instanceof AbstractDatanodeStore);
+      Assertions.assertTrue(store2 instanceof AbstractDatanodeStore);
       outProfile2 = ((AbstractDatanodeStore) store2).getDbProfile();
     }
 
     // DBOtions should be different, except SCHEMA-V3
     if (isSameSchemaVersion(schemaVersion, OzoneConsts.SCHEMA_V3)) {
-      Assert.assertEquals(
+      Assertions.assertEquals(
           outProfile1.getDBOptions().compactionReadaheadSize(),
           outProfile2.getDBOptions().compactionReadaheadSize());
     } else {
-      Assert.assertNotEquals(
+      Assertions.assertNotEquals(
           outProfile1.getDBOptions().compactionReadaheadSize(),
           outProfile2.getDBOptions().compactionReadaheadSize());
     }
   }
 
-  @Test
-  public void testKeyValueDataProtoBufMsg() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testKeyValueDataProtoBufMsg(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    init(versionInfo);
     createContainer();
     populate(10);
     closeContainer();
@@ -788,13 +842,18 @@ public class TestKeyValueContainer {
     }
   }
 
-  @Test
-  public void testAutoCompactionSmallSstFile() throws IOException {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testAutoCompactionSmallSstFile(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    init(versionInfo);
     Assume.assumeTrue(
         isSameSchemaVersion(schemaVersion, OzoneConsts.SCHEMA_V3));
     // Create a new HDDS volume
-    HddsVolume newVolume = new HddsVolume.Builder(
-        folder.newFolder().getAbsolutePath())
+    String volumeDirPath =
+        Files.createDirectory(folder.resolve("volumeDir")).toFile()
+            .getAbsolutePath();
+    HddsVolume newVolume = new HddsVolume.Builder(volumeDirPath)
         .conf(CONF).datanodeUuid(datanodeId.toString()).build();
     StorageVolumeUtil.checkVolume(newVolume, scmId, scmId, CONF, null, null);
     List<HddsVolume> volumeList = new ArrayList<>();
@@ -830,7 +889,8 @@ public class TestKeyValueContainer {
         //destination path
         if (volume == newVolume) {
           File folderToExport =
-              folder.newFile(containerId + "_exported.tar.gz");
+              Files.createFile(
+                  folder.resolve(containerId + "_exported.tar.gz")).toFile();
           TarContainerPacker packer = new TarContainerPacker(NO_COMPRESSION);
           //export the container
           try (FileOutputStream fos = new FileOutputStream(folderToExport)) {
@@ -875,7 +935,7 @@ public class TestKeyValueContainer {
       Thread.sleep(7000);
       List<LiveFileMetaData> fileMetaDataList2 =
           ((RDBStore)(dnStore.getStore())).getDb().getLiveFilesMetaData();
-      Assert.assertTrue(fileMetaDataList2.size() < fileMetaDataList1.size());
+      assertTrue(fileMetaDataList2.size() < fileMetaDataList1.size());
     } catch (Exception e) {
       Fail.fail("TestAutoCompactionSmallSstFile failed");
     } finally {
@@ -888,8 +948,11 @@ public class TestKeyValueContainer {
     }
   }
 
-  @Test
-  public void testIsEmptyContainerStateWhileImport() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testIsEmptyContainerStateWhileImport(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    init(versionInfo);
     long containerId = keyValueContainer.getContainerData().getContainerID();
     createContainer();
     long numberOfKeysToWrite = 1;
@@ -897,7 +960,8 @@ public class TestKeyValueContainer {
     populate(numberOfKeysToWrite);
 
     //destination path
-    File folderToExport = folder.newFile("export.tar");
+    File folderToExport = Files.createFile(
+        folder.resolve("export.tar")).toFile();
     for (CopyContainerCompression compr : CopyContainerCompression.values()) {
       TarContainerPacker packer = new TarContainerPacker(compr);
 
@@ -930,13 +994,15 @@ public class TestKeyValueContainer {
       }
 
       // After import check whether isEmpty flag is false
-      Assert.assertFalse(container.getContainerData().isEmpty());
+      assertFalse(container.getContainerData().isEmpty());
     }
   }
 
-  @Test
-  public void testIsEmptyContainerStateWhileImportWithoutBlock()
-      throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testIsEmptyContainerStateWhileImportWithoutBlock(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    init(versionInfo);
     long containerId = keyValueContainer.getContainerData().getContainerID();
     createContainer();
     long numberOfKeysToWrite = 1;
@@ -944,7 +1010,8 @@ public class TestKeyValueContainer {
     populateWithoutBlock(keyValueContainer, numberOfKeysToWrite);
 
     //destination path
-    File folderToExport = folder.newFile("export.tar");
+    File folderToExport = Files.createFile(
+        folder.resolve("export.tar")).toFile();
     for (CopyContainerCompression compr : CopyContainerCompression.values()) {
       TarContainerPacker packer = new TarContainerPacker(compr);
 
@@ -977,15 +1044,18 @@ public class TestKeyValueContainer {
 
       // After import check whether isEmpty flag is true
       // since there are no blocks in rocksdb
-      Assert.assertTrue(container.getContainerData().isEmpty());
+      Assertions.assertTrue(container.getContainerData().isEmpty());
     }
   }
 
   /**
    * Test import schema V2 replica to V3 enabled HddsVolume.
    */
-  @Test
-  public void testImportV2ReplicaToV3HddsVolume() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testImportV2ReplicaToV3HddsVolume(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    init(versionInfo);
     final String testDir = GenericTestUtils.getTempPath(
         TestKeyValueContainer.class.getSimpleName() + "-"
             + UUID.randomUUID());
@@ -999,8 +1069,11 @@ public class TestKeyValueContainer {
   /**
    * Test import schema V3 replica to V3 disabled HddsVolume.
    */
-  @Test
-  public void testImportV3ReplicaToV2HddsVolume() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testImportV3ReplicaToV2HddsVolume(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    init(versionInfo);
     final String testDir = GenericTestUtils.getTempPath(
         TestKeyValueContainer.class.getSimpleName() + "-"
             + UUID.randomUUID());
@@ -1042,10 +1115,10 @@ public class TestKeyValueContainer {
 
     // verify container schema
     if (schemaV3Enabled) {
-      Assert.assertEquals(SCHEMA_V3,
+      Assertions.assertEquals(SCHEMA_V3,
           container.getContainerData().getSchemaVersion());
     } else {
-      Assert.assertEquals(SCHEMA_V2,
+      Assertions.assertEquals(SCHEMA_V2,
           container.getContainerData().getSchemaVersion());
     }
 
@@ -1075,9 +1148,9 @@ public class TestKeyValueContainer {
       importedContainer.importContainerData(fio, packer);
     }
 
-    Assert.assertEquals(schemaV3Enabled ? SCHEMA_V3 : SCHEMA_V2,
+    Assertions.assertEquals(schemaV3Enabled ? SCHEMA_V3 : SCHEMA_V2,
         importedContainer.getContainerData().getSchemaVersion());
-    Assert.assertEquals(pendingDeleteBlockCount,
+    Assertions.assertEquals(pendingDeleteBlockCount,
         importedContainer.getContainerData().getNumPendingDeletionBlocks());
   }
 }
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerCheck.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerCheck.java
index decfdf3a80..4aa995a768 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerCheck.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerCheck.java
@@ -50,10 +50,10 @@ public class TestKeyValueContainerCheck
    * Sanity test, when there are no corruptions induced.
    */
   @ParameterizedTest
-  @MethodSource("data")
+  @MethodSource("versionInfo")
   public void testKeyValueContainerCheckNoCorruption(
       ContainerTestVersionInfo versionInfo) throws Exception {
-    setUp(versionInfo);
+    initTestData(versionInfo);
     long containerID = 101;
     int deletedBlocks = 1;
     int normalBlocks = 3;
@@ -86,10 +86,10 @@ public class TestKeyValueContainerCheck
    * Sanity test, when there are corruptions induced.
    */
   @ParameterizedTest
-  @MethodSource("data")
+  @MethodSource("versionInfo")
   public void testKeyValueContainerCheckCorruption(
       ContainerTestVersionInfo versionInfo) throws Exception {
-    setUp(versionInfo);
+    initTestData(versionInfo);
     long containerID = 102;
     int deletedBlocks = 1;
     int normalBlocks = 3;
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerIntegrityChecks.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerIntegrityChecks.java
index dcf068909e..e1e2fcf6d7 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerIntegrityChecks.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerIntegrityChecks.java
@@ -44,7 +44,6 @@ import java.util.ArrayList;
 import java.nio.ByteBuffer;
 import java.util.List;
 import java.util.UUID;
-import java.util.stream.Stream;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.HDDS_DATANODE_DIR_KEY;
@@ -72,9 +71,9 @@ public class TestKeyValueContainerIntegrityChecks {
   protected static final int CHUNK_LEN = 3 * UNIT_LEN;
   protected static final int CHUNKS_PER_BLOCK = 4;
 
-  private void initialize(ContainerTestVersionInfo versionInfo) {
-    LOG.info("new TestKeyValueContainerIntegrityChecks for {}", versionInfo);
-    conf = new OzoneConfiguration();
+  void initTestData(ContainerTestVersionInfo versionInfo) throws Exception {
+    LOG.info("new {} for {}", getClass().getSimpleName(), versionInfo);
+    this.conf = new OzoneConfiguration();
     ContainerTestVersionInfo.setTestSchemaVersion(
         versionInfo.getSchemaVersion(), conf);
     if (versionInfo.getLayout()
@@ -83,14 +82,14 @@ public class TestKeyValueContainerIntegrityChecks {
     } else {
       containerLayoutTestInfo = ContainerLayoutTestInfo.FILE_PER_CHUNK;
     }
+    setup();
   }
 
-  private static Stream<Object> data() {
-    return ContainerTestVersionInfo.versionParametersStream();
+  static Iterable<Object[]> versionInfo() {
+    return ContainerTestVersionInfo.versionParameters();
   }
 
-  public void setUp(ContainerTestVersionInfo versionInfo) throws Exception {
-    initialize(versionInfo);
+  private void setup() throws Exception {
     LOG.info("Testing  layout:{}", containerLayoutTestInfo.getLayout());
     this.testRoot = GenericTestUtils.getRandomizedTestDir();
     conf.set(HDDS_DATANODE_DIR_KEY, testRoot.getAbsolutePath());
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerMarkUnhealthy.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerMarkUnhealthy.java
index e2ffadbbb0..380d0dd9a4 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerMarkUnhealthy.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerMarkUnhealthy.java
@@ -27,29 +27,26 @@ import org.apache.hadoop.ozone.container.common.volume.HddsVolume;
 import org.apache.hadoop.ozone.container.common.volume.RoundRobinVolumeChoosingPolicy;
 import org.apache.hadoop.ozone.container.common.volume.VolumeSet;
 import org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet;
-import org.junit.After;
-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.rules.TestRule;
-import org.junit.rules.Timeout;
-import org.apache.ozone.test.JUnit5AwareTimeout;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.mockito.Mockito;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.UUID;
 
 import static org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerDataProto.State.OPEN;
 import static org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerDataProto.State.UNHEALTHY;
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
 import static org.mockito.ArgumentMatchers.anyList;
 import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.Mockito.mock;
@@ -58,19 +55,13 @@ import static org.mockito.Mockito.mock;
  * Tests unhealthy container functionality in the {@link KeyValueContainer}
  * class.
  */
-@RunWith(Parameterized.class)
+@Timeout(600)
 public class TestKeyValueContainerMarkUnhealthy {
   public static final Logger LOG = LoggerFactory.getLogger(
       TestKeyValueContainerMarkUnhealthy.class);
 
-  @Rule
-  public TemporaryFolder folder = new TemporaryFolder();
-
-  @Rule
-  public TestRule timeout = new JUnit5AwareTimeout(Timeout.seconds(600));
-
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
+  @TempDir
+  private Path folder;
 
   private OzoneConfiguration conf;
   private String scmId = UUID.randomUUID().toString();
@@ -80,22 +71,22 @@ public class TestKeyValueContainerMarkUnhealthy {
   private KeyValueContainer keyValueContainer;
   private UUID datanodeId;
 
-  private final ContainerLayoutVersion layout;
+  private ContainerLayoutVersion layout;
 
-  public TestKeyValueContainerMarkUnhealthy(ContainerLayoutVersion layout) {
-    this.layout = layout;
+  private void initTestData(ContainerLayoutVersion layoutVersion) throws Exception {
+    this.layout = layoutVersion;
+    setup();
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> layoutVersion() {
     return ContainerLayoutTestInfo.containerLayoutParameters();
   }
 
-  @Before
-  public void setUp() throws Exception {
+  public void setup() throws Exception {
     conf = new OzoneConfiguration();
     datanodeId = UUID.randomUUID();
-    String dataDir = folder.newFolder("data").getAbsolutePath();
+    String dataDir = Files.createDirectory(
+        folder.resolve("data")).toAbsolutePath().toString();
     HddsVolume hddsVolume = new HddsVolume.Builder(dataDir)
         .conf(conf)
         .datanodeUuid(datanodeId.toString())
@@ -112,7 +103,8 @@ public class TestKeyValueContainerMarkUnhealthy {
         layout,
         (long) StorageUnit.GB.toBytes(5), UUID.randomUUID().toString(),
         datanodeId.toString());
-    final File metaDir = folder.newFolder("meta");
+    final File metaDir = Files.createDirectory(
+        folder.resolve("meta")).toAbsolutePath().toFile();
     keyValueContainerData.setMetadataPath(metaDir.getPath());
 
 
@@ -120,7 +112,7 @@ public class TestKeyValueContainerMarkUnhealthy {
         keyValueContainerData, conf);
   }
 
-  @After
+  @AfterEach
   public void teardown() {
     volumeSet = null;
     keyValueContainer = null;
@@ -133,8 +125,10 @@ public class TestKeyValueContainerMarkUnhealthy {
    *
    * @throws IOException
    */
-  @Test
-  public void testMarkContainerUnhealthy() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testMarkContainerUnhealthy(ContainerLayoutVersion layoutVersion) throws Exception {
+    initTestData(layoutVersion);
     assertThat(keyValueContainerData.getState(), is(OPEN));
     keyValueContainer.markContainerUnhealthy();
     assertThat(keyValueContainerData.getState(), is(UNHEALTHY));
@@ -149,20 +143,26 @@ public class TestKeyValueContainerMarkUnhealthy {
 
   /**
    * Attempting to close an unhealthy container should fail.
+   *
    * @throws IOException
    */
-  @Test
-  public void testCloseUnhealthyContainer() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testCloseUnhealthyContainer(ContainerLayoutVersion layoutVersion) throws Exception {
+    initTestData(layoutVersion);
     keyValueContainer.markContainerUnhealthy();
-    thrown.expect(StorageContainerException.class);
-    keyValueContainer.markContainerForClose();
+    Assertions.assertThrows(StorageContainerException.class, () ->
+        keyValueContainer.markContainerForClose());
+
   }
 
   /**
    * Attempting to mark a closed container as unhealthy should succeed.
    */
-  @Test
-  public void testMarkClosedContainerAsUnhealthy() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testMarkClosedContainerAsUnhealthy(ContainerLayoutVersion layoutVersion) throws Exception {
+    initTestData(layoutVersion);
     // We need to create the container so the compact-on-close operation
     // does not NPE.
     keyValueContainer.create(volumeSet, volumeChoosingPolicy, scmId);
@@ -174,8 +174,10 @@ public class TestKeyValueContainerMarkUnhealthy {
   /**
    * Attempting to mark a quasi-closed container as unhealthy should succeed.
    */
-  @Test
-  public void testMarkQuasiClosedContainerAsUnhealthy() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testMarkQuasiClosedContainerAsUnhealthy(ContainerLayoutVersion layoutVersion) throws Exception {
+    initTestData(layoutVersion);
     // We need to create the container so the sync-on-quasi-close operation
     // does not NPE.
     keyValueContainer.create(volumeSet, volumeChoosingPolicy, scmId);
@@ -187,8 +189,10 @@ public class TestKeyValueContainerMarkUnhealthy {
   /**
    * Attempting to mark a closing container as unhealthy should succeed.
    */
-  @Test
-  public void testMarkClosingContainerAsUnhealthy() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testMarkClosingContainerAsUnhealthy(ContainerLayoutVersion layoutVersion) throws Exception {
+    initTestData(layoutVersion);
     keyValueContainer.markContainerForClose();
     keyValueContainer.markContainerUnhealthy();
     assertThat(keyValueContainerData.getState(), is(UNHEALTHY));
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerMetadataInspector.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerMetadataInspector.java
index 9867ccb171..c560d034ce 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerMetadataInspector.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerMetadataInspector.java
@@ -59,10 +59,10 @@ public class TestKeyValueContainerMetadataInspector
   private static final long CONTAINER_ID = 102;
 
   @ParameterizedTest
-  @MethodSource("data")
+  @MethodSource("versionInfo")
   public void testRunDisabled(ContainerTestVersionInfo versionInfo)
       throws Exception {
-    setUp(versionInfo);
+    initTestData(versionInfo);
     // Create incorrect container.
     KeyValueContainer container = createClosedContainer(3);
     KeyValueContainerData containerData = container.getContainerData();
@@ -85,10 +85,10 @@ public class TestKeyValueContainerMetadataInspector
   }
 
   @ParameterizedTest
-  @MethodSource("data")
+  @MethodSource("versionInfo")
   public void testSystemPropertyAndReadOnly(
       ContainerTestVersionInfo versionInfo) throws Exception {
-    setUp(versionInfo);
+    initTestData(versionInfo);
     System.clearProperty(KeyValueContainerMetadataInspector.SYSTEM_PROPERTY);
     ContainerInspector inspector = new KeyValueContainerMetadataInspector();
     assertFalse(inspector.load());
@@ -120,10 +120,10 @@ public class TestKeyValueContainerMetadataInspector
   }
 
   @ParameterizedTest
-  @MethodSource("data")
+  @MethodSource("versionInfo")
   public void testIncorrectTotalsNoData(ContainerTestVersionInfo versionInfo)
       throws Exception {
-    setUp(versionInfo);
+    initTestData(versionInfo);
     int createBlocks = 0;
     int setBlocks = -3;
     int setBytes = -2;
@@ -135,10 +135,10 @@ public class TestKeyValueContainerMetadataInspector
   }
 
   @ParameterizedTest
-  @MethodSource("data")
+  @MethodSource("versionInfo")
   public void testIncorrectTotalsWithData(ContainerTestVersionInfo versionInfo)
       throws Exception {
-    setUp(versionInfo);
+    initTestData(versionInfo);
     int createBlocks = 3;
     int setBlocks = 4;
     int setBytes = -2;
@@ -151,11 +151,10 @@ public class TestKeyValueContainerMetadataInspector
   }
 
   @ParameterizedTest
-  @MethodSource("data")
+  @MethodSource("versionInfo")
   public void testCorrectTotalsNoData(ContainerTestVersionInfo versionInfo)
       throws Exception {
-    setUp(versionInfo);
-
+    initTestData(versionInfo);
     int createBlocks = 0;
     int setBytes = 0;
 
@@ -166,10 +165,10 @@ public class TestKeyValueContainerMetadataInspector
   }
 
   @ParameterizedTest
-  @MethodSource("data")
+  @MethodSource("versionInfo")
   public void testCorrectTotalsWithData(ContainerTestVersionInfo versionInfo)
       throws Exception {
-    setUp(versionInfo);
+    initTestData(versionInfo);
     int createBlocks = 3;
     int setBytes = CHUNK_LEN * CHUNKS_PER_BLOCK * createBlocks;
 
@@ -209,10 +208,10 @@ public class TestKeyValueContainerMetadataInspector
       = new DeletedBlocksTransactionGeneratorForTesting();
 
   @ParameterizedTest
-  @MethodSource("data")
+  @MethodSource("versionInfo")
   public void testCorrectDeleteWithTransaction(
       ContainerTestVersionInfo versionInfo) throws Exception {
-    setUp(versionInfo);
+    initTestData(versionInfo);
     final int createBlocks = 4;
     final int setBytes = CHUNK_LEN * CHUNKS_PER_BLOCK * createBlocks;
     final int deleteCount = 10;
@@ -233,10 +232,10 @@ public class TestKeyValueContainerMetadataInspector
   }
 
   @ParameterizedTest
-  @MethodSource("data")
+  @MethodSource("versionInfo")
   public void testIncorrectDeleteWithTransaction(
       ContainerTestVersionInfo versionInfo) throws Exception {
-    setUp(versionInfo);
+    initTestData(versionInfo);
     final int createBlocks = 4;
     final int setBytes = CHUNK_LEN * CHUNKS_PER_BLOCK * createBlocks;
     final int deleteCount = 10;
@@ -258,10 +257,10 @@ public class TestKeyValueContainerMetadataInspector
   }
 
   @ParameterizedTest
-  @MethodSource("data")
+  @MethodSource("versionInfo")
   public void testIncorrectDeleteWithoutTransaction(
       ContainerTestVersionInfo versionInfo) throws Exception {
-    setUp(versionInfo);
+    initTestData(versionInfo);
     final int createBlocks = 4;
     final int setBytes = CHUNK_LEN * CHUNKS_PER_BLOCK * createBlocks;
     final int deleteCount = 10;
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueHandler.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueHandler.java
index bfaf7b1fca..76cc5f25f0 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueHandler.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueHandler.java
@@ -20,6 +20,8 @@ package org.apache.hadoop.ozone.container.keyvalue;
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.List;
 import java.util.Collections;
 import java.util.HashMap;
@@ -55,23 +57,21 @@ import org.apache.ozone.test.GenericTestUtils;
 import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_DATANODE_VOLUME_CHOOSING_POLICY;
 import static org.apache.hadoop.hdds.HddsConfigKeys.OZONE_METADATA_DIRS;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.HDDS_DATANODE_DIR_KEY;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
-import org.apache.ozone.test.JUnit5AwareTimeout;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
 import org.junit.jupiter.api.Assertions;
-import org.junit.rules.TemporaryFolder;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+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;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.mockito.ArgumentMatchers.any;
+
 import org.mockito.Mockito;
+
 import static org.mockito.Mockito.doCallRealMethod;
 import static org.mockito.Mockito.times;
 
@@ -79,35 +79,25 @@ import static org.mockito.Mockito.times;
 /**
  * Unit tests for {@link KeyValueHandler}.
  */
-@RunWith(Parameterized.class)
+@Timeout(300)
 public class TestKeyValueHandler {
 
-  @Rule
-  public final TestRule timeout = new JUnit5AwareTimeout(Timeout.seconds(300));
-
-  @Rule
-  public final TemporaryFolder tempDir = new TemporaryFolder();
+  @TempDir
+  private Path tempDir;
 
   private static final String DATANODE_UUID = UUID.randomUUID().toString();
 
   private static final long DUMMY_CONTAINER_ID = 9999;
   private static final String DUMMY_PATH = "dummy/dir/doesnt/exist";
 
-  private final ContainerLayoutVersion layout;
-
   private HddsDispatcher dispatcher;
   private KeyValueHandler handler;
 
-  public TestKeyValueHandler(ContainerLayoutVersion layout) {
-    this.layout = layout;
-  }
-
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> layoutVersion() {
     return ContainerLayoutTestInfo.containerLayoutParameters();
   }
 
-  @Before
+  @BeforeEach
   public void setup() throws StorageContainerException {
     // Create mock HddsDispatcher and KeyValueHandler.
     handler = Mockito.mock(KeyValueHandler.class);
@@ -262,10 +252,14 @@ public class TestKeyValueHandler {
 
   @Test
   public void testVolumeSetInKeyValueHandler() throws Exception {
-    File path = tempDir.newFolder();
+    File datanodeDir =
+        Files.createDirectory(tempDir.resolve("datanodeDir")).toFile();
+    File metadataDir =
+        Files.createDirectory(tempDir.resolve("metadataDir")).toFile();
+
     OzoneConfiguration conf = new OzoneConfiguration();
-    conf.set(HDDS_DATANODE_DIR_KEY, path.getAbsolutePath());
-    conf.set(OZONE_METADATA_DIRS, path.getAbsolutePath());
+    conf.set(HDDS_DATANODE_DIR_KEY, datanodeDir.getAbsolutePath());
+    conf.set(OZONE_METADATA_DIRS, metadataDir.getAbsolutePath());
     MutableVolumeSet
         volumeSet = new MutableVolumeSet(UUID.randomUUID().toString(), conf,
         null, StorageVolume.VolumeType.DATA_VOLUME, null);
@@ -301,7 +295,8 @@ public class TestKeyValueHandler {
       }
     } finally {
       volumeSet.shutdown();
-      FileUtil.fullyDelete(path);
+      FileUtil.fullyDelete(datanodeDir);
+      FileUtil.fullyDelete(metadataDir);
     }
   }
 
@@ -315,12 +310,14 @@ public class TestKeyValueHandler {
   }
 
 
-  @Test
-  public void testCloseInvalidContainer() throws IOException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testCloseInvalidContainer(ContainerLayoutVersion layoutVersion)
+      throws IOException {
     long containerID = 1234L;
     OzoneConfiguration conf = new OzoneConfiguration();
     KeyValueContainerData kvData = new KeyValueContainerData(containerID,
-        layout,
+        layoutVersion,
         (long) StorageUnit.GB.toBytes(1), UUID.randomUUID().toString(),
         UUID.randomUUID().toString());
     KeyValueContainer container = new KeyValueContainer(kvData, conf);
@@ -344,13 +341,14 @@ public class TestKeyValueHandler {
     ContainerProtos.ContainerCommandResponseProto response =
         handler.handleCloseContainer(closeContainerRequest, container);
 
-    assertEquals("Close container should return Invalid container error",
-        ContainerProtos.Result.INVALID_CONTAINER_STATE, response.getResult());
+    assertEquals(ContainerProtos.Result.INVALID_CONTAINER_STATE,
+        response.getResult(),
+        "Close container should return Invalid container error");
   }
 
   @Test
   public void testDeleteContainer() throws IOException {
-    final String testDir = tempDir.newFolder().getAbsolutePath();
+    final String testDir = tempDir.toString();
     try {
       // Case 1 : Regular container delete
       final long containerID = 1L;
@@ -389,12 +387,12 @@ public class TestKeyValueHandler {
           createContainerRequest(datanodeId, containerID);
 
       kvHandler.handleCreateContainer(createContainer, null);
-      Assert.assertEquals(1, icrReceived.get());
-      Assert.assertNotNull(containerSet.getContainer(containerID));
+      Assertions.assertEquals(1, icrReceived.get());
+      Assertions.assertNotNull(containerSet.getContainer(containerID));
 
       kvHandler.deleteContainer(containerSet.getContainer(containerID), true);
-      Assert.assertEquals(2, icrReceived.get());
-      Assert.assertNull(containerSet.getContainer(containerID));
+      Assertions.assertEquals(2, icrReceived.get());
+      Assertions.assertNull(containerSet.getContainer(containerID));
 
       File[] deletedContainers =
           hddsVolume.getDeletedContainerDir().listFiles();
@@ -411,9 +409,9 @@ public class TestKeyValueHandler {
 
       kvHandler.handleCreateContainer(createContainer2, null);
 
-      Assert.assertEquals(3, icrReceived.get());
+      Assertions.assertEquals(3, icrReceived.get());
       Container<?> container = containerSet.getContainer(container2ID);
-      Assert.assertNotNull(container);
+      Assertions.assertNotNull(container);
       File deletedContainerDir = hddsVolume.getDeletedContainerDir();
       // to simulate failed move
       File dummyDir = new File(DUMMY_PATH);
@@ -421,7 +419,7 @@ public class TestKeyValueHandler {
       try {
         kvHandler.deleteContainer(container, true);
       } catch (StorageContainerException sce) {
-        Assert.assertTrue(
+        Assertions.assertTrue(
             sce.getMessage().contains("Failed to move container"));
       }
       Mockito.verify(volumeSet).checkVolumeAsync(hddsVolume);
@@ -438,7 +436,7 @@ public class TestKeyValueHandler {
       String expectedLog =
           "Delete container issued on containerID 2 which is " +
               "in a failed volume";
-      Assert.assertTrue(kvHandlerLogs.getOutput().contains(expectedLog));
+      Assertions.assertTrue(kvHandlerLogs.getOutput().contains(expectedLog));
     } finally {
       FileUtils.deleteDirectory(new File(testDir));
     }
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestTarContainerPacker.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestTarContainerPacker.java
index 7e2e964858..c47191d2bd 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestTarContainerPacker.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestTarContainerPacker.java
@@ -46,23 +46,22 @@ import org.apache.commons.io.IOUtils;
 import org.apache.hadoop.ozone.container.replication.CopyContainerCompression;
 import org.apache.ozone.test.SpyInputStream;
 import org.apache.ozone.test.SpyOutputStream;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static java.nio.file.Files.newInputStream;
 import static java.nio.file.Files.newOutputStream;
 import static org.apache.hadoop.ozone.container.keyvalue.TarContainerPacker.CONTAINER_FILE_NAME;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 /**
  * Test the tar/untar for a given container.
  */
-@RunWith(Parameterized.class)
 public class TestTarContainerPacker {
 
   private static final String TEST_DB_FILE_NAME = "test1";
@@ -88,41 +87,39 @@ public class TestTarContainerPacker {
 
   private static final AtomicInteger CONTAINER_ID = new AtomicInteger(1);
 
-  private final ContainerLayoutVersion layout;
-  private final String schemaVersion;
+  private ContainerLayoutVersion layout;
+  private String schemaVersion;
   private OzoneConfiguration conf;
 
-  public TestTarContainerPacker(ContainerTestVersionInfo versionInfo,
+  private void initTests(ContainerTestVersionInfo versionInfo,
       CopyContainerCompression compression) {
     this.layout = versionInfo.getLayout();
     this.schemaVersion = versionInfo.getSchemaVersion();
     this.conf = new OzoneConfiguration();
     ContainerTestVersionInfo.setTestSchemaVersion(schemaVersion, conf);
     packer = new TarContainerPacker(compression);
-
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  public static List<Arguments> getLayoutAndCompression() {
     List<ContainerTestVersionInfo> layoutList =
         ContainerTestVersionInfo.getLayoutList();
-    List<Object[]> parameterList = new ArrayList<>();
+    List<Arguments> parameterList = new ArrayList<>();
     for (ContainerTestVersionInfo containerTestVersionInfo : layoutList) {
       for (CopyContainerCompression compr : CopyContainerCompression.values()) {
-        parameterList.add(new Object[]{containerTestVersionInfo, compr});
+        parameterList.add(Arguments.of(containerTestVersionInfo, compr));
       }
     }
     return parameterList;
   }
 
-  @BeforeClass
+  @BeforeAll
   public static void init() throws IOException {
     initDir(SOURCE_CONTAINER_ROOT);
     initDir(DEST_CONTAINER_ROOT);
     initDir(TEMP_DIR);
   }
 
-  @AfterClass
+  @AfterAll
   public static void cleanup() throws IOException {
     FileUtils.deleteDirectory(SOURCE_CONTAINER_ROOT.toFile());
     FileUtils.deleteDirectory(DEST_CONTAINER_ROOT.toFile());
@@ -165,8 +162,11 @@ public class TestTarContainerPacker {
     return containerData;
   }
 
-  @Test
-  public void pack() throws IOException {
+  @ParameterizedTest
+  @MethodSource("getLayoutAndCompression")
+  public void pack(ContainerTestVersionInfo versionInfo,
+      CopyContainerCompression compression) throws IOException {
+    initTests(versionInfo, compression);
     //GIVEN
     KeyValueContainerData sourceContainerData =
         createContainer(SOURCE_CONTAINER_ROOT);
@@ -201,13 +201,13 @@ public class TestTarContainerPacker {
       Map<String, TarArchiveEntry> entries = new HashMap<>();
       while ((entry = tarStream.getNextTarEntry()) != null) {
         if (first) {
-          Assert.assertEquals(CONTAINER_FILE_NAME, entry.getName());
+          Assertions.assertEquals(CONTAINER_FILE_NAME, entry.getName());
           first = false;
         }
         entries.put(entry.getName(), entry);
       }
 
-      Assert.assertTrue(entries.containsKey(CONTAINER_FILE_NAME));
+      Assertions.assertTrue(entries.containsKey(CONTAINER_FILE_NAME));
     } finally {
       if (tarStream != null) {
         tarStream.close();
@@ -221,7 +221,7 @@ public class TestTarContainerPacker {
     String containerYaml = new String(
         packer.unpackContainerDescriptor(inputForUnpackDescriptor),
         UTF_8);
-    Assert.assertEquals(TEST_DESCRIPTOR_FILE_CONTENT, containerYaml);
+    Assertions.assertEquals(TEST_DESCRIPTOR_FILE_CONTENT, containerYaml);
     inputForUnpackDescriptor.assertClosedExactlyOnce();
 
     KeyValueContainerData destinationContainerData =
@@ -245,17 +245,20 @@ public class TestTarContainerPacker {
     assertExampleChunkFileIsGood(
         Paths.get(destinationContainerData.getChunksPath()),
         TEST_CHUNK_FILE_NAME);
-    Assert.assertFalse(
+    Assertions.assertFalse(destinationContainer.getContainerFile().exists(),
         "Descriptor file should not have been extracted by the "
-            + "unpackContainerData Call",
-        destinationContainer.getContainerFile().exists());
-    Assert.assertEquals(TEST_DESCRIPTOR_FILE_CONTENT, descriptor);
+            + "unpackContainerData Call");
+    Assertions.assertEquals(TEST_DESCRIPTOR_FILE_CONTENT, descriptor);
     inputForUnpackData.assertClosedExactlyOnce();
   }
 
-  @Test
-  public void unpackContainerDataWithValidRelativeDbFilePath()
+  @ParameterizedTest
+  @MethodSource("getLayoutAndCompression")
+  public void unpackContainerDataWithValidRelativeDbFilePath(
+      ContainerTestVersionInfo versionInfo,
+      CopyContainerCompression compression)
       throws Exception {
+    initTests(versionInfo, compression);
     //GIVEN
     KeyValueContainerData sourceContainerData =
         createContainer(SOURCE_CONTAINER_ROOT);
@@ -274,9 +277,13 @@ public class TestTarContainerPacker {
         TarContainerPacker.getDbPath(dest), fileName);
   }
 
-  @Test
-  public void unpackContainerDataWithValidRelativeChunkFilePath()
+  @ParameterizedTest
+  @MethodSource("getLayoutAndCompression")
+  public void unpackContainerDataWithValidRelativeChunkFilePath(
+      ContainerTestVersionInfo versionInfo,
+      CopyContainerCompression compression)
       throws Exception {
+    initTests(versionInfo, compression);
     //GIVEN
     KeyValueContainerData sourceContainerData =
         createContainer(SOURCE_CONTAINER_ROOT);
@@ -294,9 +301,13 @@ public class TestTarContainerPacker {
     assertExampleChunkFileIsGood(Paths.get(dest.getChunksPath()), fileName);
   }
 
-  @Test
-  public void unpackContainerDataWithInvalidRelativeDbFilePath()
+  @ParameterizedTest
+  @MethodSource("getLayoutAndCompression")
+  public void unpackContainerDataWithInvalidRelativeDbFilePath(
+      ContainerTestVersionInfo versionInfo,
+      CopyContainerCompression compression)
       throws Exception {
+    initTests(versionInfo, compression);
     //GIVEN
     KeyValueContainerData sourceContainerData =
         createContainer(SOURCE_CONTAINER_ROOT);
@@ -311,9 +322,13 @@ public class TestTarContainerPacker {
         () -> unpackContainerData(containerFile));
   }
 
-  @Test
-  public void unpackContainerDataWithInvalidRelativeChunkFilePath()
+  @ParameterizedTest
+  @MethodSource("getLayoutAndCompression")
+  public void unpackContainerDataWithInvalidRelativeChunkFilePath(
+      ContainerTestVersionInfo versionInfo,
+      CopyContainerCompression compression)
       throws Exception {
+    initTests(versionInfo, compression);
     //GIVEN
     KeyValueContainerData sourceContainerData =
         createContainer(SOURCE_CONTAINER_ROOT);
@@ -403,16 +418,15 @@ public class TestTarContainerPacker {
 
     Path exampleFile = parentPath.resolve(filename);
 
-    Assert.assertTrue(
-        "example file is missing after pack/unpackContainerData: "
-            + exampleFile,
-        Files.exists(exampleFile));
+    Assertions.assertTrue(Files.exists(exampleFile),
+        "example file is missing after pack/unpackContainerData: " +
+            exampleFile);
 
     try (FileInputStream testFile =
              new FileInputStream(exampleFile.toFile())) {
       List<String> strings = IOUtils.readLines(testFile, UTF_8);
-      Assert.assertEquals(1, strings.size());
-      Assert.assertEquals(content, strings.get(0));
+      Assertions.assertEquals(1, strings.size());
+      Assertions.assertEquals(content, strings.get(0));
     }
   }
 
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/impl/TestBlockManagerImpl.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/impl/TestBlockManagerImpl.java
index 377c7804bb..9b64e4554a 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/impl/TestBlockManagerImpl.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/impl/TestBlockManagerImpl.java
@@ -35,22 +35,20 @@ import org.apache.hadoop.ozone.container.keyvalue.ContainerTestVersionInfo;
 import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainer;
 import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
 import org.apache.hadoop.ozone.container.keyvalue.helpers.BlockUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.mockito.Mockito;
 
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.ArgumentMatchers.anyList;
 import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.Mockito.mock;
@@ -58,11 +56,10 @@ import static org.mockito.Mockito.mock;
 /**
  * This class is used to test key related operations on the container.
  */
-@RunWith(Parameterized.class)
 public class TestBlockManagerImpl {
 
-  @Rule
-  public TemporaryFolder folder = new TemporaryFolder();
+  @TempDir
+  private Path folder;
   private OzoneConfiguration config;
   private String scmId = UUID.randomUUID().toString();
   private VolumeSet volumeSet;
@@ -75,27 +72,28 @@ public class TestBlockManagerImpl {
   private BlockID blockID;
   private BlockID blockID1;
 
-  private final ContainerLayoutVersion layout;
-  private final String schemaVersion;
+  private ContainerLayoutVersion layout;
+  private String schemaVersion;
 
-  public TestBlockManagerImpl(ContainerTestVersionInfo versionInfo) {
+  private void initTest(ContainerTestVersionInfo versionInfo)
+      throws Exception {
     this.layout = versionInfo.getLayout();
     this.schemaVersion = versionInfo.getSchemaVersion();
     this.config = new OzoneConfiguration();
     ContainerTestVersionInfo.setTestSchemaVersion(schemaVersion, config);
+    initilaze();
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> getVersionParameters() {
     return ContainerTestVersionInfo.versionParameters();
   }
 
-  @Before
-  public void setUp() throws Exception {
+  private void initilaze() throws Exception {
     UUID datanodeId = UUID.randomUUID();
-    HddsVolume hddsVolume = new HddsVolume.Builder(folder.getRoot()
-        .getAbsolutePath()).conf(config).datanodeUuid(datanodeId
-        .toString()).build();
+    HddsVolume hddsVolume = new HddsVolume.Builder(folder.toString())
+        .conf(config)
+        .datanodeUuid(datanodeId.toString())
+        .build();
     StorageVolumeUtil.checkVolume(hddsVolume, scmId, scmId, config,
         null, null);
 
@@ -145,13 +143,16 @@ public class TestBlockManagerImpl {
 
   }
 
-  @After
+  @AfterEach
   public void cleanup() {
     BlockUtils.shutdownCache(config);
   }
 
-  @Test
-  public void testPutBlock() throws Exception {
+  @ParameterizedTest
+  @MethodSource("getVersionParameters")
+  public void testPutBlock(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    initTest(versionInfo);
     assertEquals(0, keyValueContainer.getContainerData().getBlockCount());
     //Put Block with bcsId != 0
     blockManager.putBlock(keyValueContainer, blockData1);
@@ -178,8 +179,11 @@ public class TestBlockManagerImpl {
 
   }
 
-  @Test
-  public void testPutAndGetBlock() throws Exception {
+  @ParameterizedTest
+  @MethodSource("getVersionParameters")
+  public void testPutAndGetBlock(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    initTest(versionInfo);
     assertEquals(0, keyValueContainer.getContainerData().getBlockCount());
     //Put Block
     blockManager.putBlock(keyValueContainer, blockData);
@@ -198,8 +202,11 @@ public class TestBlockManagerImpl {
 
   }
 
-  @Test
-  public void testListBlock() throws Exception {
+  @ParameterizedTest
+  @MethodSource("getVersionParameters")
+  public void testListBlock(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    initTest(versionInfo);
     blockManager.putBlock(keyValueContainer, blockData);
     List<BlockData> listBlockData = blockManager.listBlock(
         keyValueContainer, 1, 10);
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestContainerReader.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestContainerReader.java
index b22f3a6851..c1f4e4504b 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestContainerReader.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestContainerReader.java
@@ -43,18 +43,16 @@ import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainer;
 import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
 import org.apache.hadoop.ozone.container.keyvalue.helpers.BlockUtils;
 import org.apache.hadoop.ozone.container.metadata.DatanodeStoreSchemaThreeImpl;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
-import org.junit.rules.TemporaryFolder;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.mockito.Mockito;
 
 import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
@@ -70,12 +68,8 @@ import static org.mockito.Mockito.mock;
 /**
  * Test ContainerReader class which loads containers from disks.
  */
-@RunWith(Parameterized.class)
 public class TestContainerReader {
 
-  @Rule
-  public final TemporaryFolder tempDir = new TemporaryFolder();
-
   private MutableVolumeSet volumeSet;
   private HddsVolume hddsVolume;
   private ContainerSet containerSet;
@@ -88,26 +82,17 @@ public class TestContainerReader {
   private int blockCount = 10;
   private long blockLen = 1024;
 
-  private final ContainerLayoutVersion layout;
+  private ContainerLayoutVersion layout;
   private String schemaVersion;
 
-  public TestContainerReader(ContainerTestVersionInfo versionInfo) {
-    this.layout = versionInfo.getLayout();
-    this.schemaVersion = versionInfo.getSchemaVersion();
-    this.conf = new OzoneConfiguration();
-    ContainerTestVersionInfo.setTestSchemaVersion(schemaVersion, conf);
-  }
-
-
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
-    return ContainerTestVersionInfo.versionParameters();
-  }
-
-  @Before
-  public void setup() throws Exception {
+  @TempDir
+  private Path tempDir;
 
-    File volumeDir = tempDir.newFolder();
+  private void setup(ContainerTestVersionInfo versionInfo) throws Exception {
+    setLayoutAndSchemaVersion(versionInfo);
+    File volumeDir =
+        Files.createDirectory(tempDir.resolve("volumeDir")).toFile();
+    this.conf = new OzoneConfiguration();
     volumeSet = Mockito.mock(MutableVolumeSet.class);
     containerSet = new ContainerSet(1000);
 
@@ -124,10 +109,9 @@ public class TestContainerReader {
         .thenReturn(hddsVolume);
 
     for (int i = 0; i < 2; i++) {
-      KeyValueContainerData keyValueContainerData = new KeyValueContainerData(i,
-          layout,
-          (long) StorageUnit.GB.toBytes(5), UUID.randomUUID().toString(),
-          datanodeId.toString());
+      KeyValueContainerData keyValueContainerData =
+          new KeyValueContainerData(i, layout, (long) StorageUnit.GB.toBytes(5),
+              UUID.randomUUID().toString(), datanodeId.toString());
 
       KeyValueContainer keyValueContainer =
           new KeyValueContainer(keyValueContainerData,
@@ -137,7 +121,7 @@ public class TestContainerReader {
 
       List<Long> blkNames;
       if (i % 2 == 0) {
-        blkNames = addBlocks(keyValueContainer,  true);
+        blkNames = addBlocks(keyValueContainer, true);
         markBlocksForDelete(keyValueContainer, true, blkNames, i);
       } else {
         blkNames = addBlocks(keyValueContainer, false);
@@ -150,7 +134,7 @@ public class TestContainerReader {
     ContainerCache.getInstance(conf).shutdownCache();
   }
 
-  @After
+  @AfterEach
   public void cleanup() {
     BlockUtils.shutdownCache(conf);
   }
@@ -211,17 +195,21 @@ public class TestContainerReader {
 
       if (setMetaData) {
         metadataStore.getStore().getMetadataTable()
-                .put(cData.getBlockCountKey(), (long)blockCount);
+            .put(cData.getBlockCountKey(), (long) blockCount);
         metadataStore.getStore().getMetadataTable()
-                .put(cData.getBytesUsedKey(), blockCount * blockLen);
+            .put(cData.getBytesUsedKey(), blockCount * blockLen);
       }
     }
 
     return blkNames;
   }
 
-  @Test
-  public void testContainerReader() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testContainerReader(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    setLayoutAndSchemaVersion(versionInfo);
+    setup(versionInfo);
     KeyValueContainerData recoveringContainerData = new KeyValueContainerData(
         10, layout, (long) StorageUnit.GB.toBytes(5),
         UUID.randomUUID().toString(), datanodeId.toString());
@@ -242,9 +230,9 @@ public class TestContainerReader {
     thread.join();
 
     //recovering container should be marked unhealthy, so the count should be 3
-    Assert.assertEquals(UNHEALTHY, containerSet.getContainer(
+    Assertions.assertEquals(UNHEALTHY, containerSet.getContainer(
         recoveringContainerData.getContainerID()).getContainerState());
-    Assert.assertEquals(3, containerSet.containerCount());
+    Assertions.assertEquals(3, containerSet.containerCount());
 
     for (int i = 0; i < 2; i++) {
       Container keyValueContainer = containerSet.getContainer(i);
@@ -253,23 +241,28 @@ public class TestContainerReader {
           keyValueContainer.getContainerData();
 
       // Verify block related metadata.
-      Assert.assertEquals(blockCount,
+      Assertions.assertEquals(blockCount,
           keyValueContainerData.getBlockCount());
 
-      Assert.assertEquals(blockCount * blockLen,
+      Assertions.assertEquals(blockCount * blockLen,
           keyValueContainerData.getBytesUsed());
 
-      Assert.assertEquals(i,
+      Assertions.assertEquals(i,
           keyValueContainerData.getNumPendingDeletionBlocks());
     }
   }
 
-  @Test
-  public void testContainerReaderWithLoadException() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testContainerReaderWithLoadException(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    setLayoutAndSchemaVersion(versionInfo);
+    setup(versionInfo);
     MutableVolumeSet volumeSet1;
     HddsVolume hddsVolume1;
     ContainerSet containerSet1 = new ContainerSet(1000);
-    File volumeDir1 = tempDir.newFolder();
+    File volumeDir1 =
+        Files.createDirectory(tempDir.resolve("volumeDir" + 1)).toFile();
     RoundRobinVolumeChoosingPolicy volumeChoosingPolicy1;
 
     volumeSet1 = Mockito.mock(MutableVolumeSet.class);
@@ -299,7 +292,7 @@ public class TestContainerReader {
             keyValueContainer.getContainerData().getContainerPath();
         File containerPath = new File(containerPathStr);
         String renamePath = containerPathStr + "-aa";
-        Assert.assertTrue(containerPath.renameTo(new File(renamePath)));
+        Assertions.assertTrue(containerPath.renameTo(new File(renamePath)));
       }
     }
     ContainerCache.getInstance(conf).shutdownCache();
@@ -307,16 +300,21 @@ public class TestContainerReader {
     ContainerReader containerReader = new ContainerReader(volumeSet1,
         hddsVolume1, containerSet1, conf, true);
     containerReader.readVolume(hddsVolume1.getHddsRootDir());
-    Assert.assertEquals(containerCount - 1, containerSet1.containerCount());
+    Assertions.assertEquals(containerCount - 1, containerSet1.containerCount());
   }
 
-  @Test
-  public void testMultipleContainerReader() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testMultipleContainerReader(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    setLayoutAndSchemaVersion(versionInfo);
+    setup(versionInfo);
     final int volumeNum = 10;
     StringBuffer datanodeDirs = new StringBuffer();
     File[] volumeDirs = new File[volumeNum];
     for (int i = 0; i < volumeNum; i++) {
-      volumeDirs[i] = tempDir.newFolder();
+      volumeDirs[i] =
+          Files.createDirectory(tempDir.resolve("volumeDir" + i)).toFile();
       datanodeDirs = datanodeDirs.append(volumeDirs[i]).append(",");
     }
 
@@ -379,15 +377,19 @@ public class TestContainerReader {
     }
     System.out.println("Open " + volumeNum + " Volume with " + containerCount +
         " costs " + (System.currentTimeMillis() - startTime) / 1000 + "s");
-    Assert.assertEquals(containerCount,
+    Assertions.assertEquals(containerCount,
         containerSet.getContainerMap().entrySet().size());
     // There should be no open containers cached by the ContainerReader as it
     // opens and closed them avoiding the cache.
-    Assert.assertEquals(0, cache.size());
+    Assertions.assertEquals(0, cache.size());
   }
 
-  @Test
-  public void testMarkedDeletedContainerCleared() throws Exception {
+  @ParameterizedTest
+  @MethodSource("versionInfo")
+  public void testMarkedDeletedContainerCleared(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    setLayoutAndSchemaVersion(versionInfo);
+    setup(versionInfo);
     KeyValueContainerData containerData = new KeyValueContainerData(
         101, layout, (long) StorageUnit.GB.toBytes(5),
         UUID.randomUUID().toString(), datanodeId.toString());
@@ -445,4 +447,16 @@ public class TestContainerReader {
       return baseSize;
     }
   }
+
+  private void setLayoutAndSchemaVersion(
+      ContainerTestVersionInfo versionInfo) {
+    layout = versionInfo.getLayout();
+    schemaVersion = versionInfo.getSchemaVersion();
+    conf = new OzoneConfiguration();
+    ContainerTestVersionInfo.setTestSchemaVersion(schemaVersion, conf);
+  }
+
+  private static Iterable<Object[]> versionInfo() {
+    return ContainerTestVersionInfo.versionParameters();
+  }
 }
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestOzoneContainer.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestOzoneContainer.java
index 1384530ff7..e92843f0b4 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestOzoneContainer.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/ozoneimpl/TestOzoneContainer.java
@@ -45,18 +45,15 @@ import org.apache.hadoop.ozone.container.keyvalue.ContainerTestVersionInfo;
 import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainer;
 import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
 import org.apache.hadoop.ozone.container.keyvalue.helpers.BlockUtils;
-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.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.Random;
 import java.util.UUID;
 import java.util.HashMap;
@@ -65,20 +62,16 @@ import java.util.ArrayList;
 
 import static org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.Result.DISK_OUT_OF_SPACE;
 import static org.apache.hadoop.ozone.container.common.ContainerTestUtils.createDbInstancesForTestIfNeeded;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 /**
  * This class is used to test OzoneContainer.
  */
-@RunWith(Parameterized.class)
 public class TestOzoneContainer {
 
-  private static final Logger LOG =
-      LoggerFactory.getLogger(TestOzoneContainer.class);
-
-  @Rule
-  public TemporaryFolder folder = new TemporaryFolder();
+  @TempDir
+  private Path folder;
 
   private OzoneConfiguration conf;
   private String clusterId = UUID.randomUUID().toString();
@@ -88,37 +81,34 @@ public class TestOzoneContainer {
   private KeyValueContainer keyValueContainer;
   private final DatanodeDetails datanodeDetails = createDatanodeDetails();
   private HashMap<String, Long> commitSpaceMap; //RootDir -> committed space
-  private final int numTestContainers = 10;
 
-  private final ContainerLayoutVersion layout;
-  private final String schemaVersion;
+  private ContainerLayoutVersion layout;
+  private String schemaVersion;
 
-  public TestOzoneContainer(ContainerTestVersionInfo versionInfo) {
+  private void initTest(ContainerTestVersionInfo versionInfo) throws Exception {
     this.layout = versionInfo.getLayout();
     this.schemaVersion = versionInfo.getSchemaVersion();
     this.conf = new OzoneConfiguration();
     ContainerTestVersionInfo.setTestSchemaVersion(schemaVersion, conf);
+    setup();
   }
 
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> getVersionInfo() {
     return ContainerTestVersionInfo.versionParameters();
   }
 
-  @Before
-  public void setUp() throws Exception {
-    conf.set(ScmConfigKeys.HDDS_DATANODE_DIR_KEY, folder.getRoot()
-        .getAbsolutePath());
+  private void setup() throws Exception {
+    conf.set(ScmConfigKeys.HDDS_DATANODE_DIR_KEY, folder.toString());
     conf.set(HddsConfigKeys.OZONE_METADATA_DIRS,
-        folder.newFolder().getAbsolutePath());
-    commitSpaceMap = new HashMap<String, Long>();
+        Files.createDirectory(folder.resolve("MetadataDir")).toString());
+    commitSpaceMap = new HashMap<>();
     volumeSet = new MutableVolumeSet(datanodeDetails.getUuidString(),
         clusterId, conf, null, StorageVolume.VolumeType.DATA_VOLUME, null);
     createDbInstancesForTestIfNeeded(volumeSet, clusterId, clusterId, conf);
     volumeChoosingPolicy = new RoundRobinVolumeChoosingPolicy();
   }
 
-  @After
+  @AfterEach
   public void cleanUp() {
     BlockUtils.shutdownCache(conf);
 
@@ -128,9 +118,11 @@ public class TestOzoneContainer {
     }
   }
 
-  @Test
-  public void testBuildContainerMap() throws Exception {
-
+  @ParameterizedTest
+  @MethodSource("getVersionInfo")
+  public void testBuildContainerMap(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    initTest(versionInfo);
     // Format the volumes
     List<HddsVolume> volumes =
         StorageVolumeUtil.getHddsVolumesList(volumeSet.getVolumesList());
@@ -140,6 +132,7 @@ public class TestOzoneContainer {
     }
 
     // Add containers to disk
+    int numTestContainers = 10;
     for (int i = 0; i < numTestContainers; i++) {
       long freeBytes = 0;
       long volCommitBytes;
@@ -174,18 +167,21 @@ public class TestOzoneContainer {
     verifyCommittedSpace(ozoneContainer);
   }
 
-  @Test
-  public void testBuildNodeReport() throws Exception {
-    String path = folder.getRoot()
-            .getAbsolutePath();
+  @ParameterizedTest
+  @MethodSource("getVersionInfo")
+  public void testBuildNodeReport(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    initTest(versionInfo);
+    String path = folder.toString();
     conf.set(OzoneConfigKeys.DFS_CONTAINER_RATIS_DATANODE_STORAGE_DIR,
-            String.join(",",
+        String.join(",",
             path + "/ratis1", path + "/ratis2", path + "ratis3"));
 
     File[] dbPaths = new File[3];
     StringBuilder dbDirString = new StringBuilder();
     for (int i = 0; i < 3; i++) {
-      dbPaths[i] = folder.newFolder();
+      dbPaths[i] =
+          Files.createDirectory(folder.resolve(Integer.toString(i))).toFile();
       dbDirString.append(dbPaths[i]).append(",");
     }
     conf.set(OzoneConfigKeys.HDDS_DATANODE_CONTAINER_DB_DIR,
@@ -193,29 +189,35 @@ public class TestOzoneContainer {
     ContainerTestUtils.enableSchemaV3(conf);
     OzoneContainer ozoneContainer = ContainerTestUtils
         .getOzoneContainer(datanodeDetails, conf);
-    Assert.assertEquals(volumeSet.getVolumesList().size(),
-            ozoneContainer.getNodeReport().getStorageReportList().size());
-    Assert.assertEquals(3,
-            ozoneContainer.getNodeReport().getMetadataStorageReportList()
-                    .size());
-    Assert.assertEquals(3,
-            ozoneContainer.getNodeReport().getDbStorageReportList().size());
+    Assertions.assertEquals(volumeSet.getVolumesList().size(),
+        ozoneContainer.getNodeReport().getStorageReportList().size());
+    Assertions.assertEquals(3,
+        ozoneContainer.getNodeReport().getMetadataStorageReportList()
+            .size());
+    Assertions.assertEquals(3,
+        ozoneContainer.getNodeReport().getDbStorageReportList().size());
   }
 
-  @Test
-  public void testBuildNodeReportWithDefaultRatisLogDir() throws Exception {
+  @ParameterizedTest
+  @MethodSource("getVersionInfo")
+  public void testBuildNodeReportWithDefaultRatisLogDir(
+      ContainerTestVersionInfo versionInfo) throws Exception {
+    initTest(versionInfo);
     OzoneContainer ozoneContainer = ContainerTestUtils
         .getOzoneContainer(datanodeDetails, conf);
-    Assert.assertEquals(volumeSet.getVolumesList().size(),
-            ozoneContainer.getNodeReport().getStorageReportList().size());
-    Assert.assertEquals(1,
-            ozoneContainer.getNodeReport().getMetadataStorageReportList()
-                    .size());
+    Assertions.assertEquals(volumeSet.getVolumesList().size(),
+        ozoneContainer.getNodeReport().getStorageReportList().size());
+    Assertions.assertEquals(1,
+        ozoneContainer.getNodeReport().getMetadataStorageReportList()
+            .size());
   }
 
 
-  @Test
-  public void testContainerCreateDiskFull() throws Exception {
+  @ParameterizedTest
+  @MethodSource("getVersionInfo")
+  public void testContainerCreateDiskFull(ContainerTestVersionInfo versionInfo)
+      throws Exception {
+    initTest(versionInfo);
     long containerSize = (long) StorageUnit.MB.toBytes(100);
 
     List<HddsVolume> volumes =
@@ -250,8 +252,8 @@ public class TestOzoneContainer {
       String key = getVolumeKey(dnVol);
       long expectedCommit = commitSpaceMap.get(key).longValue();
       long volumeCommitted = dnVol.getCommittedBytes();
-      assertEquals("Volume committed space not initialized correctly",
-          expectedCommit, volumeCommitted);
+      assertEquals(expectedCommit, volumeCommitted,
+          "Volume committed space not initialized correctly");
     }
   }
 
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestReplicationSupervisor.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestReplicationSupervisor.java
index 35f7c4c390..1a17e4cea7 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestReplicationSupervisor.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestReplicationSupervisor.java
@@ -63,12 +63,11 @@ import org.apache.hadoop.ozone.protocol.commands.ReconstructECContainersCommand;
 import org.apache.hadoop.ozone.protocol.commands.ReplicateContainerCommand;
 import org.apache.ozone.test.GenericTestUtils;
 import org.apache.ozone.test.TestClock;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 import org.mockito.Mockito;
 
 import javax.annotation.Nonnull;
@@ -88,7 +87,6 @@ import static org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProt
 /**
  * Test the replication supervisor.
  */
-@RunWith(Parameterized.class)
 public class TestReplicationSupervisor {
 
   private static final long CURRENT_TERM = 1;
@@ -108,22 +106,17 @@ public class TestReplicationSupervisor {
 
   private ContainerSet set;
 
-  private final ContainerLayoutVersion layout;
+  private ContainerLayoutVersion layoutVersion;
 
   private StateContext context;
   private TestClock clock;
   private DatanodeDetails datanode;
 
-  public TestReplicationSupervisor(ContainerLayoutVersion layout) {
-    this.layout = layout;
-  }
-
-  @Parameterized.Parameters
-  public static Iterable<Object[]> parameters() {
+  private static Iterable<Object[]> layoutVersion() {
     return ContainerLayoutTestInfo.containerLayoutParameters();
   }
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     clock = new TestClock(Instant.now(), ZoneId.systemDefault());
     set = new ContainerSet(1000);
@@ -138,13 +131,15 @@ public class TestReplicationSupervisor {
     Mockito.when(stateMachine.getDatanodeDetails()).thenReturn(datanode);
   }
 
-  @After
+  @AfterEach
   public void cleanup() {
     replicatorRef.set(null);
   }
 
-  @Test
-  public void normal() {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void normal(ContainerLayoutVersion layout) {
+    this.layoutVersion = layout;
     // GIVEN
     ReplicationSupervisor supervisor =
         supervisorWithReplicator(FakeReplicator::new);
@@ -157,24 +152,26 @@ public class TestReplicationSupervisor {
       supervisor.addTask(createTask(2L));
       supervisor.addTask(createTask(5L));
 
-      Assert.assertEquals(3, supervisor.getReplicationRequestCount());
-      Assert.assertEquals(3, supervisor.getReplicationSuccessCount());
-      Assert.assertEquals(0, supervisor.getReplicationFailureCount());
-      Assert.assertEquals(0, supervisor.getTotalInFlightReplications());
-      Assert.assertEquals(0, supervisor.getQueueSize());
-      Assert.assertEquals(3, set.containerCount());
+      Assertions.assertEquals(3, supervisor.getReplicationRequestCount());
+      Assertions.assertEquals(3, supervisor.getReplicationSuccessCount());
+      Assertions.assertEquals(0, supervisor.getReplicationFailureCount());
+      Assertions.assertEquals(0, supervisor.getTotalInFlightReplications());
+      Assertions.assertEquals(0, supervisor.getQueueSize());
+      Assertions.assertEquals(3, set.containerCount());
 
       MetricsCollectorImpl metricsCollector = new MetricsCollectorImpl();
       metrics.getMetrics(metricsCollector, true);
-      Assert.assertEquals(1, metricsCollector.getRecords().size());
+      Assertions.assertEquals(1, metricsCollector.getRecords().size());
     } finally {
       metrics.unRegister();
       supervisor.stop();
     }
   }
 
-  @Test
-  public void duplicateMessage() {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void duplicateMessage(ContainerLayoutVersion layout) {
+    this.layoutVersion = layout;
     // GIVEN
     ReplicationSupervisor supervisor = supervisorWithReplicator(
         FakeReplicator::new);
@@ -187,20 +184,22 @@ public class TestReplicationSupervisor {
       supervisor.addTask(createTask(6L));
 
       //THEN
-      Assert.assertEquals(4, supervisor.getReplicationRequestCount());
-      Assert.assertEquals(1, supervisor.getReplicationSuccessCount());
-      Assert.assertEquals(0, supervisor.getReplicationFailureCount());
-      Assert.assertEquals(3, supervisor.getReplicationSkippedCount());
-      Assert.assertEquals(0, supervisor.getTotalInFlightReplications());
-      Assert.assertEquals(0, supervisor.getQueueSize());
-      Assert.assertEquals(1, set.containerCount());
+      Assertions.assertEquals(4, supervisor.getReplicationRequestCount());
+      Assertions.assertEquals(1, supervisor.getReplicationSuccessCount());
+      Assertions.assertEquals(0, supervisor.getReplicationFailureCount());
+      Assertions.assertEquals(3, supervisor.getReplicationSkippedCount());
+      Assertions.assertEquals(0, supervisor.getTotalInFlightReplications());
+      Assertions.assertEquals(0, supervisor.getQueueSize());
+      Assertions.assertEquals(1, set.containerCount());
     } finally {
       supervisor.stop();
     }
   }
 
-  @Test
-  public void failureHandling() {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void failureHandling(ContainerLayoutVersion layout) {
+    this.layoutVersion = layout;
     // GIVEN
     ReplicationSupervisor supervisor = supervisorWith(
         __ -> throwingReplicator, newDirectExecutorService());
@@ -211,19 +210,20 @@ public class TestReplicationSupervisor {
       supervisor.addTask(task);
 
       //THEN
-      Assert.assertEquals(1, supervisor.getReplicationRequestCount());
-      Assert.assertEquals(0, supervisor.getReplicationSuccessCount());
-      Assert.assertEquals(1, supervisor.getReplicationFailureCount());
-      Assert.assertEquals(0, supervisor.getTotalInFlightReplications());
-      Assert.assertEquals(0, supervisor.getQueueSize());
-      Assert.assertEquals(0, set.containerCount());
-      Assert.assertEquals(ReplicationTask.Status.FAILED, task.getStatus());
+      Assertions.assertEquals(1, supervisor.getReplicationRequestCount());
+      Assertions.assertEquals(0, supervisor.getReplicationSuccessCount());
+      Assertions.assertEquals(1, supervisor.getReplicationFailureCount());
+      Assertions.assertEquals(0, supervisor.getTotalInFlightReplications());
+      Assertions.assertEquals(0, supervisor.getQueueSize());
+      Assertions.assertEquals(0, set.containerCount());
+      Assertions.assertEquals(ReplicationTask.Status.FAILED, task.getStatus());
     } finally {
       supervisor.stop();
     }
   }
 
-  @Test
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
   public void stalledDownload() {
     // GIVEN
     ReplicationSupervisor supervisor = supervisorWith(__ -> noopReplicator,
@@ -238,22 +238,23 @@ public class TestReplicationSupervisor {
       supervisor.addTask(createECTask(5L));
 
       //THEN
-      Assert.assertEquals(0, supervisor.getReplicationRequestCount());
-      Assert.assertEquals(0, supervisor.getReplicationSuccessCount());
-      Assert.assertEquals(0, supervisor.getReplicationFailureCount());
-      Assert.assertEquals(5, supervisor.getTotalInFlightReplications());
-      Assert.assertEquals(3, supervisor.getInFlightReplications(
+      Assertions.assertEquals(0, supervisor.getReplicationRequestCount());
+      Assertions.assertEquals(0, supervisor.getReplicationSuccessCount());
+      Assertions.assertEquals(0, supervisor.getReplicationFailureCount());
+      Assertions.assertEquals(5, supervisor.getTotalInFlightReplications());
+      Assertions.assertEquals(3, supervisor.getInFlightReplications(
           ReplicationTask.class));
-      Assert.assertEquals(2, supervisor.getInFlightReplications(
+      Assertions.assertEquals(2, supervisor.getInFlightReplications(
           ECReconstructionCoordinatorTask.class));
-      Assert.assertEquals(0, supervisor.getQueueSize());
-      Assert.assertEquals(0, set.containerCount());
+      Assertions.assertEquals(0, supervisor.getQueueSize());
+      Assertions.assertEquals(0, set.containerCount());
     } finally {
       supervisor.stop();
     }
   }
 
-  @Test
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
   public void slowDownload() {
     // GIVEN
     ReplicationSupervisor supervisor = supervisorWith(__ -> slowReplicator,
@@ -267,21 +268,22 @@ public class TestReplicationSupervisor {
       supervisor.addTask(createTask(3L));
 
       //THEN
-      Assert.assertEquals(3, supervisor.getTotalInFlightReplications());
-      Assert.assertEquals(2, supervisor.getQueueSize());
+      Assertions.assertEquals(3, supervisor.getTotalInFlightReplications());
+      Assertions.assertEquals(2, supervisor.getQueueSize());
       // Sleep 4s, wait all tasks processed
       try {
         Thread.sleep(4000);
       } catch (InterruptedException e) {
       }
-      Assert.assertEquals(0, supervisor.getTotalInFlightReplications());
-      Assert.assertEquals(0, supervisor.getQueueSize());
+      Assertions.assertEquals(0, supervisor.getTotalInFlightReplications());
+      Assertions.assertEquals(0, supervisor.getQueueSize());
     } finally {
       supervisor.stop();
     }
   }
 
-  @Test
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
   public void testDownloadAndImportReplicatorFailure() throws IOException {
     OzoneConfiguration conf = new OzoneConfiguration();
 
@@ -320,14 +322,16 @@ public class TestReplicationSupervisor {
         .captureLogs(DownloadAndImportReplicator.LOG);
 
     supervisor.addTask(createTask(1L));
-    Assert.assertEquals(1, supervisor.getReplicationFailureCount());
-    Assert.assertEquals(0, supervisor.getReplicationSuccessCount());
-    Assert.assertTrue(logCapturer.getOutput()
+    Assertions.assertEquals(1, supervisor.getReplicationFailureCount());
+    Assertions.assertEquals(0, supervisor.getReplicationSuccessCount());
+    Assertions.assertTrue(logCapturer.getOutput()
         .contains("Container 1 replication was unsuccessful."));
   }
 
-  @Test
-  public void testTaskBeyondDeadline() {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testTaskBeyondDeadline(ContainerLayoutVersion layout) {
+    this.layoutVersion = layout;
     ReplicationSupervisor supervisor =
         supervisorWithReplicator(FakeReplicator::new);
 
@@ -348,18 +352,20 @@ public class TestReplicationSupervisor {
     supervisor.addTask(task2);
     supervisor.addTask(task3);
 
-    Assert.assertEquals(3, supervisor.getReplicationRequestCount());
-    Assert.assertEquals(2, supervisor.getReplicationSuccessCount());
-    Assert.assertEquals(0, supervisor.getReplicationFailureCount());
-    Assert.assertEquals(0, supervisor.getTotalInFlightReplications());
-    Assert.assertEquals(0, supervisor.getQueueSize());
-    Assert.assertEquals(1, supervisor.getReplicationTimeoutCount());
-    Assert.assertEquals(2, set.containerCount());
+    Assertions.assertEquals(3, supervisor.getReplicationRequestCount());
+    Assertions.assertEquals(2, supervisor.getReplicationSuccessCount());
+    Assertions.assertEquals(0, supervisor.getReplicationFailureCount());
+    Assertions.assertEquals(0, supervisor.getTotalInFlightReplications());
+    Assertions.assertEquals(0, supervisor.getQueueSize());
+    Assertions.assertEquals(1, supervisor.getReplicationTimeoutCount());
+    Assertions.assertEquals(2, set.containerCount());
 
   }
 
-  @Test
-  public void testDatanodeOutOfService() {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testDatanodeOutOfService(ContainerLayoutVersion layout) {
+    this.layoutVersion = layout;
     ReplicationSupervisor supervisor =
         supervisorWithReplicator(FakeReplicator::new);
     datanode.setPersistedOpState(
@@ -373,17 +379,19 @@ public class TestReplicationSupervisor {
     supervisor.addTask(new ReplicationTask(pushCmd, replicatorRef.get()));
     supervisor.addTask(new ReplicationTask(pullCmd, replicatorRef.get()));
 
-    Assert.assertEquals(2, supervisor.getReplicationRequestCount());
-    Assert.assertEquals(1, supervisor.getReplicationSuccessCount());
-    Assert.assertEquals(0, supervisor.getReplicationFailureCount());
-    Assert.assertEquals(0, supervisor.getTotalInFlightReplications());
-    Assert.assertEquals(0, supervisor.getQueueSize());
-    Assert.assertEquals(0, supervisor.getReplicationTimeoutCount());
-    Assert.assertEquals(1, set.containerCount());
+    Assertions.assertEquals(2, supervisor.getReplicationRequestCount());
+    Assertions.assertEquals(1, supervisor.getReplicationSuccessCount());
+    Assertions.assertEquals(0, supervisor.getReplicationFailureCount());
+    Assertions.assertEquals(0, supervisor.getTotalInFlightReplications());
+    Assertions.assertEquals(0, supervisor.getQueueSize());
+    Assertions.assertEquals(0, supervisor.getReplicationTimeoutCount());
+    Assertions.assertEquals(1, set.containerCount());
   }
 
-  @Test
-  public void taskWithObsoleteTermIsDropped() {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void taskWithObsoleteTermIsDropped(ContainerLayoutVersion layout) {
+    this.layoutVersion = layout;
     final long newTerm = 2;
     ReplicationSupervisor supervisor =
         supervisorWithReplicator(FakeReplicator::new);
@@ -391,12 +399,15 @@ public class TestReplicationSupervisor {
     context.setTermOfLeaderSCM(newTerm);
     supervisor.addTask(createTask(1L));
 
-    Assert.assertEquals(1, supervisor.getReplicationRequestCount());
-    Assert.assertEquals(0, supervisor.getReplicationSuccessCount());
+    Assertions.assertEquals(1, supervisor.getReplicationRequestCount());
+    Assertions.assertEquals(0, supervisor.getReplicationSuccessCount());
   }
 
-  @Test
-  public void testPriorityOrdering() throws InterruptedException {
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
+  public void testPriorityOrdering(ContainerLayoutVersion layout)
+      throws InterruptedException {
+    this.layoutVersion = layout;
     long deadline = clock.millis() + 1000;
     long containerId = 1;
     long term = 1;
@@ -447,19 +458,19 @@ public class TestReplicationSupervisor {
     // Before unblocking the queue, check the queue count for the OrderedTask.
     // We loaded 3 High / normal priority and 2 low. The counter should not
     // include the low counts.
-    Assert.assertEquals(3,
+    Assertions.assertEquals(3,
         supervisor.getInFlightReplications(OrderedTask.class));
-    Assert.assertEquals(1,
+    Assertions.assertEquals(1,
         supervisor.getInFlightReplications(BlockingTask.class));
 
     // Unblock the queue
     completeRunning.countDown();
     // Wait for all tasks to complete
     tasksCompleteLatch.await();
-    Assert.assertEquals(expectedOrder, completionOrder);
-    Assert.assertEquals(0,
+    Assertions.assertEquals(expectedOrder, completionOrder);
+    Assertions.assertEquals(0,
         supervisor.getInFlightReplications(OrderedTask.class));
-    Assert.assertEquals(0,
+    Assertions.assertEquals(0,
         supervisor.getInFlightReplications(BlockingTask.class));
   }
 
@@ -599,11 +610,11 @@ public class TestReplicationSupervisor {
       }
 
       // assumes same-thread execution
-      Assert.assertEquals(1, supervisor.getTotalInFlightReplications());
+      Assertions.assertEquals(1, supervisor.getTotalInFlightReplications());
 
       KeyValueContainerData kvcd =
           new KeyValueContainerData(task.getContainerId(),
-              layout, 100L,
+              layoutVersion, 100L,
               UUID.randomUUID().toString(), UUID.randomUUID().toString());
       KeyValueContainer kvc =
           new KeyValueContainer(kvcd, conf);
@@ -612,7 +623,7 @@ public class TestReplicationSupervisor {
         set.addContainer(kvc);
         task.setStatus(DONE);
       } catch (Exception e) {
-        Assert.fail("Unexpected error: " + e.getMessage());
+        Assertions.fail("Unexpected error: " + e.getMessage());
       }
     }
   }
@@ -654,7 +665,8 @@ public class TestReplicationSupervisor {
     }
   }
 
-  @Test
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
   public void poolSizeCanBeIncreased() {
     datanode.setPersistedOpState(IN_SERVICE);
     ReplicationSupervisor subject = ReplicationSupervisor.newBuilder()
@@ -668,7 +680,8 @@ public class TestReplicationSupervisor {
     }
   }
 
-  @Test
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
   public void poolSizeCanBeDecreased() {
     datanode.setPersistedOpState(IN_MAINTENANCE);
     ReplicationSupervisor subject = ReplicationSupervisor.newBuilder()
@@ -682,7 +695,8 @@ public class TestReplicationSupervisor {
     }
   }
 
-  @Test
+  @ParameterizedTest
+  @MethodSource("layoutVersion")
   public void testMaxQueueSize() {
     List<DatanodeDetails> datanodes = new ArrayList<>();
     datanodes.add(MockDatanodeDetails.randomDatanodeDetails());
@@ -710,21 +724,22 @@ public class TestReplicationSupervisor {
 
     // in progress task will be limited by max. queue size,
     // since all tasks are discarded by the executor, none of them complete
-    Assert.assertEquals(maxQueueSize, rs.getTotalInFlightReplications());
+    Assertions.assertEquals(maxQueueSize, rs.getTotalInFlightReplications());
 
     // queue size is doubled
     rs.nodeStateUpdated(HddsProtos.NodeOperationalState.DECOMMISSIONING);
-    Assert.assertEquals(2 * maxQueueSize, rs.getMaxQueueSize());
-    Assert.assertEquals(2 * replicationMaxStreams, threadPoolSize.get());
+    Assertions.assertEquals(2 * maxQueueSize, rs.getMaxQueueSize());
+    Assertions.assertEquals(2 * replicationMaxStreams, threadPoolSize.get());
 
     // can schedule more tasks
     scheduleTasks(datanodes, rs);
-    Assert.assertEquals(2 * maxQueueSize, rs.getTotalInFlightReplications());
+    Assertions.assertEquals(
+        2 * maxQueueSize, rs.getTotalInFlightReplications());
 
     // queue size is restored
     rs.nodeStateUpdated(IN_SERVICE);
-    Assert.assertEquals(maxQueueSize, rs.getMaxQueueSize());
-    Assert.assertEquals(replicationMaxStreams, threadPoolSize.get());
+    Assertions.assertEquals(maxQueueSize, rs.getMaxQueueSize());
+    Assertions.assertEquals(replicationMaxStreams, threadPoolSize.get());
   }
 
   //schedule 10 container replication
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/upgrade/TestDatanodeUpgradeToSchemaV3.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/upgrade/TestDatanodeUpgradeToSchemaV3.java
index 7669a577cf..0b823f788d 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/upgrade/TestDatanodeUpgradeToSchemaV3.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/upgrade/TestDatanodeUpgradeToSchemaV3.java
@@ -44,22 +44,20 @@ import org.apache.hadoop.ozone.container.common.volume.HddsVolume;
 import org.apache.hadoop.ozone.container.common.volume.StorageVolume;
 import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainer;
 import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
-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.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
 import org.mockito.Mockito;
 
 import java.io.File;
 import java.io.IOException;
 import java.net.InetSocketAddress;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -70,60 +68,46 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 
-import static org.mockito.ArgumentMatchers.anyObject;
+import static org.mockito.ArgumentMatchers.any;
 
 /**
  * Tests upgrading a single datanode from container Schema V2 to Schema V3.
  */
-@RunWith(Parameterized.class)
 public class TestDatanodeUpgradeToSchemaV3 {
-  @Rule
-  public TemporaryFolder tempFolder;
+  @TempDir
+  private Path tempFolder;
 
   private DatanodeStateMachine dsm;
-  private final OzoneConfiguration conf;
+  private OzoneConfiguration conf;
   private static final String CLUSTER_ID = "clusterID";
-  private final boolean schemaV3Enabled;
 
   private RPC.Server scmRpcServer;
   private InetSocketAddress address;
-  private ScmTestMock scmServerImpl;
 
   private Random random;
 
-  // hdds.datanode.container.schema.v3.enabled
-  @Parameterized.Parameters
-  public static Collection<Object[]> getSchemaFiles() {
-    Collection<Object[]> parameters = new ArrayList<>();
-    parameters.add(new Boolean[]{false});
-    parameters.add(new Boolean[]{true});
-    return parameters;
-  }
-
-  public TestDatanodeUpgradeToSchemaV3(Boolean enable) {
-    this.schemaV3Enabled = enable;
+  private void initTests(Boolean enable) throws Exception {
+    boolean schemaV3Enabled = enable;
     conf = new OzoneConfiguration();
     conf.setBoolean(DatanodeConfiguration.CONTAINER_SCHEMA_V3_ENABLED,
-        this.schemaV3Enabled);
-    conf.setBoolean(OzoneConfigKeys.DFS_CONTAINER_RATIS_DATASTREAM_ENABLED,
-        true);
+        schemaV3Enabled);
+    conf.setBoolean(
+        OzoneConfigKeys.DFS_CONTAINER_RATIS_DATASTREAM_ENABLED, true);
     conf.setBoolean(
         OzoneConfigKeys.DFS_CONTAINER_RATIS_DATASTREAM_RANDOM_PORT, true);
+    setup();
   }
 
-  @Before
-  public void setup() throws Exception {
-    tempFolder = new TemporaryFolder();
-    tempFolder.create();
+  private void setup() throws Exception {
     random = new Random();
 
     address = SCMTestUtils.getReuseableAddress();
     conf.setSocketAddr(ScmConfigKeys.OZONE_SCM_NAMES, address);
     conf.set(HddsConfigKeys.OZONE_METADATA_DIRS,
-        tempFolder.getRoot().getAbsolutePath());
+        tempFolder.toString());
   }
 
-  @After
+  @AfterEach
   public void teardown() throws Exception {
     if (scmRpcServer != null) {
       scmRpcServer.stop();
@@ -139,8 +123,10 @@ public class TestDatanodeUpgradeToSchemaV3 {
    * enabled or not.
    * If Schema V3 is enabled, RocksDB will be loaded.
    */
-  @Test
-  public void testDBOnHddsVolume() throws Exception {
+  @ParameterizedTest(name = "schema V3 enabled :{0}")
+  @ValueSource(booleans = {true, false})
+  public void testDBOnHddsVolume(boolean schemaV3Enabled) throws Exception {
+    initTests(schemaV3Enabled);
     // start DN and SCM
     startScmServer();
     addHddsVolume();
@@ -148,22 +134,22 @@ public class TestDatanodeUpgradeToSchemaV3 {
     startPreFinalizedDatanode();
     HddsVolume dataVolume = (HddsVolume) dsm.getContainer().getVolumeSet()
         .getVolumesList().get(0);
-    Assert.assertNull(dataVolume.getDbVolume());
-    Assert.assertFalse(dataVolume.isDbLoaded());
+    Assertions.assertNull(dataVolume.getDbVolume());
+    Assertions.assertFalse(dataVolume.isDbLoaded());
 
     dsm.finalizeUpgrade();
     // RocksDB is created during upgrade
     File dbFile = new File(dataVolume.getStorageDir().getAbsolutePath() + "/" +
         dataVolume.getClusterID() + "/" + dataVolume.getStorageID());
-    Assert.assertTrue(dbFile.exists());
+    Assertions.assertTrue(dbFile.exists());
 
     // RocksDB loaded when SchemaV3 is enabled
     if (VersionedDatanodeFeatures.SchemaV3.isFinalizedAndEnabled(conf)) {
-      Assert.assertTrue(dataVolume.getDbParentDir().getAbsolutePath()
+      Assertions.assertTrue(dataVolume.getDbParentDir().getAbsolutePath()
           .startsWith(dataVolume.getStorageDir().toString()));
     } else {
       // RocksDB is not loaded when SchemaV3 is disabled.
-      Assert.assertFalse(dataVolume.isDbLoaded());
+      Assertions.assertFalse(dataVolume.isDbLoaded());
     }
   }
 
@@ -172,8 +158,10 @@ public class TestDatanodeUpgradeToSchemaV3 {
    * Schema V3 is enabled or not.
    * If Schema V3 is enabled, RocksDB will be loaded.
    */
-  @Test
-  public void testDBOnDbVolume() throws Exception {
+  @ParameterizedTest(name = "schema V3 enabled :{0}")
+  @ValueSource(booleans = {false, true})
+  public void testDBOnDbVolume(boolean schemaV3Enabled) throws Exception {
+    initTests(schemaV3Enabled);
     // start DN and SCM
     startScmServer();
     addHddsVolume();
@@ -182,26 +170,26 @@ public class TestDatanodeUpgradeToSchemaV3 {
     startPreFinalizedDatanode();
     HddsVolume dataVolume = (HddsVolume) dsm.getContainer().getVolumeSet()
         .getVolumesList().get(0);
-    Assert.assertNull(dataVolume.getDbParentDir());
+    Assertions.assertNull(dataVolume.getDbParentDir());
 
     dsm.finalizeUpgrade();
     // RocksDB is created during upgrade
     DbVolume dbVolume = (DbVolume) dsm.getContainer().getDbVolumeSet()
         .getVolumesList().get(0);
-    Assert.assertEquals(dbVolume, dataVolume.getDbVolume());
-    Assert.assertTrue(
+    Assertions.assertEquals(dbVolume, dataVolume.getDbVolume());
+    Assertions.assertTrue(
         dbVolume.getHddsVolumeIDs().contains(dataVolume.getStorageID()));
     File dbFile = new File(dbVolume.getStorageDir().getAbsolutePath() + "/" +
         dbVolume.getClusterID() + "/" + dataVolume.getStorageID());
-    Assert.assertTrue(dbFile.exists());
+    Assertions.assertTrue(dbFile.exists());
 
     // RocksDB loaded when SchemaV3 is enabled
     if (VersionedDatanodeFeatures.SchemaV3.isFinalizedAndEnabled(conf)) {
-      Assert.assertTrue(dataVolume.getDbParentDir().getAbsolutePath()
+      Assertions.assertTrue(dataVolume.getDbParentDir().getAbsolutePath()
           .startsWith(dbVolume.getStorageDir().toString()));
     } else {
       // RocksDB is not loaded when SchemaV3 is disabled.
-      Assert.assertFalse(dataVolume.isDbLoaded());
+      Assertions.assertFalse(dataVolume.isDbLoaded());
     }
   }
 
@@ -209,8 +197,11 @@ public class TestDatanodeUpgradeToSchemaV3 {
    * Test RocksDB in created in Finalize action for an existing hddsVolume.
    * This mimics the real cluster upgrade situation.
    */
-  @Test
-  public void testDBCreatedInFinalize() throws Exception {
+  @ParameterizedTest(name = "schema V3 enabled :{0}")
+  @ValueSource(booleans = {false, true})
+  public void testDBCreatedInFinalize(boolean schemaV3Enabled)
+      throws Exception {
+    initTests(schemaV3Enabled);
     // start DN and SCM
     startScmServer();
     // add one HddsVolume
@@ -229,10 +220,10 @@ public class TestDatanodeUpgradeToSchemaV3 {
     dataVolume.format(CLUSTER_ID);
     File idDir = new File(dataVolume.getStorageDir(), CLUSTER_ID);
     if (!idDir.mkdir()) {
-      Assert.fail("Failed to create id directory");
+      Assertions.fail("Failed to create id directory");
     }
 
-    Assert.assertNull(dataVolume.getDbParentDir());
+    Assertions.assertNull(dataVolume.getDbParentDir());
 
     // Restart DN and finalize upgrade
     restartDatanode(
@@ -242,19 +233,21 @@ public class TestDatanodeUpgradeToSchemaV3 {
     // RocksDB is created by upgrade action
     dataVolume = ((HddsVolume) dsm.getContainer().getVolumeSet()
         .getVolumesList().get(0));
-    Assert.assertNotNull(dataVolume.getDbParentDir());
+    Assertions.assertNotNull(dataVolume.getDbParentDir());
     if (VersionedDatanodeFeatures.SchemaV3.isFinalizedAndEnabled(conf)) {
-      Assert.assertTrue(dataVolume.isDbLoaded());
+      Assertions.assertTrue(dataVolume.isDbLoaded());
     } else {
-      Assert.assertFalse(dataVolume.isDbLoaded());
+      Assertions.assertFalse(dataVolume.isDbLoaded());
     }
   }
 
   /**
    * Test finalize twice won't recreate any RocksDB for HddsVolume.
    */
-  @Test
-  public void testFinalizeTwice() throws Exception {
+  @ParameterizedTest(name = "schema V3 enabled :{0}")
+  @ValueSource(booleans = {false, true})
+  public void testFinalizeTwice(boolean schemaV3Enabled) throws Exception {
+    initTests(schemaV3Enabled);
     // start DN and SCM
     startScmServer();
     // add one HddsVolume and two DbVolume
@@ -267,19 +260,22 @@ public class TestDatanodeUpgradeToSchemaV3 {
 
     DbVolume dbVolume = ((HddsVolume) dsm.getContainer().getVolumeSet()
         .getVolumesList().get(0)).getDbVolume();
-    Assert.assertNotNull(dbVolume);
+    Assertions.assertNotNull(dbVolume);
 
     dsm.finalizeUpgrade();
     // DB Dir should be the same.
-    Assert.assertEquals(dbVolume, ((HddsVolume) dsm.getContainer()
+    Assertions.assertEquals(dbVolume, ((HddsVolume) dsm.getContainer()
         .getVolumeSet().getVolumesList().get(0)).getDbVolume());
   }
 
   /**
    * For a finalized cluster, add a new HddsVolume.
    */
-  @Test
-  public void testAddHddsVolumeAfterFinalize() throws Exception {
+  @ParameterizedTest(name = "schema V3 enabled :{0}")
+  @ValueSource(booleans = {false, true})
+  public void testAddHddsVolumeAfterFinalize(boolean schemaV3Enabled)
+      throws Exception {
+    initTests(schemaV3Enabled);
     // start DN and SCM
     startScmServer();
     addHddsVolume();
@@ -295,11 +291,11 @@ public class TestDatanodeUpgradeToSchemaV3 {
         dsm.getContainer().getVolumeSet().getVolumesList()) {
       HddsVolume hddsVolume = (HddsVolume) vol;
       if (VersionedDatanodeFeatures.SchemaV3.isFinalizedAndEnabled(conf)) {
-        Assert.assertTrue(hddsVolume.isDbLoaded());
-        Assert.assertTrue(hddsVolume.getDbParentDir().getAbsolutePath()
+        Assertions.assertTrue(hddsVolume.isDbLoaded());
+        Assertions.assertTrue(hddsVolume.getDbParentDir().getAbsolutePath()
             .startsWith(hddsVolume.getStorageDir().getAbsolutePath()));
       } else {
-        Assert.assertFalse(hddsVolume.isDbLoaded());
+        Assertions.assertFalse(hddsVolume.isDbLoaded());
       }
     }
   }
@@ -307,19 +303,22 @@ public class TestDatanodeUpgradeToSchemaV3 {
   /**
    * For a finalized cluster, add a new DbVolume.
    */
-  @Test
-  public void testAddDbVolumeAfterFinalize() throws Exception {
+  @ParameterizedTest(name = "schema V3 enabled :{0}")
+  @ValueSource(booleans = {false, true})
+  public void testAddDbVolumeAfterFinalize(boolean schemaV3Enabled)
+      throws Exception {
+    initTests(schemaV3Enabled);
     startScmServer();
     addHddsVolume();
 
     startPreFinalizedDatanode();
     HddsVolume hddsVolume = (HddsVolume) dsm.getContainer().getVolumeSet()
         .getVolumesList().get(0);
-    Assert.assertNull(hddsVolume.getDbParentDir());
+    Assertions.assertNull(hddsVolume.getDbParentDir());
     dsm.finalizeUpgrade();
     // DB is created during upgrade
     File dbDir = hddsVolume.getDbParentDir();
-    Assert.assertTrue(dbDir.getAbsolutePath().startsWith(
+    Assertions.assertTrue(dbDir.getAbsolutePath().startsWith(
         hddsVolume.getStorageDir().getAbsolutePath()));
 
     // Add a new DbVolume
@@ -330,21 +329,24 @@ public class TestDatanodeUpgradeToSchemaV3 {
     // HddsVolume should still use the rocksDB under it's volume
     DbVolume dbVolume = (DbVolume) dsm.getContainer().getDbVolumeSet()
         .getVolumesList().get(0);
-    Assert.assertEquals(0, dbVolume.getHddsVolumeIDs().size());
+    Assertions.assertEquals(0, dbVolume.getHddsVolumeIDs().size());
 
     if (VersionedDatanodeFeatures.SchemaV3.isFinalizedAndEnabled(conf)) {
       hddsVolume = (HddsVolume) dsm.getContainer().getVolumeSet()
           .getVolumesList().get(0);
-      Assert.assertEquals(dbDir, hddsVolume.getDbParentDir());
-      Assert.assertTrue(hddsVolume.isDbLoaded());
+      Assertions.assertEquals(dbDir, hddsVolume.getDbParentDir());
+      Assertions.assertTrue(hddsVolume.isDbLoaded());
     }
   }
 
   /**
    * For a finalized cluster, add a new DbVolume and a new HddsVolume.
    */
-  @Test
-  public void testAddDbAndHddsVolumeAfterFinalize() throws Exception {
+  @ParameterizedTest(name = "schema V3 enabled :{0}")
+  @ValueSource(booleans = {false, true})
+  public void testAddDbAndHddsVolumeAfterFinalize(boolean schemaV3Enabled)
+      throws Exception {
+    initTests(schemaV3Enabled);
     // start DN and SCM
     startScmServer();
     addHddsVolume();
@@ -367,22 +369,22 @@ public class TestDatanodeUpgradeToSchemaV3 {
       if (hddsVolume.getStorageDir().getAbsolutePath().startsWith(
           newDataVolume.getAbsolutePath())) {
         if (VersionedDatanodeFeatures.SchemaV3.isFinalizedAndEnabled(conf)) {
-          Assert.assertEquals(dbVolume, hddsVolume.getDbVolume());
+          Assertions.assertEquals(dbVolume, hddsVolume.getDbVolume());
         }
         // RocksDB of newly added HddsVolume is created on the newly added
         // DbVolume
         dbFile = new File(dbVolume.getStorageDir() + "/" +
             hddsVolume.getClusterID() + "/" + hddsVolume.getStorageID());
       } else {
-        Assert.assertNull(hddsVolume.getDbVolume());
+        Assertions.assertNull(hddsVolume.getDbVolume());
         dbFile = new File(hddsVolume.getStorageDir() + "/" +
             hddsVolume.getClusterID() + "/" + hddsVolume.getStorageID());
       }
       if (VersionedDatanodeFeatures.SchemaV3.isFinalizedAndEnabled(conf)) {
-        Assert.assertTrue(hddsVolume.isDbLoaded());
-        Assert.assertTrue(hddsVolume.getDbParentDir().exists());
-        Assert.assertTrue(dbFile.exists());
-        Assert.assertEquals(dbFile, hddsVolume.getDbParentDir());
+        Assertions.assertTrue(hddsVolume.isDbLoaded());
+        Assertions.assertTrue(hddsVolume.getDbParentDir().exists());
+        Assertions.assertTrue(dbFile.exists());
+        Assertions.assertEquals(dbFile, hddsVolume.getDbParentDir());
       }
     }
   }
@@ -390,16 +392,21 @@ public class TestDatanodeUpgradeToSchemaV3 {
   /**
    * Test data write after finalization.
    */
-  @Test
-  public void testWriteWithV3Enabled() throws Exception {
+  @ParameterizedTest(name = "schema V3 enabled :{0}")
+  @ValueSource(booleans = {false, true})
+  public void testWriteWithV3Enabled(boolean schemaV3Enabled) throws Exception {
+    initTests(schemaV3Enabled);
     testWrite(false, OzoneConsts.SCHEMA_V2);
   }
 
   /**
    * Test data write after finalization.
    */
-  @Test
-  public void testWriteWithV3Disabled() throws Exception {
+  @ParameterizedTest(name = "schema V3 enabled :{0}")
+  @ValueSource(booleans = {false, true})
+  public void testWriteWithV3Disabled(boolean schemaV3Enabled)
+      throws Exception {
+    initTests(schemaV3Enabled);
     testWrite(true, OzoneConsts.SCHEMA_V3);
   }
 
@@ -421,7 +428,7 @@ public class TestDatanodeUpgradeToSchemaV3 {
     KeyValueContainer container = (KeyValueContainer)
         dsm.getContainer().getContainerSet().getContainer(containerID1);
     // When SchemaV3 is disabled, new data should be saved as SchemaV2.
-    Assert.assertEquals(OzoneConsts.SCHEMA_V2,
+    Assertions.assertEquals(OzoneConsts.SCHEMA_V2,
         container.getContainerData().getSchemaVersion());
 
     // Set SchemaV3 enable status
@@ -438,15 +445,18 @@ public class TestDatanodeUpgradeToSchemaV3 {
         dsm.getContainer().getContainerSet().getContainer(containerID2);
     // If SchemaV3 is enabled, new data should be saved as SchemaV3
     // If SchemaV3 is still disabled, new data should still be saved as SchemaV2
-    Assert.assertEquals(expectedVersion,
+    Assertions.assertEquals(expectedVersion,
         container.getContainerData().getSchemaVersion());
   }
 
   /**
    * Test data read during and after finalization.
    */
-  @Test
-  public void testReadsDuringFinalize() throws Exception {
+  @ParameterizedTest(name = "schema V3 enabled :{0}")
+  @ValueSource(booleans = {false, true})
+  public void testReadsDuringFinalize(boolean schemaV3Enabled)
+      throws Exception {
+    initTests(schemaV3Enabled);
     // start DN and SCM
     startScmServer();
     addHddsVolume();
@@ -481,8 +491,10 @@ public class TestDatanodeUpgradeToSchemaV3 {
   /**
    * Test finalization failure.
    */
-  @Test
-  public void testFinalizeFailure() throws Exception {
+  @ParameterizedTest(name = "schema V3 enabled :{0}")
+  @ValueSource(booleans = {false, true})
+  public void testFinalizeFailure(boolean schemaV3Enabled) throws Exception {
+    initTests(schemaV3Enabled);
     // start DN and SCM
     startScmServer();
     addHddsVolume();
@@ -500,9 +512,9 @@ public class TestDatanodeUpgradeToSchemaV3 {
     dataVolume.format(CLUSTER_ID);
     File idDir = new File(dataVolume.getStorageDir(), CLUSTER_ID);
     if (!idDir.mkdir()) {
-      Assert.fail("Failed to create id directory");
+      Assertions.fail("Failed to create id directory");
     }
-    Assert.assertNull(dataVolume.getDbParentDir());
+    Assertions.assertNull(dataVolume.getDbParentDir());
 
     // Restart DN
     restartDatanode(
@@ -516,13 +528,13 @@ public class TestDatanodeUpgradeToSchemaV3 {
     closeContainer(containerID, pipeline);
     KeyValueContainer container = (KeyValueContainer)
         dsm.getContainer().getContainerSet().getContainer(containerID);
-    Assert.assertEquals(OzoneConsts.SCHEMA_V2,
+    Assertions.assertEquals(OzoneConsts.SCHEMA_V2,
         container.getContainerData().getSchemaVersion());
 
 
     HddsVolume volume = Mockito.mock(HddsVolume.class);
     Mockito.doThrow(new IOException("Failed to init DB")).when(volume).
-        createDbStore(anyObject());
+        createDbStore(any());
     Map volumeMap = new HashMap<String, StorageVolume>();
     volumeMap.put(dataVolume.getStorageID(), volume);
     dsm.getContainer().getVolumeSet().setVolumeMap(volumeMap);
@@ -538,7 +550,7 @@ public class TestDatanodeUpgradeToSchemaV3 {
     // Check that old data is readable
     container = (KeyValueContainer)
         dsm.getContainer().getContainerSet().getContainer(containerID);
-    Assert.assertEquals(OzoneConsts.SCHEMA_V2,
+    Assertions.assertEquals(OzoneConsts.SCHEMA_V2,
         container.getContainerData().getSchemaVersion());
     readChunk(writeChunk, pipeline);
 
@@ -549,7 +561,7 @@ public class TestDatanodeUpgradeToSchemaV3 {
     // Old data is readable after DN restart
     container = (KeyValueContainer)
         dsm.getContainer().getContainerSet().getContainer(containerID);
-    Assert.assertEquals(OzoneConsts.SCHEMA_V2,
+    Assertions.assertEquals(OzoneConsts.SCHEMA_V2,
         container.getContainerData().getSchemaVersion());
     readChunk(writeChunk, pipeline);
   }
@@ -558,13 +570,13 @@ public class TestDatanodeUpgradeToSchemaV3 {
     KeyValueContainerData data =
         (KeyValueContainerData) dsm.getContainer().getContainerSet()
             .getContainer(containerID).getContainerData();
-    Assert.assertTrue(data.getChunksPath().contains(expectedID));
-    Assert.assertTrue(data.getMetadataPath().contains(expectedID));
+    Assertions.assertTrue(data.getChunksPath().contains(expectedID));
+    Assertions.assertTrue(data.getMetadataPath().contains(expectedID));
   }
 
   public List<File> getHddsSubdirs(File volume) {
     File[] subdirsArray = getHddsRoot(volume).listFiles(File::isDirectory);
-    Assert.assertNotNull(subdirsArray);
+    Assertions.assertNotNull(subdirsArray);
     return Arrays.asList(subdirsArray);
   }
 
@@ -583,8 +595,7 @@ public class TestDatanodeUpgradeToSchemaV3 {
    */
   public void startPreFinalizedDatanode() throws Exception {
     // Set layout version.
-    conf.set(HddsConfigKeys.OZONE_METADATA_DIRS,
-        tempFolder.getRoot().getAbsolutePath());
+    conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, tempFolder.toString());
     DatanodeLayoutStorage layoutStorage = new DatanodeLayoutStorage(conf,
         UUID.randomUUID().toString(),
         HDDSLayoutFeature.ERASURE_CODED_STORAGE_SUPPORT.layoutVersion());
@@ -594,7 +605,7 @@ public class TestDatanodeUpgradeToSchemaV3 {
     DatanodeDetails dd = ContainerTestUtils.createDatanodeDetails();
     DatanodeStateMachine newDsm = new DatanodeStateMachine(dd, conf);
     int actualMlv = newDsm.getLayoutVersionManager().getMetadataLayoutVersion();
-    Assert.assertEquals(
+    Assertions.assertEquals(
         HDDSLayoutFeature.ERASURE_CODED_STORAGE_SUPPORT.layoutVersion(),
         actualMlv);
     if (dsm != null) {
@@ -615,10 +626,11 @@ public class TestDatanodeUpgradeToSchemaV3 {
     dsm = new DatanodeStateMachine(dd, conf);
     int mlv = dsm.getLayoutVersionManager().getMetadataLayoutVersion();
     if (exactMatch) {
-      Assert.assertEquals(expectedMlv, mlv);
+      Assertions.assertEquals(expectedMlv, mlv);
     } else {
-      Assert.assertTrue("Expected minimum mlv(" + expectedMlv
-          + ") is smaller than mlv(" + mlv + ").", expectedMlv <= mlv);
+      Assertions.assertTrue(expectedMlv <= mlv,
+          "Expected minimum mlv(" + expectedMlv
+              + ") is smaller than mlv(" + mlv + ").");
     }
 
     callVersionEndpointTask();
@@ -639,7 +651,7 @@ public class TestDatanodeUpgradeToSchemaV3 {
 
   public String startScmServer() throws IOException {
     String scmID = UUID.randomUUID().toString();
-    scmServerImpl = new ScmTestMock(CLUSTER_ID, scmID);
+    ScmTestMock scmServerImpl = new ScmTestMock(CLUSTER_ID, scmID);
     scmRpcServer = SCMTestUtils.startScmRpcServer(conf,
         scmServerImpl, address, 10);
     return scmID;
@@ -718,7 +730,7 @@ public class TestDatanodeUpgradeToSchemaV3 {
       ContainerProtos.Result expectedResult) {
     ContainerProtos.ContainerCommandResponseProto response =
         dsm.getContainer().getDispatcher().dispatch(request, null);
-    Assert.assertEquals(expectedResult, response.getResult());
+    Assertions.assertEquals(expectedResult, response.getResult());
   }
 
   /// VOLUME OPERATIONS ///
@@ -728,7 +740,9 @@ public class TestDatanodeUpgradeToSchemaV3 {
    * @return The root directory for the new volume.
    */
   public File addHddsVolume() throws IOException {
-    File vol = tempFolder.newFolder(UUID.randomUUID().toString());
+
+    File vol = Files.createDirectory(tempFolder.resolve(UUID.randomUUID()
+        .toString())).toFile();
     String[] existingVolumes =
         conf.getStrings(ScmConfigKeys.HDDS_DATANODE_DIR_KEY);
     List<String> allVolumes = new ArrayList<>();
@@ -748,7 +762,8 @@ public class TestDatanodeUpgradeToSchemaV3 {
    * @return The root directory for the new volume.
    */
   public File addDbVolume() throws Exception {
-    File vol = tempFolder.newFolder(UUID.randomUUID().toString());
+    File vol = Files.createDirectory(tempFolder.resolve(UUID.randomUUID()
+        .toString())).toFile();
     String[] existingVolumes =
         conf.getStrings(OzoneConfigKeys.HDDS_DATANODE_CONTAINER_DB_DIR);
     List<String> allVolumes = new ArrayList<>();
diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/upgrade/TestDatanodeUpgradeToScmHA.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/upgrade/TestDatanodeUpgradeToScmHA.java
index 79f55001c7..63921e17db 100644
--- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/upgrade/TestDatanodeUpgradeToScmHA.java
+++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/upgrade/TestDatanodeUpgradeToScmHA.java
@@ -43,14 +43,11 @@ import org.apache.hadoop.ozone.container.replication.ContainerImporter;
 import org.apache.hadoop.ozone.container.replication.ContainerReplicationSource;
 import org.apache.hadoop.ozone.container.replication.OnDemandContainerReplicationSource;
 import org.apache.ozone.test.LambdaTestUtils;
-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.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -60,7 +57,6 @@ import java.nio.file.Path;
 import java.nio.file.StandardCopyOption;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Random;
@@ -76,15 +72,14 @@ import static org.apache.hadoop.ozone.container.replication.CopyContainerCompres
  * SCM ID to the post-SCM HA volume format using cluster ID. If SCM HA was
  * already being used before the upgrade, there should be no changes.
  */
-@RunWith(Parameterized.class)
 public class TestDatanodeUpgradeToScmHA {
-  @Rule
-  public TemporaryFolder tempFolder;
+  @TempDir
+  private Path tempFolder;
 
   private DatanodeStateMachine dsm;
-  private final OzoneConfiguration conf;
+  private OzoneConfiguration conf;
   private static final String CLUSTER_ID = "clusterID";
-  private final boolean scmHAAlreadyEnabled;
+  private boolean scmHAAlreadyEnabled;
 
   private RPC.Server scmRpcServer;
   private InetSocketAddress address;
@@ -92,31 +87,22 @@ public class TestDatanodeUpgradeToScmHA {
 
   private Random random;
 
-  @Parameterized.Parameters(name = "{index}: scmHAAlreadyEnabled={0}")
-  public static Collection<Object[]> getSchemaFiles() {
-    Collection<Object[]> parameters = new ArrayList<>();
-    parameters.add(new Boolean[]{false});
-    parameters.add(new Boolean[]{true});
-    return parameters;
-  }
-
-  public TestDatanodeUpgradeToScmHA(boolean scmHAAlreadyEnabled) {
-    this.scmHAAlreadyEnabled = scmHAAlreadyEnabled;
+  private void setScmHAEnabled(boolean enableSCMHA)
+      throws Exception {
+    this.scmHAAlreadyEnabled = enableSCMHA;
     conf = new OzoneConfiguration();
     conf.setBoolean(ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY, scmHAAlreadyEnabled);
+    setup();
   }
 
-  @Before
-  public void setup() throws Exception {
-    tempFolder = new TemporaryFolder();
-    tempFolder.create();
+  private void setup() throws Exception {
     random = new Random();
 
     address = SCMTestUtils.getReuseableAddress();
     conf.setSocketAddr(ScmConfigKeys.OZONE_SCM_NAMES, address);
   }
 
-  @After
+  @AfterEach
   public void teardown() throws Exception {
     if (scmRpcServer != null) {
       scmRpcServer.stop();
@@ -127,8 +113,11 @@ public class TestDatanodeUpgradeToScmHA {
     }
   }
 
-  @Test
-  public void testReadsDuringFinalization() throws Exception {
+  @ParameterizedTest(name = "{index}: scmHAAlreadyEnabled={0}")
+  @ValueSource(booleans = {true, false})
+  public void testReadsDuringFinalization(boolean enableSCMHA)
+      throws Exception {
+    setScmHAEnabled(enableSCMHA);
     // start DN and SCM
     startScmServer();
     addVolume();
@@ -160,8 +149,10 @@ public class TestDatanodeUpgradeToScmHA {
     readFuture.get();
   }
 
-  @Test
-  public void testImportContainer() throws Exception {
+  @ParameterizedTest(name = "{index}: scmHAAlreadyEnabled={0}")
+  @ValueSource(booleans = {true, false})
+  public void testImportContainer(boolean enableSCMHA) throws Exception {
+    setScmHAEnabled(enableSCMHA);
     // start DN and SCM
     startScmServer();
     addVolume();
@@ -228,8 +219,11 @@ public class TestDatanodeUpgradeToScmHA {
     readChunk(exportWriteChunk2, pipeline);
   }
 
-  @Test
-  public void testFailedVolumeDuringFinalization() throws Exception {
+  @ParameterizedTest(name = "{index}: scmHAAlreadyEnabled={0}")
+  @ValueSource(booleans = {true, false})
+  public void testFailedVolumeDuringFinalization(boolean enableSCMHA)
+      throws Exception {
+    setScmHAEnabled(enableSCMHA);
     /// SETUP ///
 
     String originalScmID = startScmServer();
@@ -239,9 +233,9 @@ public class TestDatanodeUpgradeToScmHA {
 
     /// PRE-FINALIZED: Write and Read from formatted volume ///
 
-    Assert.assertEquals(1,
+    Assertions.assertEquals(1,
         dsm.getContainer().getVolumeSet().getVolumesList().size());
-    Assert.assertEquals(0,
+    Assertions.assertEquals(0,
         dsm.getContainer().getVolumeSet().getFailedVolumesList().size());
 
     // Add container with data, make sure it can be read and written.
@@ -262,7 +256,7 @@ public class TestDatanodeUpgradeToScmHA {
         ContainerProtos.Result.CONTAINER_FILES_CREATE_ERROR);
     State containerState = dsm.getContainer().getContainerSet()
         .getContainer(containerID).getContainerState();
-    Assert.assertEquals(State.UNHEALTHY, containerState);
+    Assertions.assertEquals(State.UNHEALTHY, containerState);
     dsm.finalizeUpgrade();
     LambdaTestUtils.await(2000, 500,
         () -> dsm.getLayoutVersionManager()
@@ -271,9 +265,9 @@ public class TestDatanodeUpgradeToScmHA {
     /// FINALIZED: Volume marked failed but gets restored on disk ///
 
     // Check that volume is marked failed during finalization.
-    Assert.assertEquals(0,
+    Assertions.assertEquals(0,
         dsm.getContainer().getVolumeSet().getVolumesList().size());
-    Assert.assertEquals(1,
+    Assertions.assertEquals(1,
         dsm.getContainer().getVolumeSet().getFailedVolumesList().size());
 
     // Since the volume was out during the upgrade, it should maintain its
@@ -294,9 +288,9 @@ public class TestDatanodeUpgradeToScmHA {
 
     restartDatanode(HDDSLayoutFeature.SCM_HA.layoutVersion(), false);
 
-    Assert.assertEquals(1,
+    Assertions.assertEquals(1,
         dsm.getContainer().getVolumeSet().getVolumesList().size());
-    Assert.assertEquals(0,
+    Assertions.assertEquals(0,
         dsm.getContainer().getVolumeSet().getFailedVolumesList().size());
 
     checkFinalizedVolumePathID(volume, originalScmID, CLUSTER_ID);
@@ -314,8 +308,10 @@ public class TestDatanodeUpgradeToScmHA {
     checkContainerPathID(newContainerID, CLUSTER_ID);
   }
 
-  @Test
-  public void testFormattingNewVolumes() throws Exception {
+  @ParameterizedTest(name = "{index}: scmHAAlreadyEnabled={0}")
+  @ValueSource(booleans = {true, false})
+  public void testFormattingNewVolumes(boolean enableSCMHA) throws Exception {
+    setScmHAEnabled(enableSCMHA);
     /// SETUP ///
 
     String originalScmID = startScmServer();
@@ -325,9 +321,9 @@ public class TestDatanodeUpgradeToScmHA {
 
     /// PRE-FINALIZED: Write and Read from formatted volume ///
 
-    Assert.assertEquals(1,
+    Assertions.assertEquals(1,
         dsm.getContainer().getVolumeSet().getVolumesList().size());
-    Assert.assertEquals(0,
+    Assertions.assertEquals(0,
         dsm.getContainer().getVolumeSet().getFailedVolumesList().size());
 
     // Add container with data, make sure it can be read and written.
@@ -350,9 +346,9 @@ public class TestDatanodeUpgradeToScmHA {
 
     restartDatanode(HDDSLayoutFeature.INITIAL_VERSION.layoutVersion(), true);
 
-    Assert.assertEquals(2,
+    Assertions.assertEquals(2,
         dsm.getContainer().getVolumeSet().getVolumesList().size());
-    Assert.assertEquals(0,
+    Assertions.assertEquals(0,
         dsm.getContainer().getVolumeSet().getFailedVolumesList().size());
 
     // Because DN mlv would be behind SCM mlv, only reads are allowed.
@@ -385,9 +381,9 @@ public class TestDatanodeUpgradeToScmHA {
 
     restartDatanode(HDDSLayoutFeature.SCM_HA.layoutVersion(), false);
 
-    Assert.assertEquals(3,
+    Assertions.assertEquals(3,
         dsm.getContainer().getVolumeSet().getVolumesList().size());
-    Assert.assertEquals(0,
+    Assertions.assertEquals(0,
         dsm.getContainer().getVolumeSet().getFailedVolumesList().size());
 
     checkFinalizedVolumePathID(preFinVolume1, originalScmID, CLUSTER_ID);
@@ -426,8 +422,8 @@ public class TestDatanodeUpgradeToScmHA {
     KeyValueContainerData data =
         (KeyValueContainerData) dsm.getContainer().getContainerSet()
             .getContainer(containerID).getContainerData();
-    Assert.assertTrue(data.getChunksPath().contains(expectedID));
-    Assert.assertTrue(data.getMetadataPath().contains(expectedID));
+    Assertions.assertTrue(data.getChunksPath().contains(expectedID));
+    Assertions.assertTrue(data.getMetadataPath().contains(expectedID));
   }
 
   public void checkFinalizedVolumePathID(File volume, String scmID,
@@ -441,16 +437,16 @@ public class TestDatanodeUpgradeToScmHA {
 
       // Volume should have SCM ID and cluster ID directory, where cluster ID
       // is a symlink to SCM ID.
-      Assert.assertEquals(2, subdirs.size());
+      Assertions.assertEquals(2, subdirs.size());
 
       File scmIDDir = new File(hddsRoot, scmID);
-      Assert.assertTrue(subdirs.contains(scmIDDir));
+      Assertions.assertTrue(subdirs.contains(scmIDDir));
 
       File clusterIDDir = new File(hddsRoot, CLUSTER_ID);
-      Assert.assertTrue(subdirs.contains(clusterIDDir));
-      Assert.assertTrue(Files.isSymbolicLink(clusterIDDir.toPath()));
+      Assertions.assertTrue(subdirs.contains(clusterIDDir));
+      Assertions.assertTrue(Files.isSymbolicLink(clusterIDDir.toPath()));
       Path symlinkTarget = Files.readSymbolicLink(clusterIDDir.toPath());
-      Assert.assertEquals(scmID, symlinkTarget.toString());
+      Assertions.assertEquals(scmID, symlinkTarget.toString());
     }
   }
 
@@ -479,14 +475,14 @@ public class TestDatanodeUpgradeToScmHA {
     }
 
     // Volume should only have the specified ID directory.
-    Assert.assertEquals(1, subdirs.size());
+    Assertions.assertEquals(1, subdirs.size());
     File idDir = new File(hddsRoot, expectedID);
-    Assert.assertTrue(subdirs.contains(idDir));
+    Assertions.assertTrue(subdirs.contains(idDir));
   }
 
   public List<File> getHddsSubdirs(File volume) {
     File[] subdirsArray = getHddsRoot(volume).listFiles(File::isDirectory);
-    Assert.assertNotNull(subdirsArray);
+    Assertions.assertNotNull(subdirsArray);
     return Arrays.asList(subdirsArray);
   }
 
@@ -508,7 +504,7 @@ public class TestDatanodeUpgradeToScmHA {
   public void startPreFinalizedDatanode() throws Exception {
     // Set layout version.
     conf.set(HddsConfigKeys.OZONE_METADATA_DIRS,
-        tempFolder.getRoot().getAbsolutePath());
+        tempFolder.toString());
     DatanodeLayoutStorage layoutStorage = new DatanodeLayoutStorage(conf,
         UUID.randomUUID().toString(),
         HDDSLayoutFeature.INITIAL_VERSION.layoutVersion());
@@ -518,7 +514,7 @@ public class TestDatanodeUpgradeToScmHA {
     DatanodeDetails dd = ContainerTestUtils.createDatanodeDetails();
     DatanodeStateMachine newDsm = new DatanodeStateMachine(dd, conf);
     int actualMlv = newDsm.getLayoutVersionManager().getMetadataLayoutVersion();
-    Assert.assertEquals(HDDSLayoutFeature.INITIAL_VERSION.layoutVersion(),
+    Assertions.assertEquals(HDDSLayoutFeature.INITIAL_VERSION.layoutVersion(),
         actualMlv);
     dsm = newDsm;
 
@@ -535,10 +531,11 @@ public class TestDatanodeUpgradeToScmHA {
     dsm = new DatanodeStateMachine(dd, conf);
     int mlv = dsm.getLayoutVersionManager().getMetadataLayoutVersion();
     if (exactMatch) {
-      Assert.assertEquals(expectedMlv, mlv);
+      Assertions.assertEquals(expectedMlv, mlv);
     } else {
-      Assert.assertTrue("Expected minimum mlv(" + expectedMlv
-          + ") is smaller than mlv(" + mlv + ").", expectedMlv <= mlv);
+      Assertions.assertTrue(expectedMlv <= mlv,
+          "Expected minimum mlv(" + expectedMlv
+          + ") is smaller than mlv(" + mlv + ").");
     }
 
     callVersionEndpointTask();
@@ -650,7 +647,8 @@ public class TestDatanodeUpgradeToScmHA {
 
     replicationSource.prepare(containerId);
 
-    File destination = tempFolder.newFile();
+    File destination =
+        Files.createFile(tempFolder.resolve("destFile" + containerId)).toFile();
     try (FileOutputStream fos = new FileOutputStream(destination)) {
       replicationSource.copyData(containerId, fos, NO_COMPRESSION);
     }
@@ -668,8 +666,9 @@ public class TestDatanodeUpgradeToScmHA {
             dsm.getContainer().getController(),
             dsm.getContainer().getVolumeSet());
 
-    File tempFile = tempFolder.newFile(
-        ContainerUtils.getContainerTarName(containerID));
+    File tempFile = Files.createFile(
+            tempFolder.resolve(ContainerUtils.getContainerTarName(containerID)))
+        .toFile();
     Files.copy(source.toPath(), tempFile.toPath(),
         StandardCopyOption.REPLACE_EXISTING);
     replicator.importContainer(containerID, tempFile.toPath(), null,
@@ -686,7 +685,7 @@ public class TestDatanodeUpgradeToScmHA {
       ContainerProtos.Result expectedResult) {
     ContainerProtos.ContainerCommandResponseProto response =
         dsm.getContainer().getDispatcher().dispatch(request, null);
-    Assert.assertEquals(expectedResult, response.getResult());
+    Assertions.assertEquals(expectedResult, response.getResult());
   }
 
   /// VOLUME OPERATIONS ///
@@ -696,7 +695,9 @@ public class TestDatanodeUpgradeToScmHA {
    * @return The root directory for the new volume.
    */
   public File addVolume() throws Exception {
-    File vol = tempFolder.newFolder(UUID.randomUUID().toString());
+
+    File vol = Files.createDirectory(
+        tempFolder.resolve(UUID.randomUUID().toString())).toFile();
     String[] existingVolumes =
         conf.getStrings(ScmConfigKeys.HDDS_DATANODE_DIR_KEY);
     List<String> allVolumes = new ArrayList<>();
@@ -717,7 +718,7 @@ public class TestDatanodeUpgradeToScmHA {
    */
   public void failVolume(File volume) {
     File failedVolume = getFailedVolume(volume);
-    Assert.assertTrue(volume.renameTo(failedVolume));
+    Assertions.assertTrue(volume.renameTo(failedVolume));
   }
 
   /**
@@ -727,7 +728,7 @@ public class TestDatanodeUpgradeToScmHA {
    */
   public void restoreVolume(File volume) {
     File failedVolume = getFailedVolume(volume);
-    Assert.assertTrue(failedVolume.renameTo(volume));
+    Assertions.assertTrue(failedVolume.renameTo(volume));
   }
 
   /**


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org