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

stevel pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new f099f08d922 HADOOP-19424. [S3A] [JDK17] Upgrade JUnit from 4 to 5 in 
hadoop-aws. (#7752)
f099f08d922 is described below

commit f099f08d922689dd2bd641bbbbd7c29c451463df
Author: slfan1989 <55643692+slfan1...@users.noreply.github.com>
AuthorDate: Tue Jul 8 00:12:25 2025 +0800

    HADOOP-19424. [S3A] [JDK17] Upgrade JUnit from 4 to 5 in hadoop-aws. (#7752)
    
    
    Contributed by Shilun Fan.
---
 hadoop-tools/hadoop-aws/pom.xml                    | 10 ---
 .../apache/hadoop/fs/s3a/AbstractS3AMockTest.java  | 13 ++--
 .../ITestBlockingThreadPoolExecutorService.java    | 15 ++---
 .../hadoop/fs/s3a/ITestEMRFSCompatibility.java     |  2 +-
 .../fs/s3a/ITestS3AAWSCredentialsProvider.java     | 18 ++---
 .../ITestS3AAnalyticsAcceleratorStreamReading.java |  6 +-
 .../org/apache/hadoop/fs/s3a/ITestS3AChecksum.java |  2 +-
 ...TestS3ADSSEEncryptionWithDefaultS3Settings.java |  6 +-
 .../apache/hadoop/fs/s3a/ITestS3ATestUtils.java    | 10 +--
 .../apache/hadoop/fs/s3a/MultipartTestUtils.java   |  8 +--
 .../org/apache/hadoop/fs/s3a/S3ATestUtils.java     | 72 ++++++++++----------
 .../java/org/apache/hadoop/fs/s3a/TestListing.java | 12 ++--
 .../fs/s3a/TestS3AAWSCredentialsProvider.java      |  8 +--
 .../hadoop/fs/s3a/TestS3ABlockOutputStream.java    |  6 +-
 .../apache/hadoop/fs/s3a/TestS3ADeleteOnExit.java  |  2 +-
 .../hadoop/fs/s3a/TestS3AEndpointParsing.java      |  2 +-
 .../apache/hadoop/fs/s3a/TestS3AGetFileStatus.java | 37 ++++++-----
 .../apache/hadoop/fs/s3a/TestS3AInputPolicies.java | 50 +++++++-------
 .../hadoop/fs/s3a/TestS3AInputStreamRetry.java     | 24 +++----
 .../org/apache/hadoop/fs/s3a/TestS3AUnbuffer.java  |  4 +-
 .../fs/s3a/adapter/TestV1CredentialsProvider.java  | 15 ++---
 .../apache/hadoop/fs/s3a/auth/ProgressCounter.java |  4 +-
 .../apache/hadoop/fs/s3a/auth/RoleTestUtils.java   | 21 +++---
 .../delegation/MiniKerberizedHadoopCluster.java    |  6 +-
 .../delegation/TestS3ADelegationTokenSupport.java  | 77 +++++++++++-----------
 .../fs/s3a/commit/AbstractITCommitProtocol.java    |  4 +-
 .../hadoop/fs/s3a/commit/TestMagicCommitPaths.java | 22 ++++---
 .../fs/s3a/commit/TestMagicCommitTrackerUtils.java | 13 ++--
 .../s3a/commit/magic/ITestMagicCommitProtocol.java |  6 +-
 .../fs/s3a/fileContext/ITestS3AFileContext.java    |  4 +-
 .../impl/ITestS3AConditionalCreateBehavior.java    |  6 +-
 .../s3a/impl/ITestS3APutIfMatchAndIfNoneMatch.java |  8 +--
 .../hadoop/fs/s3a/impl/TestS3AEncryption.java      | 14 ++--
 .../fs/s3a/s3guard/S3GuardToolTestHelper.java      |  4 +-
 .../hadoop/fs/s3a/s3guard/TestS3GuardCLI.java      |  6 +-
 .../apache/hadoop/fs/s3a/test/ExtraAssertions.java |  9 ++-
 36 files changed, 256 insertions(+), 270 deletions(-)

diff --git a/hadoop-tools/hadoop-aws/pom.xml b/hadoop-tools/hadoop-aws/pom.xml
index f10eea7a4d3..629c56e3fa5 100644
--- a/hadoop-tools/hadoop-aws/pom.xml
+++ b/hadoop-tools/hadoop-aws/pom.xml
@@ -499,11 +499,6 @@
       <artifactId>wildfly-openssl</artifactId>
       <scope>runtime</scope>
     </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-inline</artifactId>
@@ -618,10 +613,5 @@
       <artifactId>junit-platform-launcher</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.junit.vintage</groupId>
-      <artifactId>junit-vintage-engine</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 </project>
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/AbstractS3AMockTest.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/AbstractS3AMockTest.java
index 940e23026af..81a295345a8 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/AbstractS3AMockTest.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/AbstractS3AMockTest.java
@@ -28,10 +28,8 @@
 
 import org.apache.hadoop.conf.Configuration;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 
 
 /**
@@ -49,14 +47,11 @@ public abstract class AbstractS3AMockTest {
               .build())
           .build();
 
-  @Rule
-  public ExpectedException exception = ExpectedException.none();
-
   protected S3AFileSystem fs;
   protected S3Client s3;
   protected Configuration conf;
 
-  @Before
+  @BeforeEach
   public void setup() throws Exception {
     conf = createConfiguration();
     fs = new S3AFileSystem();
@@ -97,7 +92,7 @@ public S3Client getS3Client() {
     return s3;
   }
 
-  @After
+  @AfterEach
   public void teardown() throws Exception {
     if (fs != null) {
       fs.close();
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestBlockingThreadPoolExecutorService.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestBlockingThreadPoolExecutorService.java
index cf9ad877add..baaa6eb37a4 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestBlockingThreadPoolExecutorService.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestBlockingThreadPoolExecutorService.java
@@ -22,10 +22,9 @@
 import org.apache.hadoop.util.SemaphoredDelegatingExecutor;
 import org.apache.hadoop.util.StopWatch;
 
-import org.junit.AfterClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.Timeout;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,11 +34,12 @@
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * Basic test for S3A's blocking executor service.
  */
+@Timeout(60)
 public class ITestBlockingThreadPoolExecutorService {
 
   private static final Logger LOG = LoggerFactory.getLogger(
@@ -56,10 +56,7 @@ public class ITestBlockingThreadPoolExecutorService {
 
   private static BlockingThreadPoolExecutorService tpe;
 
-  @Rule
-  public Timeout testTimeout = new Timeout(60, TimeUnit.SECONDS);
-
-  @AfterClass
+  @AfterAll
   public static void afterClass() throws Exception {
     ensureDestroyed();
   }
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestEMRFSCompatibility.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestEMRFSCompatibility.java
index 402f32d2c34..578eeb53b8c 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestEMRFSCompatibility.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestEMRFSCompatibility.java
@@ -19,7 +19,7 @@
 package org.apache.hadoop.fs.s3a;
 
 import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import org.apache.hadoop.fs.Path;
 
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AAWSCredentialsProvider.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AAWSCredentialsProvider.java
index e6f258e5564..1f842cb21ff 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AAWSCredentialsProvider.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AAWSCredentialsProvider.java
@@ -20,7 +20,6 @@
 
 import java.io.IOException;
 import java.nio.file.AccessDeniedException;
-import java.util.concurrent.TimeUnit;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
@@ -29,10 +28,9 @@
 import org.apache.hadoop.fs.s3a.impl.InstantiationIOException;
 
 import org.assertj.core.api.Assertions;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.Timeout;
+import org.junit.jupiter.api.Test;
 
+import org.junit.jupiter.api.Timeout;
 import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
 import software.amazon.awssdk.auth.credentials.AwsCredentials;
 import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
@@ -46,19 +44,18 @@
 import static 
org.apache.hadoop.fs.s3a.test.PublicDatasetTestUtils.getExternalData;
 import static 
org.apache.hadoop.fs.s3a.test.PublicDatasetTestUtils.isUsingDefaultExternalDataFile;
 import static org.apache.hadoop.test.LambdaTestUtils.intercept;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * Integration tests for {@link Constants#AWS_CREDENTIALS_PROVIDER} logic
  * through the S3A Filesystem instantiation process.
  */
+@Timeout(60)
 public class ITestS3AAWSCredentialsProvider {
   private static final Logger LOG =
       LoggerFactory.getLogger(ITestS3AAWSCredentialsProvider.class);
 
-  @Rule
-  public Timeout testTimeout = new Timeout(60_1000, TimeUnit.MILLISECONDS);
-
   /**
    * Expecting a wrapped ClassNotFoundException.
    */
@@ -219,9 +216,8 @@ public void testAnonymousProvider() throws Exception {
           .describedAs("Filesystem")
           .isNotNull();
       FileStatus stat = fs.getFileStatus(testFile);
-      assertEquals(
-          "The qualified path returned by getFileStatus should be same as the 
original file",
-          testFile, stat.getPath());
+      assertEquals(testFile, stat.getPath(),
+          "The qualified path returned by getFileStatus should be same as the 
original file");
     }
   }
 
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AAnalyticsAcceleratorStreamReading.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AAnalyticsAcceleratorStreamReading.java
index dff171bbdd8..9bdf98839ac 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AAnalyticsAcceleratorStreamReading.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AAnalyticsAcceleratorStreamReading.java
@@ -23,8 +23,8 @@
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.assertj.core.api.Assertions;
 
 import org.apache.hadoop.conf.Configuration;
@@ -67,7 +67,7 @@ public class ITestS3AAnalyticsAcceleratorStreamReading 
extends AbstractS3ATestBa
 
   private Path externalTestFile;
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     super.setup();
     skipIfClientSideEncryption();
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AChecksum.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AChecksum.java
index f477f46ceb6..75266461565 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AChecksum.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AChecksum.java
@@ -21,7 +21,7 @@
 import java.io.IOException;
 
 import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import software.amazon.awssdk.services.s3.model.ChecksumAlgorithm;
 import software.amazon.awssdk.services.s3.model.ChecksumMode;
 import software.amazon.awssdk.services.s3.model.HeadObjectRequest;
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ADSSEEncryptionWithDefaultS3Settings.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ADSSEEncryptionWithDefaultS3Settings.java
index 732f95702d9..0b4856661b5 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ADSSEEncryptionWithDefaultS3Settings.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ADSSEEncryptionWithDefaultS3Settings.java
@@ -20,8 +20,8 @@
 
 import java.io.IOException;
 
-import org.junit.Ignore;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import org.apache.commons.lang3.StringUtils;
@@ -96,13 +96,13 @@ protected void assertEncrypted(Path path) throws 
IOException {
   }
 
   @Override
-  @Ignore
+  @Disabled
   @Test
   public void testEncryptionSettingPropagation() throws Throwable {
   }
 
   @Override
-  @Ignore
+  @Disabled
   @Test
   public void testEncryption() throws Throwable {
   }
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ATestUtils.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ATestUtils.java
index 88204b25e07..b7a44d142e7 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ATestUtils.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ATestUtils.java
@@ -19,9 +19,9 @@
 package org.apache.hadoop.fs.s3a;
 
 import org.apache.hadoop.conf.Configuration;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -31,12 +31,12 @@
  * Test the test utils. Why an integration test? it's needed to
  * verify property pushdown.
  */
-public class ITestS3ATestUtils extends Assert {
+public class ITestS3ATestUtils extends Assertions {
   private static final Logger LOG =
       LoggerFactory.getLogger(ITestS3ATestUtils.class);
   public static final String KEY = "undefined.property";
 
-  @Before
+  @BeforeEach
   public void clear() {
     System.clearProperty(KEY);
   }
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/MultipartTestUtils.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/MultipartTestUtils.java
index 8ece43d50a5..64eb8466616 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/MultipartTestUtils.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/MultipartTestUtils.java
@@ -27,7 +27,7 @@
 import org.apache.hadoop.fs.s3a.impl.PutObjectOptions;
 import org.apache.hadoop.fs.store.audit.AuditSpan;
 
-import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,6 +45,7 @@
 import static org.apache.hadoop.fs.contract.ContractTestUtils.createFile;
 import static org.apache.hadoop.fs.contract.ContractTestUtils.dataset;
 import static 
org.apache.hadoop.fs.s3a.commit.CommitConstants.MAGIC_PATH_PREFIX;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 
 /**
  * Utilities for S3A multipart upload tests.
@@ -80,8 +81,7 @@ static void cleanupParts(S3AFileSystem fs, Set <IdKey> 
keySet) {
         anyFailure = true;
       }
     }
-    Assert.assertFalse("Failure aborting multipart upload(s), see log.",
-        anyFailure);
+    assertFalse(anyFailure, "Failure aborting multipart upload(s), see log.");
   }
 
   public static IdKey createPartUpload(S3AFileSystem fs, String key, int len,
@@ -116,7 +116,7 @@ public static void assertNoUploadsAt(S3AFileSystem fs, Path 
path) throws
     RemoteIterator<MultipartUpload> uploads = fs.listUploads(key);
     while (uploads.hasNext()) {
       MultipartUpload upload = uploads.next();
-      Assert.fail("Found unexpected upload " + upload.key() + " " +
+      Assertions.fail("Found unexpected upload " + upload.key() + " " +
           truncatedUploadId(upload.uploadId()));
     }
   }
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java
index aa296d8bf7b..771a3567130 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java
@@ -70,7 +70,6 @@
 
 import org.assertj.core.api.Assertions;
 import org.assertj.core.api.Assumptions;
-import org.junit.Assert;
 import org.junit.Assume;
 import org.junit.AssumptionViolatedException;
 import org.slf4j.Logger;
@@ -126,7 +125,10 @@
 import static 
org.apache.hadoop.util.functional.FunctionalIO.uncheckIOExceptions;
 import static 
org.apache.hadoop.util.functional.RemoteIterators.mappingRemoteIterator;
 import static org.apache.hadoop.util.functional.RemoteIterators.toList;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Utilities for the S3A tests.
@@ -1264,8 +1266,7 @@ public void assertDiffEquals(String message, long 
expected) {
         // Log in error ensures that the details appear in the test output
         LOG.error(text + " expected {}, actual {}", expected, diff);
       }
-      Assert.assertEquals(text,
-          expected, diff);
+      assertEquals(expected, diff, text);
     }
 
     /**
@@ -1282,8 +1283,8 @@ public void assertDiffEquals(long expected) {
      * @param that the other metric diff instance.
      */
     public void assertDiffEquals(MetricDiff that) {
-      Assert.assertEquals(this.toString() + " != " + that,
-          this.diff(), that.diff());
+      assertEquals(this.diff(), that.diff(),
+          this.toString() + " != " + that);
     }
 
     /**
@@ -1337,9 +1338,9 @@ public long getStartingValue() {
    * @param obj object to check
    */
   public static void assertInstanceOf(Class<?> expectedClass, Object obj) {
-    Assert.assertTrue(String.format("Expected instance of class %s, but is 
%s.",
-        expectedClass, obj.getClass()),
-        expectedClass.isAssignableFrom(obj.getClass()));
+    assertTrue(expectedClass.isAssignableFrom(obj.getClass()),
+        String.format("Expected instance of class %s, but is %s.",
+        expectedClass, obj.getClass()));
   }
 
   /**
@@ -1399,17 +1400,17 @@ public static void verifyFileStatus(FileStatus status,
       String group,
       FsPermission permission) {
     String details = status.toString();
-    assertFalse("Not a dir: " + details, status.isDirectory());
-    assertEquals("Mod time: " + details, modTime, 
status.getModificationTime());
-    assertEquals("File size: " + details, size, status.getLen());
-    assertEquals("Block size: " + details, blockSize, status.getBlockSize());
+    assertFalse(status.isDirectory(), "Not a dir: " + details);
+    assertEquals(modTime, status.getModificationTime(), "Mod time: " + 
details);
+    assertEquals(size, status.getLen(), "File size: " + details);
+    assertEquals(blockSize, status.getBlockSize(), "Block size: " + details);
     if (replication > 0) {
-      assertEquals("Replication value: " + details, replication,
-          status.getReplication());
+      assertEquals(replication, status.getReplication(),
+          "Replication value: " + details);
     }
     if (accessTime != 0) {
-      assertEquals("Access time: " + details, accessTime,
-          status.getAccessTime());
+      assertEquals(accessTime, status.getAccessTime(),
+          "Access time: " + details);
     }
     if (owner != null) {
       assertEquals("Owner: " + details, owner, status.getOwner());
@@ -1418,8 +1419,8 @@ public static void verifyFileStatus(FileStatus status,
       assertEquals("Group: " + details, group, status.getGroup());
     }
     if (permission != null) {
-      assertEquals("Permission: " + details, permission,
-          status.getPermission());
+      assertEquals(permission, status.getPermission(),
+          "Permission: " + details);
     }
   }
 
@@ -1433,19 +1434,20 @@ public static void verifyDirStatus(S3AFileStatus status,
       int replication,
       String owner) {
     String details = status.toString();
-    assertTrue("Is a dir: " + details, status.isDirectory());
-    assertEquals("zero length: " + details, 0, status.getLen());
+    assertTrue(status.isDirectory(), "Is a dir: " + details);
+    assertEquals(0, status.getLen(), "zero length: " + details);
     // S3AFileStatus always assigns modTime = System.currentTimeMillis()
-    assertTrue("Mod time: " + details, status.getModificationTime() > 0);
-    assertEquals("Replication value: " + details, replication,
-        status.getReplication());
-    assertEquals("Access time: " + details, 0, status.getAccessTime());
+    assertTrue(status.getModificationTime() > 0, "Mod time: " + details);
+    assertEquals(replication, status.getReplication(),
+        "Replication value: " + details);
+    assertEquals(0, status.getAccessTime(),
+        "Access time: " + details);
     assertEquals("Owner: " + details, owner, status.getOwner());
     // S3AFileStatus always assigns group=owner
     assertEquals("Group: " + details, owner, status.getGroup());
     // S3AFileStatus always assigns permission = default
-    assertEquals("Permission: " + details,
-        FsPermission.getDefault(), status.getPermission());
+    assertEquals(FsPermission.getDefault(), status.getPermission(),
+        "Permission: " + details);
   }
 
   /**
@@ -1590,15 +1592,15 @@ public static void 
checkListingDoesNotContainPath(S3AFileSystem fs, Path filePat
         fs.listFiles(filePath.getParent(), false);
     while (listIter.hasNext()) {
       final LocatedFileStatus lfs = listIter.next();
-      assertNotEquals("Listing was not supposed to include " + filePath,
-            filePath, lfs.getPath());
+      assertNotEquals(filePath, lfs.getPath(),
+          "Listing was not supposed to include " + filePath);
     }
     LOG.info("{}; file omitted from listFiles listing as expected.", filePath);
 
     final FileStatus[] fileStatuses = fs.listStatus(filePath.getParent());
     for (FileStatus fileStatus : fileStatuses) {
-      assertNotEquals("Listing was not supposed to include " + filePath,
-            filePath, fileStatus.getPath());
+      assertNotEquals(filePath, fileStatus.getPath(),
+          "Listing was not supposed to include " + filePath);
     }
     LOG.info("{}; file omitted from listStatus as expected.", filePath);
   }
@@ -1626,10 +1628,10 @@ public static void 
checkListingContainsPath(S3AFileSystem fs, Path filePath)
         listStatusHasIt = true;
       }
     }
-    assertTrue("fs.listFiles didn't include " + filePath,
-          listFilesHasIt);
-    assertTrue("fs.listStatus didn't include " + filePath,
-          listStatusHasIt);
+    assertTrue(listFilesHasIt,
+        "fs.listFiles didn't include " + filePath);
+    assertTrue(listStatusHasIt,
+        "fs.listStatus didn't include " + filePath);
   }
 
   /**
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestListing.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestListing.java
index 38993b43ebf..01e44418778 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestListing.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestListing.java
@@ -20,8 +20,8 @@
 
 import java.util.NoSuchElementException;
 
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.RemoteIterator;
@@ -45,10 +45,10 @@ public void testProvidedFileStatusIteratorEnd() throws 
Exception {
     RemoteIterator<S3AFileStatus> it = Listing.toProvidedFileStatusIterator(
         statuses);
 
-    Assert.assertTrue("hasNext() should return true first time", it.hasNext());
-    Assert.assertEquals("first element from iterator",
-        s3aStatus, it.next());
-    Assert.assertFalse("hasNext() should now be false", it.hasNext());
+    Assertions.assertTrue(it.hasNext(), "hasNext() should return true first 
time");
+    Assertions.assertEquals(s3aStatus, it.next(),
+        "first element from iterator");
+    Assertions.assertFalse(it.hasNext(), "hasNext() should now be false");
     intercept(NoSuchElementException.class, it::next);
   }
 }
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AAWSCredentialsProvider.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AAWSCredentialsProvider.java
index 5d9d78aee68..fe926dec0c8 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AAWSCredentialsProvider.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AAWSCredentialsProvider.java
@@ -644,10 +644,10 @@ public void testConcurrentAuthentication() throws 
Throwable {
 
       for (Future<AwsCredentials> result : results) {
         AwsCredentials credentials = result.get();
-        assertEquals("Access key from credential provider",
-            "expectedAccessKey", credentials.accessKeyId());
-        assertEquals("Secret key from credential provider",
-            "expectedSecret", credentials.secretAccessKey());
+        assertEquals("expectedAccessKey", credentials.accessKeyId(),
+            "Access key from credential provider");
+        assertEquals("expectedSecret", credentials.secretAccessKey(),
+            "Secret key from credential provider");
       }
     } finally {
       pool.awaitTermination(TERMINATION_TIMEOUT, TimeUnit.SECONDS);
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ABlockOutputStream.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ABlockOutputStream.java
index a22b55155c9..703da8574c7 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ABlockOutputStream.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ABlockOutputStream.java
@@ -28,8 +28,8 @@
 import org.apache.hadoop.fs.s3a.test.MinimalWriteOperationHelperCallbacks;
 import org.apache.hadoop.fs.statistics.IOStatisticsContext;
 import org.apache.hadoop.util.Progressable;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import java.util.concurrent.ExecutorService;
 
@@ -76,7 +76,7 @@ private S3ABlockOutputStream.BlockOutputStreamBuilder 
mockS3ABuilder() {
     return builder;
   }
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     final S3ABlockOutputStream.BlockOutputStreamBuilder
         builder = mockS3ABuilder();
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ADeleteOnExit.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ADeleteOnExit.java
index 5b8e1dc4300..695222d01cf 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ADeleteOnExit.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ADeleteOnExit.java
@@ -35,7 +35,7 @@
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.mockito.ArgumentMatcher;
 
 
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AEndpointParsing.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AEndpointParsing.java
index 8a77c102ac6..8be0708cad5 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AEndpointParsing.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AEndpointParsing.java
@@ -19,7 +19,7 @@
 package org.apache.hadoop.fs.s3a;
 
 import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import software.amazon.awssdk.regions.Region;
 
 public class TestS3AEndpointParsing extends AbstractS3AMockTest {
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AGetFileStatus.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AGetFileStatus.java
index 1a2a21a6e51..c52fb96a0e2 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AGetFileStatus.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AGetFileStatus.java
@@ -18,7 +18,7 @@
 
 package org.apache.hadoop.fs.s3a;
 
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
 import static org.mockito.ArgumentMatchers.argThat;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.when;
@@ -42,7 +42,7 @@
 import org.apache.hadoop.fs.Path;
 
 import org.apache.hadoop.fs.contract.ContractTestUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.mockito.ArgumentMatcher;
 
 
@@ -66,9 +66,9 @@ public void testFile() throws Exception {
     assertEquals(objectMetadata.contentLength().longValue(), stat.getLen());
     assertEquals(Date.from(objectMetadata.lastModified()).getTime(), 
stat.getModificationTime());
     ContractTestUtils.assertNotErasureCoded(fs, path);
-    assertTrue(path + " should have erasure coding unset in " +
-            "FileStatus#toString(): " + stat,
-        stat.toString().contains("isErasureCoded=false"));
+    assertTrue(stat.toString().contains("isErasureCoded=false"),
+        path + " should have erasure coding unset in " +
+        "FileStatus#toString(): " + stat);
   }
 
   @Test
@@ -107,9 +107,9 @@ public void testImplicitDirectory() throws Exception {
     assertEquals(fs.makeQualified(path), stat.getPath());
     assertTrue(stat.isDirectory());
     ContractTestUtils.assertNotErasureCoded(fs, path);
-    assertTrue(path + " should have erasure coding unset in " +
-            "FileStatus#toString(): " + stat,
-        stat.toString().contains("isErasureCoded=false"));
+    assertTrue(stat.toString().contains("isErasureCoded=false"),
+        path + " should have erasure coding unset in " +
+        "FileStatus#toString(): " + stat);
   }
 
   @Test
@@ -131,16 +131,17 @@ public void testRoot() throws Exception {
 
   @Test
   public void testNotFound() throws Exception {
-    Path path = new Path("/dir");
-    String key = path.toUri().getPath().substring(1);
-    when(s3.headObject(argThat(correctGetMetadataRequest(BUCKET, key))))
-      .thenThrow(NOT_FOUND);
-    when(s3.headObject(argThat(
-      correctGetMetadataRequest(BUCKET, key + "/")
-    ))).thenThrow(NOT_FOUND);
-    setupListMocks(Collections.emptyList(), Collections.emptyList());
-    exception.expect(FileNotFoundException.class);
-    fs.getFileStatus(path);
+    assertThrows(FileNotFoundException.class, () -> {
+      Path path = new Path("/dir");
+      String key = path.toUri().getPath().substring(1);
+      when(s3.headObject(argThat(correctGetMetadataRequest(BUCKET, key))))
+          .thenThrow(NOT_FOUND);
+      when(s3.headObject(argThat(
+          correctGetMetadataRequest(BUCKET, key + "/")
+      ))).thenThrow(NOT_FOUND);
+      setupListMocks(Collections.emptyList(), Collections.emptyList());
+      fs.getFileStatus(path);
+    });
   }
 
   private void setupListMocks(List<CommonPrefix> prefixes,
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AInputPolicies.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AInputPolicies.java
index c0c8137aaf6..a58518fc3ce 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AInputPolicies.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AInputPolicies.java
@@ -18,10 +18,9 @@
 
 package org.apache.hadoop.fs.s3a;
 
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import java.util.Arrays;
 import java.util.Collection;
@@ -29,7 +28,6 @@
 /**
  * Unit test of the input policy logic, without making any S3 calls.
  */
-@RunWith(Parameterized.class)
 public class TestS3AInputPolicies {
 
   private S3AInputPolicy policy;
@@ -45,21 +43,20 @@ public class TestS3AInputPolicies {
   public static final long _1MB = 1024L * 1024;
   public static final long _10MB = _1MB * 10;
 
-  public TestS3AInputPolicies(S3AInputPolicy policy,
-      long targetPos,
-      long length,
-      long contentLength,
-      long readahead,
-      long expectedLimit) {
-    this.policy = policy;
-    this.targetPos = targetPos;
-    this.length = length;
-    this.contentLength = contentLength;
-    this.readahead = readahead;
-    this.expectedLimit = expectedLimit;
+  public void initTestS3AInputPolicies(S3AInputPolicy pPolicy,
+      long pTargetPos,
+      long pLength,
+      long pContentLength,
+      long pReadahead,
+      long pExpectedLimit) {
+    this.policy = pPolicy;
+    this.targetPos = pTargetPos;
+    this.length = pLength;
+    this.contentLength = pContentLength;
+    this.readahead = pReadahead;
+    this.expectedLimit = pExpectedLimit;
   }
 
-  @Parameterized.Parameters
   public static Collection<Object[]> data() {
     return Arrays.asList(new Object[][]{
         {S3AInputPolicy.Normal, 0, -1, 0, _64K, 0},
@@ -79,13 +76,18 @@ public static Collection<Object[]> data() {
     });
   }
 
-  @Test
-  public void testInputPolicies() throws Throwable {
-    Assert.assertEquals(
-        String.format("calculateRequestLimit(%s, %d, %d, %d, %d)",
-            policy, targetPos, length, contentLength, readahead),
+  @MethodSource("data")
+  @ParameterizedTest
+  public void testInputPolicies(S3AInputPolicy pPolicy,
+      long pTargetPos, long pLength, long pContentLength,
+      long pReadahead, long pExpectedLimit) throws Throwable {
+    initTestS3AInputPolicies(pPolicy, pTargetPos, pLength, pContentLength,
+        pReadahead, pExpectedLimit);
+    Assertions.assertEquals(
         expectedLimit,
         S3AInputStream.calculateRequestLimit(policy, targetPos,
-            length, contentLength, readahead));
+            length, contentLength, readahead),
+        String.format("calculateRequestLimit(%s, %d, %d, %d, %d)",
+            policy, targetPos, length, contentLength, readahead));
   }
 }
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AInputStreamRetry.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AInputStreamRetry.java
index 07f6550d83e..898431acc17 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AInputStreamRetry.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AInputStreamRetry.java
@@ -33,7 +33,7 @@
 import software.amazon.awssdk.http.AbortableInputStream;
 import software.amazon.awssdk.services.s3.model.GetObjectRequest;
 import software.amazon.awssdk.services.s3.model.GetObjectResponse;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.tuple.Pair;
@@ -49,8 +49,8 @@
 import static org.apache.hadoop.fs.s3a.S3ATestUtils.sdkClientException;
 import static 
org.apache.hadoop.fs.s3a.impl.InternalConstants.SC_416_RANGE_NOT_SATISFIABLE;
 import static org.apache.hadoop.util.functional.FutureIO.eval;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * Tests S3AInputStream retry behavior on read failure.
@@ -78,10 +78,12 @@ public class TestS3AInputStreamRetry extends 
AbstractS3AMockTest {
   public void testInputStreamReadRetryForException() throws IOException {
     S3AInputStream s3AInputStream = 
getMockedS3AInputStream(failingInputStreamCallbacks(
         awsServiceException(STATUS)));
-    assertEquals("'0' from the test input stream should be the first " +
-        "character being read", INPUT.charAt(0), s3AInputStream.read());
-    assertEquals("'1' from the test input stream should be the second " +
-        "character being read", INPUT.charAt(1), s3AInputStream.read());
+    assertEquals(INPUT.charAt(0), s3AInputStream.read(),
+        "'0' from the test input stream should be the first " +
+        "character being read");
+    assertEquals(INPUT.charAt(1), s3AInputStream.read(),
+        "'1' from the test input stream should be the second " +
+         "character being read");
   }
 
   @Test
@@ -92,8 +94,8 @@ public void testInputStreamReadLengthRetryForException() 
throws IOException {
     s3AInputStream.read(result, 0, INPUT.length());
 
     assertArrayEquals(
-        "The read result should equals to the test input stream content",
-        INPUT.getBytes(), result);
+        INPUT.getBytes(), result,
+        "The read result should equals to the test input stream content");
   }
 
   @Test
@@ -104,8 +106,8 @@ public void testInputStreamReadFullyRetryForException() 
throws IOException {
     s3AInputStream.readFully(0, result);
 
     assertArrayEquals(
-        "The read result should equals to the test input stream content",
-        INPUT.getBytes(), result);
+        INPUT.getBytes(), result,
+        "The read result should equals to the test input stream content");
   }
 
   /**
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AUnbuffer.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AUnbuffer.java
index eb7d5af9300..dd05e6f25e4 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AUnbuffer.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AUnbuffer.java
@@ -28,14 +28,14 @@
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.Path;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 
 import java.io.IOException;
 import java.io.InputStream;
 import java.time.Instant;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/adapter/TestV1CredentialsProvider.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/adapter/TestV1CredentialsProvider.java
index 48c1f5034c9..d4d2a16de1e 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/adapter/TestV1CredentialsProvider.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/adapter/TestV1CredentialsProvider.java
@@ -27,7 +27,7 @@
 import com.amazonaws.auth.AWSCredentials;
 import com.amazonaws.auth.AWSCredentialsProvider;
 import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
@@ -47,8 +47,8 @@
 import static 
org.apache.hadoop.fs.s3a.auth.CredentialProviderListFactory.ENVIRONMENT_CREDENTIALS_V1;
 import static 
org.apache.hadoop.fs.s3a.auth.CredentialProviderListFactory.createAWSCredentialProviderList;
 import static org.apache.hadoop.test.LambdaTestUtils.intercept;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Unit tests for v1 to v2 credential provider logic.
@@ -150,13 +150,12 @@ private static void assertCredentialProviders(
       Class<?> expectedClass =
           expectedClasses.get(i);
       AwsCredentialsProvider provider = providers.get(i);
-      assertNotNull(
+      assertNotNull(provider,
           String.format("At position %d, expected class is %s, but found 
null.",
-              i, expectedClass), provider);
-      assertTrue(
+          i, expectedClass));
+      assertTrue(expectedClass.isAssignableFrom(provider.getClass()),
           String.format("At position %d, expected class is %s, but found %s.",
-              i, expectedClass, provider.getClass()),
-          expectedClass.isAssignableFrom(provider.getClass()));
+          i, expectedClass, provider.getClass()));
     }
   }
 
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/ProgressCounter.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/ProgressCounter.java
index 362e674e13a..112a538cb87 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/ProgressCounter.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/ProgressCounter.java
@@ -22,7 +22,7 @@
 
 import org.apache.hadoop.util.Progressable;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * A progress callback for testing.
@@ -40,6 +40,6 @@ public long getCount() {
   }
 
   public void assertCount(String message, int expected) {
-    assertEquals(message, expected, getCount());
+    assertEquals(expected, getCount(), message);
   }
 }
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/RoleTestUtils.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/RoleTestUtils.java
index b0f685b0760..11600fc56ff 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/RoleTestUtils.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/RoleTestUtils.java
@@ -46,8 +46,8 @@
 import static org.apache.hadoop.fs.s3a.auth.RolePolicies.*;
 import static 
org.apache.hadoop.fs.s3a.auth.delegation.DelegationConstants.DELEGATION_TOKEN_BINDING;
 import static org.apache.hadoop.test.LambdaTestUtils.intercept;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Helper class for testing roles.
@@ -229,15 +229,14 @@ public static void assertCredentialsEqual(final String 
message,
       final MarshalledCredentials actual) {
     // DO NOT use assertEquals() here, as that could print a secret to
     // the test report.
-    assertEquals(message + ": access key",
-        expected.getAccessKey(),
-        actual.getAccessKey());
-    assertTrue(message + ": secret key",
-        expected.getSecretKey().equals(actual.getSecretKey()));
-    assertEquals(message + ": session token",
-        expected.getSessionToken(),
-        actual.getSessionToken());
-
+    assertEquals(expected.getAccessKey(),
+        actual.getAccessKey(),
+        message + ": access key");
+    assertTrue(expected.getSecretKey().equals(actual.getSecretKey()),
+        message + ": secret key");
+    assertEquals(expected.getSessionToken(),
+        actual.getSessionToken(),
+        message + ": session token");
   }
 
   /**
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/delegation/MiniKerberizedHadoopCluster.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/delegation/MiniKerberizedHadoopCluster.java
index 280c39b910d..6dd69fa1c2c 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/delegation/MiniKerberizedHadoopCluster.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/delegation/MiniKerberizedHadoopCluster.java
@@ -49,7 +49,7 @@
 import static 
org.apache.hadoop.mapreduce.v2.jobhistory.JHAdminConfig.DEFAULT_MR_HISTORY_PORT;
 import static 
org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytabAndReturnUGI;
 import static org.apache.hadoop.yarn.conf.YarnConfiguration.*;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * This is intended to support setting up an mini-secure Hadoop + YARN + MR
@@ -350,8 +350,8 @@ public void loginPrincipal() throws IOException {
    * General assertion that security is turred on for a cluster.
    */
   public static void assertSecurityEnabled() {
-    assertTrue("Security is needed for this test",
-        UserGroupInformation.isSecurityEnabled());
+    assertTrue(UserGroupInformation.isSecurityEnabled(),
+        "Security is needed for this test");
   }
 
 
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/delegation/TestS3ADelegationTokenSupport.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/delegation/TestS3ADelegationTokenSupport.java
index a06e9ac62ff..ffd22764c53 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/delegation/TestS3ADelegationTokenSupport.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/delegation/TestS3ADelegationTokenSupport.java
@@ -21,8 +21,8 @@
 import java.net.URI;
 import java.nio.charset.StandardCharsets;
 
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import org.apache.commons.codec.binary.Base64;
 import org.apache.hadoop.fs.s3a.S3AEncryptionMethods;
@@ -37,9 +37,9 @@
 
 import static 
org.apache.hadoop.fs.s3a.auth.delegation.DelegationConstants.FULL_TOKEN_KIND;
 import static 
org.apache.hadoop.fs.s3a.auth.delegation.DelegationConstants.SESSION_TOKEN_KIND;
-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;
 
 /**
  * Unit tests related to S3A DT support.
@@ -48,7 +48,7 @@ public class TestS3ADelegationTokenSupport {
 
   private static URI externalUri;
 
-  @BeforeClass
+  @BeforeAll
   public static void classSetup() throws Exception {
     externalUri = new URI(PublicDatasetTestUtils.DEFAULT_EXTERNAL_FILE);
   }
@@ -65,7 +65,7 @@ public void testSessionTokenIssueDate() throws Throwable {
     AbstractS3ATokenIdentifier identifier
         = new SessionTokenIdentifier();
     assertEquals(SESSION_TOKEN_KIND, identifier.getKind());
-    assertTrue("issue date is not set", identifier.getIssueDate() > 0L);
+    assertTrue(identifier.getIssueDate() > 0L, "issue date is not set");
   }
 
   @Test
@@ -91,21 +91,20 @@ public void testSessionTokenDecode() throws Throwable {
     decoded.validate();
     MarshalledCredentials creds
         = ((SessionTokenIdentifier) decoded).getMarshalledCredentials();
-    assertNotNull("credentials",
-        MarshalledCredentialBinding.toAWSCredentials(creds,
-        MarshalledCredentials.CredentialTypeRequired.AnyNonEmpty, ""));
+    assertNotNull(MarshalledCredentialBinding.toAWSCredentials(creds,
+        MarshalledCredentials.CredentialTypeRequired.AnyNonEmpty, ""),
+        "credentials");
     assertEquals(alice, decoded.getOwner());
     UserGroupInformation decodedUser = decoded.getUser();
-    assertEquals("name of " + decodedUser,
-        "alice",
-        decodedUser.getUserName());
-    assertEquals("renewer", renewer, decoded.getRenewer());
-    assertEquals("Authentication method of " + decodedUser,
-        UserGroupInformation.AuthenticationMethod.TOKEN,
-        decodedUser.getAuthenticationMethod());
+    assertEquals("alice",
+        decodedUser.getUserName(), "name of " + decodedUser);
+    assertEquals(renewer, decoded.getRenewer(), "renewer");
+    assertEquals(UserGroupInformation.AuthenticationMethod.TOKEN,
+        decodedUser.getAuthenticationMethod(),
+        "Authentication method of " + decodedUser);
     assertEquals("origin", decoded.getOrigin());
-    assertEquals("issue date", identifier.getIssueDate(),
-        decoded.getIssueDate());
+    assertEquals(identifier.getIssueDate(),
+        decoded.getIssueDate(), "issue date");
     EncryptionSecrets encryptionSecrets = decoded.getEncryptionSecrets();
     assertEquals(S3AEncryptionMethods.SSE_S3, 
encryptionSecrets.getEncryptionMethod());
     assertEquals(encryptionKey, encryptionSecrets.getEncryptionKey());
@@ -138,11 +137,11 @@ public void testSessionTokenIdentifierRoundTrip() throws 
Throwable {
 
     SessionTokenIdentifier result = S3ATestUtils.roundTrip(id, null);
     String ids = id.toString();
-    assertEquals("URI in " + ids, id.getUri(), result.getUri());
-    assertEquals("credentials in " + ids,
-        id.getMarshalledCredentials(),
-        result.getMarshalledCredentials());
-    assertEquals("renewer in " + ids, renewer, id.getRenewer());
+    assertEquals(id.getUri(), result.getUri(), "URI in " + ids);
+    assertEquals(id.getMarshalledCredentials(),
+        result.getMarshalledCredentials(),
+        "credentials in " + ids);
+    assertEquals(renewer, id.getRenewer(), "renewer in " + ids);
     EncryptionSecrets encryptionSecrets = result.getEncryptionSecrets();
     assertEquals(S3AEncryptionMethods.DSSE_KMS, 
encryptionSecrets.getEncryptionMethod());
     assertEquals(encryptionKey, encryptionSecrets.getEncryptionKey());
@@ -161,11 +160,11 @@ public void 
testSessionTokenIdentifierRoundTripNoRenewer() throws Throwable {
 
     SessionTokenIdentifier result = S3ATestUtils.roundTrip(id, null);
     String ids = id.toString();
-    assertEquals("URI in " + ids, id.getUri(), result.getUri());
-    assertEquals("credentials in " + ids,
-        id.getMarshalledCredentials(),
-        result.getMarshalledCredentials());
-    assertEquals("renewer in " + ids, new Text(), id.getRenewer());
+    assertEquals(id.getUri(), result.getUri(), "URI in " + ids);
+    assertEquals(id.getMarshalledCredentials(),
+        result.getMarshalledCredentials(),
+        "credentials in " + ids);
+    assertEquals(new Text(), id.getRenewer(), "renewer in " + ids);
   }
 
   @Test
@@ -179,11 +178,11 @@ public void testRoleTokenIdentifierRoundTrip() throws 
Throwable {
 
     RoleTokenIdentifier result = S3ATestUtils.roundTrip(id, null);
     String ids = id.toString();
-    assertEquals("URI in " + ids, id.getUri(), result.getUri());
-    assertEquals("credentials in " + ids,
-        id.getMarshalledCredentials(),
-        result.getMarshalledCredentials());
-    assertEquals("renewer in " + ids, new Text(), id.getRenewer());
+    assertEquals(id.getUri(), result.getUri(), "URI in " + ids);
+    assertEquals(id.getMarshalledCredentials(),
+        result.getMarshalledCredentials(),
+        "credentials in " + ids);
+    assertEquals(new Text(), id.getRenewer(), "renewer in " + ids);
   }
 
   @Test
@@ -198,11 +197,11 @@ public void testFullTokenIdentifierRoundTrip() throws 
Throwable {
 
     FullCredentialsTokenIdentifier result = S3ATestUtils.roundTrip(id, null);
     String ids = id.toString();
-    assertEquals("URI in " + ids, id.getUri(), result.getUri());
-    assertEquals("credentials in " + ids,
-        id.getMarshalledCredentials(),
-        result.getMarshalledCredentials());
-    assertEquals("renewer in " + ids, renewer, result.getRenewer());
+    assertEquals(id.getUri(), result.getUri(), "URI in " + ids);
+    assertEquals(id.getMarshalledCredentials(),
+        result.getMarshalledCredentials(),
+        "credentials in " + ids);
+    assertEquals(renewer, result.getRenewer(), "renewer in " + ids);
   }
 
   /**
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/AbstractITCommitProtocol.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/AbstractITCommitProtocol.java
index 3921c640a22..5fc5cf9eb99 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/AbstractITCommitProtocol.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/AbstractITCommitProtocol.java
@@ -733,8 +733,8 @@ private void validateContent(Path dir,
     expectedOutput.append(KEY_1).append("\n");
     expectedOutput.append(KEY_2).append('\t').append(VAL_2).append("\n");
     String output = readFile(expectedFile);
-    assertEquals("Content of " + expectedFile,
-        expectedOutput.toString(), output);
+    assertEquals(expectedOutput.toString(), output,
+        "Content of " + expectedFile);
   }
 
   /**
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/TestMagicCommitPaths.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/TestMagicCommitPaths.java
index 610491867f8..44907cd23cc 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/TestMagicCommitPaths.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/TestMagicCommitPaths.java
@@ -23,8 +23,8 @@
 import java.util.List;
 
 import org.apache.hadoop.util.Lists;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 import org.apache.hadoop.fs.Path;
 
@@ -35,7 +35,7 @@
 /**
  * Tests for {@link MagicCommitPaths} path operations.
  */
-public class TestMagicCommitPaths extends Assert {
+public class TestMagicCommitPaths extends Assertions {
 
   private static final List<String> MAGIC_AT_ROOT =
       list(MAGIC_PATH_PREFIX);
@@ -176,9 +176,11 @@ public void testFinalDestinationRootMagic2() {
         finalDestination(l(MAGIC_PATH_PREFIX, "2", "3.txt")));
   }
 
-  @Test(expected = IllegalArgumentException.class)
+  @Test
   public void testFinalDestinationMagicNoChild() {
-    finalDestination(l(MAGIC_PATH_PREFIX));
+    Assertions.assertThrows(IllegalArgumentException.class, () -> {
+      finalDestination(l(MAGIC_PATH_PREFIX));
+    });
   }
 
   @Test
@@ -186,9 +188,11 @@ public void testFinalDestinationBaseDirectChild() {
     finalDestination(l(MAGIC_PATH_PREFIX, BASE, "3.txt"));
   }
 
-  @Test(expected = IllegalArgumentException.class)
+  @Test
   public void testFinalDestinationBaseNoChild() {
-    assertEquals(l(), finalDestination(l(MAGIC_PATH_PREFIX, BASE)));
+    Assertions.assertThrows(IllegalArgumentException.class, () -> {
+      assertEquals(l(), finalDestination(l(MAGIC_PATH_PREFIX, BASE)));
+    });
   }
 
   @Test
@@ -235,8 +239,8 @@ public void assertChildren(String[] expected, List<String> 
elements) {
 
   private void assertPathSplits(String pathString, String[] expected) {
     Path path = new Path(pathString);
-    assertArrayEquals("From path " + path, expected,
-        splitPathToElements(path).toArray());
+    assertArrayEquals(expected,
+        splitPathToElements(path).toArray(), "From path " + path);
   }
 
   private void assertListEquals(String[] expected, List<String> actual) {
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/TestMagicCommitTrackerUtils.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/TestMagicCommitTrackerUtils.java
index a08f8d2d34b..fd82c34c8e0 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/TestMagicCommitTrackerUtils.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/TestMagicCommitTrackerUtils.java
@@ -26,10 +26,10 @@
 import org.apache.hadoop.mapreduce.TaskAttemptContext;
 import org.apache.hadoop.mapreduce.TaskAttemptID;
 import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-import static junit.framework.TestCase.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.apache.hadoop.fs.s3a.commit.AbstractCommitITest.randomJobId;
 
 /**
@@ -43,7 +43,7 @@ public final class TestMagicCommitTrackerUtils {
   private static final Path DEST_PATH = new 
Path("s3://dummyBucket/dummyTable");
 
 
-  @Before
+  @BeforeEach
   public void setup() throws Exception {
     jobId = randomJobId();
     attemptId = "attempt_" + jobId + "_m_000000_0";
@@ -57,8 +57,9 @@ public void testExtractTaskAttemptIdFromPath() {
         taskAttemptId);
     Path path = CommitUtilsWithMR
         .getBaseMagicTaskAttemptPath(taskAttemptContext, "00001", DEST_PATH);
-    assertEquals("TaskAttemptId didn't match", attemptId,
-        MagicCommitTrackerUtils.extractTaskAttemptIdFromPath(path));
+    assertEquals(attemptId,
+        MagicCommitTrackerUtils.extractTaskAttemptIdFromPath(path),
+        "TaskAttemptId didn't match");
 
   }
 }
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/magic/ITestMagicCommitProtocol.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/magic/ITestMagicCommitProtocol.java
index 3d852b023c2..b2c8ab28efa 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/magic/ITestMagicCommitProtocol.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/magic/ITestMagicCommitProtocol.java
@@ -171,9 +171,9 @@ protected void validateTaskAttemptWorkingDirectory(
       final AbstractS3ACommitter committer,
       final TaskAttemptContext context) throws IOException {
     URI wd = committer.getWorkPath().toUri();
-    assertEquals("Wrong schema for working dir " + wd
-        + " with committer " + committer,
-        "s3a", wd.getScheme());
+    assertEquals("s3a", wd.getScheme(),
+        "Wrong schema for working dir " + wd
+        + " with committer " + committer);
     Assertions.assertThat(wd.getPath())
         .contains("/" + MAGIC_PATH_PREFIX + committer.getUUID() + "/");
   }
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/fileContext/ITestS3AFileContext.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/fileContext/ITestS3AFileContext.java
index d29a017a643..1d36600cfb2 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/fileContext/ITestS3AFileContext.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/fileContext/ITestS3AFileContext.java
@@ -16,7 +16,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileContext;
@@ -24,7 +24,7 @@
 import org.apache.hadoop.fs.TestFileContext;
 import org.apache.hadoop.fs.UnsupportedFileSystemException;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * Implementation of TestFileContext for S3a.
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/impl/ITestS3AConditionalCreateBehavior.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/impl/ITestS3AConditionalCreateBehavior.java
index 8528e4779c2..c20b6f7831d 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/impl/ITestS3AConditionalCreateBehavior.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/impl/ITestS3AConditionalCreateBehavior.java
@@ -22,8 +22,8 @@
 import java.util.Collection;
 
 import org.assertj.core.api.Assertions;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
@@ -110,7 +110,7 @@ public Configuration createConfiguration() {
     return conf;
   }
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     super.setup();
   }
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/impl/ITestS3APutIfMatchAndIfNoneMatch.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/impl/ITestS3APutIfMatchAndIfNoneMatch.java
index 7939b39935b..1e9bd850bc0 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/impl/ITestS3APutIfMatchAndIfNoneMatch.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/impl/ITestS3APutIfMatchAndIfNoneMatch.java
@@ -23,8 +23,8 @@
 import java.nio.charset.StandardCharsets;
 
 import org.assertj.core.api.Assertions;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 import software.amazon.awssdk.services.s3.model.S3Exception;
 
 import org.apache.commons.io.IOUtils;
@@ -552,7 +552,7 @@ public void 
testIfMatchTwoMultipartUploadsRaceConditionOneClosesFirst() throws T
     assertS3ExceptionStatusCode(SC_412_PRECONDITION_FAILED, exception);
   }
 
-  @Ignore("conditional_write statistics not yet fully implemented")
+  @Disabled("conditional_write statistics not yet fully implemented")
   @Test
   public void testConditionalWriteStatisticsWithoutIfNoneMatch() throws 
Throwable {
     FileSystem fs = getFileSystem();
@@ -598,7 +598,7 @@ public void 
testConditionalWriteStatisticsWithoutIfNoneMatch() throws Throwable
     verifyStatisticCounterValue(statistics.getIOStatistics(), 
Statistic.CONDITIONAL_CREATE_FAILED.getSymbol(), 0);
   }
 
-  @Ignore("conditional_write statistics not yet fully implemented")
+  @Disabled("conditional_write statistics not yet fully implemented")
   @Test
   public void testConditionalWriteStatisticsWithIfNoneMatch() throws Throwable 
{
     FileSystem fs = getFileSystem();
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/impl/TestS3AEncryption.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/impl/TestS3AEncryption.java
index a9d83819fda..970562c32a9 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/impl/TestS3AEncryption.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/impl/TestS3AEncryption.java
@@ -24,8 +24,8 @@
 
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 import org.apache.commons.codec.binary.Base64;
 import org.apache.hadoop.conf.Configuration;
@@ -43,7 +43,7 @@ public void testGetS3EncryptionContextPerBucket() throws 
IOException {
     configuration.set("fs.s3a.bucket.bucket1.encryption.context", 
BUCKET_CONTEXT);
     configuration.set(S3_ENCRYPTION_CONTEXT, GLOBAL_CONTEXT);
     final String result = S3AEncryption.getS3EncryptionContext("bucket1", 
configuration);
-    Assert.assertEquals(BUCKET_CONTEXT, result);
+    Assertions.assertEquals(BUCKET_CONTEXT, result);
   }
 
   @Test
@@ -52,14 +52,14 @@ public void testGetS3EncryptionContextFromGlobal() throws 
IOException {
     configuration.set("fs.s3a.bucket.bucket1.encryption.context", 
BUCKET_CONTEXT);
     configuration.set(S3_ENCRYPTION_CONTEXT, GLOBAL_CONTEXT);
     final String result = S3AEncryption.getS3EncryptionContext("bucket2", 
configuration);
-    Assert.assertEquals(GLOBAL_CONTEXT.trim(), result);
+    Assertions.assertEquals(GLOBAL_CONTEXT.trim(), result);
   }
 
   @Test
   public void testGetS3EncryptionContextNoSet() throws IOException {
     Configuration configuration = new Configuration(false);
     final String result = S3AEncryption.getS3EncryptionContext("bucket1", 
configuration);
-    Assert.assertEquals("", result);
+    Assertions.assertEquals("", result);
   }
 
   @Test
@@ -71,7 +71,7 @@ public void testGetS3EncryptionContextBase64Encoded() throws 
IOException {
     final String decoded = new String(Base64.decodeBase64(result), 
StandardCharsets.UTF_8);
     final TypeReference<Map<String, String>> typeRef = new 
TypeReference<Map<String, String>>() {};
     final Map<String, String> resultMap = new 
ObjectMapper().readValue(decoded, typeRef);
-    Assert.assertEquals("hadoop", resultMap.get("project"));
-    Assert.assertEquals("HADOOP-19197", resultMap.get("jira"));
+    Assertions.assertEquals("hadoop", resultMap.get("project"));
+    Assertions.assertEquals("HADOOP-19197", resultMap.get("jira"));
   }
 }
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/s3guard/S3GuardToolTestHelper.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/s3guard/S3GuardToolTestHelper.java
index 89b4051de87..a468d3c7faf 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/s3guard/S3GuardToolTestHelper.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/s3guard/S3GuardToolTestHelper.java
@@ -30,7 +30,7 @@
 import org.apache.hadoop.util.ExitUtil;
 
 import static org.apache.hadoop.test.LambdaTestUtils.intercept;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * Helper class for tests which make CLI invocations of the S3Guard tools.
@@ -128,7 +128,7 @@ public static void exec(final int expectedResult,
     if (expectedResult != r) {
       String message = errorText.isEmpty() ? "" : (errorText + ": ")
           + "Command " + cmd + " failed\n" + buf;
-      assertEquals(message, expectedResult, r);
+      assertEquals(expectedResult, r, message);
     }
   }
 
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/s3guard/TestS3GuardCLI.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/s3guard/TestS3GuardCLI.java
index 26ccf1284ef..8df8bd3abf5 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/s3guard/TestS3GuardCLI.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/s3guard/TestS3GuardCLI.java
@@ -18,8 +18,8 @@
 
 package org.apache.hadoop.fs.s3a.s3guard;
 
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.test.LambdaTestUtils;
@@ -30,7 +30,7 @@
 /**
  * Test the S3Guard CLI entry point.
  */
-public class TestS3GuardCLI extends Assert {
+public class TestS3GuardCLI extends Assertions {
 
   /**
    * Run a S3GuardTool command from a varags list.
diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/test/ExtraAssertions.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/test/ExtraAssertions.java
index fdf5eb53e18..264d709ca40 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/test/ExtraAssertions.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/test/ExtraAssertions.java
@@ -24,7 +24,6 @@
 import java.util.stream.Collectors;
 
 import org.assertj.core.api.Assertions;
-import org.junit.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,7 +36,7 @@
 import org.apache.hadoop.util.DurationInfo;
 
 import static org.apache.hadoop.fs.s3a.S3AUtils.applyLocatedFiles;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Some extra assertions for tests.
@@ -73,7 +72,7 @@ public static void assertFileCount(final String message,
     long actual = files.size();
     if (actual != expected) {
       String ls = files.stream().collect(Collectors.joining("\n"));
-      Assert.fail(message + ": expected " + expected + " files in " + path
+      Assertions.fail(message + ": expected " + expected + " files in " + path
           + " but got " + actual + "\n" + ls);
     }
   }
@@ -84,8 +83,8 @@ public static void assertFileCount(final String message,
    * @param contained text to look for.
    */
   public static void assertTextContains(String text, String contained) {
-    assertTrue("string \"" + contained + "\" not found in \"" + text + "\"",
-        text != null && text.contains(contained));
+    assertTrue(text != null && text.contains(contained),
+        "string \"" + contained + "\" not found in \"" + text + "\"");
   }
 
   /**


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to