Browse Source

HADOOP-19415. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-common Part8. (#7667)

Co-authored-by: Chris Nauroth <cnauroth@apache.org>
Co-authored-by: Hualong Zhang <hualong.z@hotmail.com>
Reviewed-by: Chris Nauroth <cnauroth@apache.org>
Reviewed-by: Hualong Zhang <hualong.z@hotmail.com>
Signed-off-by: Shilun Fan <slfan1989@apache.org>
slfan1989 1 month ago
parent
commit
f62fb77ad9
44 changed files with 1572 additions and 1356 deletions
  1. 1 1
      hadoop-cloud-storage-project/hadoop-huaweicloud/src/test/java/org/apache/hadoop/fs/obs/TestOBSFSMainOperations.java
  2. 27 24
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FCStatisticsBaseTest.java
  3. 162 159
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FSMainOperationsBaseTest.java
  4. 15 14
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextCreateMkdirBaseTest.java
  5. 216 197
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextMainOperationsBaseTest.java
  6. 14 11
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextTestHelper.java
  7. 14 11
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextTestWrapper.java
  8. 92 88
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextURIBase.java
  9. 137 73
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/SymlinkBaseTest.java
  10. 2 2
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFSFileContextCreateMkdir.java
  11. 7 6
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFSFileContextMainOperations.java
  12. 8 7
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFsFCStatistics.java
  13. 12 8
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestSymlinkLocalFS.java
  14. 2 2
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestSymlinkLocalFSFileContext.java
  15. 21 15
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestSymlinkLocalFSFileSystem.java
  16. 4 11
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestFSMainOperationsLocalFileSystem.java
  17. 4 4
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestFcCreateMkdirLocalFs.java
  18. 4 4
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestFcMainOperationsLocalFs.java
  19. 4 4
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsLocalFs.java
  20. 16 17
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsWithAuthorityLocalFs.java
  21. 313 237
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java
  22. 28 17
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestSymlinkHdfs.java
  23. 7 5
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestSymlinkHdfsFileContext.java
  24. 22 15
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestSymlinkHdfsFileSystem.java
  25. 236 236
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java
  26. 24 20
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZonesWithKMS.java
  27. 37 27
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestReservedRawPaths.java
  28. 35 38
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestReencryption.java
  29. 6 6
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestReencryptionWithKMS.java
  30. 28 26
      hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestFSMainOperationsWebHdfs.java
  31. 2 2
      hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/fileContext/TestOSSFileContextCreateMkdir.java
  32. 8 8
      hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/fileContext/TestOSSFileContextMainOperations.java
  33. 8 7
      hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/fileContext/TestOSSFileContextStatistics.java
  34. 5 5
      hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/fileContext/TestOSSFileContextURI.java
  35. 6 7
      hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AFSMainOperations.java
  36. 2 2
      hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/fileContext/ITestS3AFileContextCreateMkdir.java
  37. 3 3
      hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/fileContext/ITestS3AFileContextCreateMkdirCreatePerf.java
  38. 8 8
      hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/fileContext/ITestS3AFileContextMainOperations.java
  39. 8 8
      hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/fileContext/ITestS3AFileContextStatistics.java
  40. 5 5
      hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/fileContext/ITestS3AFileContextURI.java
  41. 5 4
      hadoop-tools/hadoop-azure-datalake/src/test/java/org/apache/hadoop/fs/adl/live/TestAdlFileContextCreateMkdirLive.java
  42. 9 8
      hadoop-tools/hadoop-azure-datalake/src/test/java/org/apache/hadoop/fs/adl/live/TestAdlFileContextMainOperationsLive.java
  43. 2 0
      hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestNativeAzureFileSystemOperationsMocked.java
  44. 3 4
      hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemMainOperation.java

+ 1 - 1
hadoop-cloud-storage-project/hadoop-huaweicloud/src/test/java/org/apache/hadoop/fs/obs/TestOBSFSMainOperations.java

@@ -72,7 +72,7 @@ public class TestOBSFSMainOperations extends
 
   @Override
   public void testGlobStatusThrowsExceptionForUnreadableDir() {
-    Assume.assumeTrue("unspport.", false);
+    assumeTrue(false, "unspport.");
   }
 
   @Override

+ 27 - 24
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FCStatisticsBaseTest.java

@@ -19,6 +19,7 @@
 package org.apache.hadoop.fs;
 
 import static org.apache.hadoop.fs.FileContextTestHelper.createFile;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.io.IOException;
 import java.net.URI;
@@ -34,8 +35,8 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.hadoop.fs.FileSystem.Statistics;
 import org.apache.hadoop.test.GenericTestUtils;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 
 import java.util.function.Supplier;
 import org.apache.hadoop.thirdparty.com.google.common.util.concurrent.Uninterruptibles;
@@ -59,17 +60,18 @@ public abstract class FCStatisticsBaseTest {
   //fc should be set appropriately by the deriving test.
   protected static FileContext fc = null;
   
-  @Test(timeout=60000)
+  @Test
+  @Timeout(value = 60)
   public void testStatisticsOperations() throws Exception {
     final Statistics stats = new Statistics("file");
-    Assert.assertEquals(0L, stats.getBytesRead());
-    Assert.assertEquals(0L, stats.getBytesWritten());
-    Assert.assertEquals(0, stats.getWriteOps());
+    assertEquals(0L, stats.getBytesRead());
+    assertEquals(0L, stats.getBytesWritten());
+    assertEquals(0, stats.getWriteOps());
     stats.incrementBytesWritten(1000);
-    Assert.assertEquals(1000L, stats.getBytesWritten());
-    Assert.assertEquals(0, stats.getWriteOps());
+    assertEquals(1000L, stats.getBytesWritten());
+    assertEquals(0, stats.getWriteOps());
     stats.incrementWriteOps(123);
-    Assert.assertEquals(123, stats.getWriteOps());
+    assertEquals(123, stats.getWriteOps());
     
     Thread thread = new Thread() {
       @Override
@@ -79,33 +81,33 @@ public abstract class FCStatisticsBaseTest {
     };
     thread.start();
     Uninterruptibles.joinUninterruptibly(thread);
-    Assert.assertEquals(124, stats.getWriteOps());
+    assertEquals(124, stats.getWriteOps());
     // Test copy constructor and reset function
     Statistics stats2 = new Statistics(stats);
     stats.reset();
-    Assert.assertEquals(0, stats.getWriteOps());
-    Assert.assertEquals(0L, stats.getBytesWritten());
-    Assert.assertEquals(0L, stats.getBytesRead());
-    Assert.assertEquals(124, stats2.getWriteOps());
-    Assert.assertEquals(1000L, stats2.getBytesWritten());
-    Assert.assertEquals(0L, stats2.getBytesRead());
+    assertEquals(0, stats.getWriteOps());
+    assertEquals(0L, stats.getBytesWritten());
+    assertEquals(0L, stats.getBytesRead());
+    assertEquals(124, stats2.getWriteOps());
+    assertEquals(1000L, stats2.getBytesWritten());
+    assertEquals(0L, stats2.getBytesRead());
   }
 
   @Test
   public void testStatistics() throws IOException, URISyntaxException {
     URI fsUri = getFsUri();
     Statistics stats = FileContext.getStatistics(fsUri);
-    Assert.assertEquals(0, stats.getBytesRead());
+    assertEquals(0, stats.getBytesRead());
     Path filePath = fileContextTestHelper .getTestRootPath(fc, "file1");
     createFile(fc, filePath, numBlocks, blockSize);
 
-    Assert.assertEquals(0, stats.getBytesRead());
+    assertEquals(0, stats.getBytesRead());
     verifyWrittenBytes(stats);
     FSDataInputStream fstr = fc.open(filePath);
     byte[] buf = new byte[blockSize];
     int bytesRead = fstr.read(buf, 0, blockSize);
     fstr.read(0, buf, 0, blockSize);
-    Assert.assertEquals(blockSize, bytesRead);
+    assertEquals(blockSize, bytesRead);
     verifyReadBytes(stats);
     verifyWrittenBytes(stats);
     verifyReadBytes(FileContext.getStatistics(getFsUri()));
@@ -115,7 +117,8 @@ public abstract class FCStatisticsBaseTest {
     fc.delete(filePath, true);
   }
 
-  @Test(timeout=70000)
+  @Test
+  @Timeout(value = 70)
   public void testStatisticsThreadLocalDataCleanUp() throws Exception {
     final Statistics stats = new Statistics("test");
     // create a small thread pool to test the statistics
@@ -136,8 +139,8 @@ public abstract class FCStatisticsBaseTest {
     // assert that the data size is exactly the number of threads
     final AtomicInteger allDataSize = new AtomicInteger(0);
     allDataSize.set(stats.getAllThreadLocalDataSize());
-    Assert.assertEquals(size, allDataSize.get());
-    Assert.assertEquals(size, stats.getReadOps());
+    assertEquals(size, allDataSize.get());
+    assertEquals(size, stats.getReadOps());
     // force the GC to collect the threads by shutting down the thread pool
     es.shutdownNow();
     es.awaitTermination(1, TimeUnit.MINUTES);
@@ -160,8 +163,8 @@ public abstract class FCStatisticsBaseTest {
             return false;
           }
         }, 500, 60*1000);
-    Assert.assertEquals(0, allDataSize.get());
-    Assert.assertEquals(size, stats.getReadOps());
+    assertEquals(0, allDataSize.get());
+    assertEquals(size, stats.getReadOps());
   }
 
   /**

+ 162 - 159
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FSMainOperationsBaseTest.java

@@ -18,20 +18,24 @@
 
 package org.apache.hadoop.fs;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
 
-
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Options.Rename;
 import org.apache.hadoop.fs.permission.FsPermission;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.eclipse.jetty.util.log.Log;
 
 /**
@@ -94,13 +98,13 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
       super(testRootDir);
   }
   
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     fSys = createFileSystem();
     fSys.mkdirs(getTestRootPath(fSys, "test"));
   }
   
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     if (fSys != null) {
       fSys.delete(new Path(getAbsoluteTestRootPath(fSys), new Path("test")), true);
@@ -126,11 +130,11 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
   @Test
   public void testFsStatus() throws Exception {
     FsStatus fsStatus = fSys.getStatus(null);
-    Assert.assertNotNull(fsStatus);
+    assertNotNull(fsStatus);
     //used, free and capacity are non-negative longs
-    Assert.assertTrue(fsStatus.getUsed() >= 0);
-    Assert.assertTrue(fsStatus.getRemaining() >= 0);
-    Assert.assertTrue(fsStatus.getCapacity() >= 0);
+    assertTrue(fsStatus.getUsed() >= 0);
+    assertTrue(fsStatus.getRemaining() >= 0);
+    assertTrue(fsStatus.getCapacity() >= 0);
   }
   
   @Test
@@ -139,31 +143,31 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     // First we cd to our test root
     Path workDir = new Path(getAbsoluteTestRootPath(fSys), new Path("test"));
     fSys.setWorkingDirectory(workDir);
-    Assert.assertEquals(workDir, fSys.getWorkingDirectory());
+    assertEquals(workDir, fSys.getWorkingDirectory());
 
     fSys.setWorkingDirectory(new Path("."));
-    Assert.assertEquals(workDir, fSys.getWorkingDirectory());
+    assertEquals(workDir, fSys.getWorkingDirectory());
 
     fSys.setWorkingDirectory(new Path(".."));
-    Assert.assertEquals(workDir.getParent(), fSys.getWorkingDirectory());
+    assertEquals(workDir.getParent(), fSys.getWorkingDirectory());
     
     // cd using a relative path
 
     // Go back to our test root
     workDir = new Path(getAbsoluteTestRootPath(fSys), new Path("test"));
     fSys.setWorkingDirectory(workDir);
-    Assert.assertEquals(workDir, fSys.getWorkingDirectory());
+    assertEquals(workDir, fSys.getWorkingDirectory());
     
     Path relativeDir = new Path("existingDir1");
     Path absoluteDir = new Path(workDir,"existingDir1");
     fSys.mkdirs(absoluteDir);
     fSys.setWorkingDirectory(relativeDir);
-    Assert.assertEquals(absoluteDir, fSys.getWorkingDirectory());
+    assertEquals(absoluteDir, fSys.getWorkingDirectory());
     // cd using a absolute path
     absoluteDir = getTestRootPath(fSys, "test/existingDir2");
     fSys.mkdirs(absoluteDir);
     fSys.setWorkingDirectory(absoluteDir);
-    Assert.assertEquals(absoluteDir, fSys.getWorkingDirectory());
+    assertEquals(absoluteDir, fSys.getWorkingDirectory());
     
     // Now open a file relative to the wd we just set above.
     Path absolutePath = new Path(absoluteDir, "foo");
@@ -173,7 +177,7 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     
     // Now mkdir relative to the dir we cd'ed to
     fSys.mkdirs(new Path("newDir"));
-    Assert.assertTrue(isDir(fSys, new Path(absoluteDir, "newDir")));
+    assertTrue(isDir(fSys, new Path(absoluteDir, "newDir")));
 
     /**
      * We cannot test this because FileSystem has never checked for
@@ -182,7 +186,7 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     absoluteDir = getTestRootPath(fSys, "nonexistingPath");
     try {
       fSys.setWorkingDirectory(absoluteDir);
-      Assert.fail("cd to non existing dir should have failed");
+      fail("cd to non existing dir should have failed");
     } catch (Exception e) {
       // Exception as expected
     }
@@ -197,61 +201,61 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     Path absoluteDir = getTestRootPath(fSys, "test/existingDir");
     fSys.mkdirs(absoluteDir);
     fSys.setWorkingDirectory(absoluteDir);
-    Assert.assertEquals(absoluteDir, fSys.getWorkingDirectory());
+    assertEquals(absoluteDir, fSys.getWorkingDirectory());
   }
   
   @Test
   public void testMkdirs() throws Exception {
     Path testDir = getTestRootPath(fSys, "test/hadoop");
-    Assert.assertFalse(exists(fSys, testDir));
-    Assert.assertFalse(isFile(fSys, testDir));
+    assertFalse(exists(fSys, testDir));
+    assertFalse(isFile(fSys, testDir));
 
     fSys.mkdirs(testDir);
 
-    Assert.assertTrue(exists(fSys, testDir));
-    Assert.assertFalse(isFile(fSys, testDir));
+    assertTrue(exists(fSys, testDir));
+    assertFalse(isFile(fSys, testDir));
     
     fSys.mkdirs(testDir);
 
-    Assert.assertTrue(exists(fSys, testDir));
-    Assert.assertFalse(isFile(fSys, testDir));
+    assertTrue(exists(fSys, testDir));
+    assertFalse(isFile(fSys, testDir));
 
     Path parentDir = testDir.getParent();
-    Assert.assertTrue(exists(fSys, parentDir));
-    Assert.assertFalse(isFile(fSys, parentDir));
+    assertTrue(exists(fSys, parentDir));
+    assertFalse(isFile(fSys, parentDir));
 
     Path grandparentDir = parentDir.getParent();
-    Assert.assertTrue(exists(fSys, grandparentDir));
-    Assert.assertFalse(isFile(fSys, grandparentDir));
+    assertTrue(exists(fSys, grandparentDir));
+    assertFalse(isFile(fSys, grandparentDir));
     
   }
   
   @Test
   public void testMkdirsFailsForSubdirectoryOfExistingFile() throws Exception {
     Path testDir = getTestRootPath(fSys, "test/hadoop");
-    Assert.assertFalse(exists(fSys, testDir));
+    assertFalse(exists(fSys, testDir));
     fSys.mkdirs(testDir);
-    Assert.assertTrue(exists(fSys, testDir));
+    assertTrue(exists(fSys, testDir));
     
     createFile(getTestRootPath(fSys, "test/hadoop/file"));
     
     Path testSubDir = getTestRootPath(fSys, "test/hadoop/file/subdir");
     try {
       fSys.mkdirs(testSubDir);
-      Assert.fail("Should throw IOException.");
+      fail("Should throw IOException.");
     } catch (IOException e) {
       // expected
     }
-    Assert.assertFalse(exists(fSys, testSubDir));
+    assertFalse(exists(fSys, testSubDir));
     
     Path testDeepSubDir = getTestRootPath(fSys, "test/hadoop/file/deep/sub/dir");
     try {
       fSys.mkdirs(testDeepSubDir);
-      Assert.fail("Should throw IOException.");
+      fail("Should throw IOException.");
     } catch (IOException e) {
       // expected
     }
-    Assert.assertFalse(exists(fSys, testDeepSubDir));
+    assertFalse(exists(fSys, testDeepSubDir));
     
   }
   
@@ -260,7 +264,7 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     throws Exception {
     try {
       fSys.getFileStatus(getTestRootPath(fSys, "test/hadoop/file"));
-      Assert.fail("Should throw FileNotFoundException");
+      fail("Should throw FileNotFoundException");
     } catch (FileNotFoundException e) {
       // expected
     }
@@ -271,7 +275,7 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
   throws Exception {
     try {
       fSys.listStatus(getTestRootPath(fSys, "test/hadoop/file"));
-      Assert.fail("Should throw FileNotFoundException");
+      fail("Should throw FileNotFoundException");
     } catch (FileNotFoundException fnfe) {
       // expected
     }
@@ -287,7 +291,7 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     fSys.setPermission(obscuredDir, new FsPermission((short)0)); //no access
     try {
       fSys.listStatus(obscuredDir);
-      Assert.fail("Should throw IOException");
+      fail("Should throw IOException");
     } catch (IOException ioe) {
       // expected
     } finally {
@@ -303,7 +307,7 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
         getTestRootPath(fSys, "test/hadoop/a"),
         getTestRootPath(fSys, "test/hadoop/b"),
         getTestRootPath(fSys, "test/hadoop/c/1"), };
-    Assert.assertFalse(exists(fSys, testDirs[0]));
+    assertFalse(exists(fSys, testDirs[0]));
 
     for (Path path : testDirs) {
       fSys.mkdirs(path);
@@ -311,21 +315,21 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
 
     // test listStatus that returns an array
     FileStatus[] paths = fSys.listStatus(getTestRootPath(fSys, "test"));
-    Assert.assertEquals(1, paths.length);
-    Assert.assertEquals(getTestRootPath(fSys, "test/hadoop"), paths[0].getPath());
+    assertEquals(1, paths.length);
+    assertEquals(getTestRootPath(fSys, "test/hadoop"), paths[0].getPath());
 
     paths = fSys.listStatus(getTestRootPath(fSys, "test/hadoop"));
-    Assert.assertEquals(3, paths.length);
+    assertEquals(3, paths.length);
 
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys, "test/hadoop/a"),
+    assertTrue(containsTestRootPath(getTestRootPath(fSys, "test/hadoop/a"),
         paths));
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys, "test/hadoop/b"),
+    assertTrue(containsTestRootPath(getTestRootPath(fSys, "test/hadoop/b"),
         paths));
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys, "test/hadoop/c"),
+    assertTrue(containsTestRootPath(getTestRootPath(fSys, "test/hadoop/c"),
         paths));
 
     paths = fSys.listStatus(getTestRootPath(fSys, "test/hadoop/a"));
-    Assert.assertEquals(0, paths.length);
+    assertEquals(0, paths.length);
     
   }
   
@@ -346,7 +350,7 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     // listStatus with filters returns empty correctly
     FileStatus[] filteredPaths = fSys.listStatus(
         getTestRootPath(fSys, "test"), TEST_X_FILTER);
-    Assert.assertEquals(0,filteredPaths.length);
+    assertEquals(0, filteredPaths.length);
     
   }
   
@@ -367,10 +371,10 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     // should return 2 paths ("/test/hadoop/axa" and "/test/hadoop/axx")
     FileStatus[] filteredPaths = fSys.listStatus(
         getTestRootPath(fSys, "test/hadoop"), TEST_X_FILTER);
-    Assert.assertEquals(2,filteredPaths.length);
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys,
+    assertEquals(2, filteredPaths.length);
+    assertTrue(containsTestRootPath(getTestRootPath(fSys,
         TEST_DIR_AXA), filteredPaths));
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys,
+    assertTrue(containsTestRootPath(getTestRootPath(fSys,
         TEST_DIR_AXX), filteredPaths));
   }
   
@@ -378,14 +382,14 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
   public void testGlobStatusNonExistentFile() throws Exception {
     FileStatus[] paths = fSys.globStatus(
         getTestRootPath(fSys, "test/hadoopfsdf"));
-    Assert.assertNull(paths);
+    assertNull(paths);
 
     paths = fSys.globStatus(
         getTestRootPath(fSys, "test/hadoopfsdf/?"));
-    Assert.assertEquals(0, paths.length);
+    assertEquals(0, paths.length);
     paths = fSys.globStatus(
         getTestRootPath(fSys, "test/hadoopfsdf/xyz*/?"));
-    Assert.assertEquals(0, paths.length);
+    assertEquals(0, paths.length);
   }
   
   @Test
@@ -405,7 +409,7 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     // should return nothing
     FileStatus[] paths = fSys.globStatus(
         getTestRootPath(fSys, "test/hadoop/?"));
-    Assert.assertEquals(0, paths.length);
+    assertEquals(0, paths.length);
   }
   
   @Test
@@ -425,10 +429,10 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     // Should return two items ("/test/hadoop" and "/test/hadoop2")
     FileStatus[] paths = fSys.globStatus(
         getTestRootPath(fSys, "test/hadoop*"));
-    Assert.assertEquals(2, paths.length);
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys,
+    assertEquals(2, paths.length);
+    assertTrue(containsTestRootPath(getTestRootPath(fSys,
         "test/hadoop"), paths));
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys,
+    assertTrue(containsTestRootPath(getTestRootPath(fSys,
         "test/hadoop2"), paths));
   }
   
@@ -450,11 +454,11 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     //"/test/hadoop/axx", and "/test/hadoop2/axx")
     FileStatus[] paths = fSys.globStatus(
         getTestRootPath(fSys, "test/hadoop*/*"));
-    Assert.assertEquals(4, paths.length);
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AAA), paths));
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AXA), paths));
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AXX), paths));
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AAA2), paths));
+    assertEquals(4, paths.length);
+    assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AAA), paths));
+    assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AXA), paths));
+    assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AXX), paths));
+    assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AAA2), paths));
   }
   
   @Test
@@ -474,10 +478,10 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     //Should return only 2 items ("/test/hadoop/axa", "/test/hadoop/axx")
     FileStatus[] paths = fSys.globStatus(
         getTestRootPath(fSys, "test/hadoop/ax?"));
-    Assert.assertEquals(2, paths.length);
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys,
+    assertEquals(2, paths.length);
+    assertTrue(containsTestRootPath(getTestRootPath(fSys,
         TEST_DIR_AXA), paths));
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys,
+    assertTrue(containsTestRootPath(getTestRootPath(fSys,
         TEST_DIR_AXX), paths));
   }
   
@@ -499,7 +503,7 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     FileStatus[] filteredPaths = fSys.globStatus(
         getTestRootPath(fSys, "test/hadoop/?"),
         DEFAULT_FILTER);
-    Assert.assertEquals(0,filteredPaths.length);
+    assertEquals(0, filteredPaths.length);
   }
   
   @Test
@@ -521,12 +525,12 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     FileStatus[] filteredPaths = fSys.globStatus(
         getTestRootPath(fSys, "test/hadoop/*"),
         DEFAULT_FILTER);
-    Assert.assertEquals(3, filteredPaths.length);
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys,
+    assertEquals(3, filteredPaths.length);
+    assertTrue(containsTestRootPath(getTestRootPath(fSys,
         TEST_DIR_AAA), filteredPaths));
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys,
+    assertTrue(containsTestRootPath(getTestRootPath(fSys,
         TEST_DIR_AXA), filteredPaths));
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys,
+    assertTrue(containsTestRootPath(getTestRootPath(fSys,
         TEST_DIR_AXX), filteredPaths));
   }
   
@@ -549,12 +553,12 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     FileStatus[] filteredPaths = fSys.globStatus(
         getTestRootPath(fSys, "test/hadoop/a??"),
         DEFAULT_FILTER);
-    Assert.assertEquals(3, filteredPaths.length);
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AAA),
+    assertEquals(3, filteredPaths.length);
+    assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AAA),
         filteredPaths));
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AXA),
+    assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AXA),
         filteredPaths));
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AXX),
+    assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AXX),
         filteredPaths));
   }
   
@@ -577,10 +581,10 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     FileStatus[] filteredPaths = fSys.globStatus(
         getTestRootPath(fSys, "test/hadoop/*"),
         TEST_X_FILTER);
-    Assert.assertEquals(2, filteredPaths.length);
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys,
+    assertEquals(2, filteredPaths.length);
+    assertTrue(containsTestRootPath(getTestRootPath(fSys,
         TEST_DIR_AXA), filteredPaths));
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys,
+    assertTrue(containsTestRootPath(getTestRootPath(fSys,
         TEST_DIR_AXX), filteredPaths));
   }
   
@@ -603,7 +607,7 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     FileStatus[] filteredPaths = fSys.globStatus(
         getTestRootPath(fSys, "test/hadoop/?"),
         TEST_X_FILTER);
-    Assert.assertEquals(0,filteredPaths.length);
+    assertEquals(0, filteredPaths.length);
   }
   
   @Test
@@ -625,10 +629,10 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     FileStatus[] filteredPaths = fSys.globStatus(
         getTestRootPath(fSys, "test/hadoop/a??"),
         TEST_X_FILTER);
-    Assert.assertEquals(2, filteredPaths.length);
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AXA),
+    assertEquals(2, filteredPaths.length);
+    assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AXA),
         filteredPaths));
-    Assert.assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AXX),
+    assertTrue(containsTestRootPath(getTestRootPath(fSys, TEST_DIR_AXX),
         filteredPaths));
   }
 
@@ -642,7 +646,7 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     fSys.setPermission(obscuredDir, new FsPermission((short)0)); //no access
     try {
       fSys.globStatus(getTestRootPath(fSys, "test/hadoop/dir/foo/*"));
-      Assert.fail("Should throw IOException");
+      fail("Should throw IOException");
     } catch (IOException ioe) {
       // expected
     } finally {
@@ -688,22 +692,22 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     out.write(data, 0, len);
     out.close();
 
-    Assert.assertTrue("Exists", exists(fSys, path));
-    Assert.assertEquals("Length", len, fSys.getFileStatus(path).getLen());
+    assertTrue(exists(fSys, path), "Exists");
+    assertEquals(len, fSys.getFileStatus(path).getLen(), "Length");
 
     FSDataInputStream in = fSys.open(path);
     byte[] buf = new byte[len];
     in.readFully(0, buf);
     in.close();
 
-    Assert.assertEquals(len, buf.length);
+    assertEquals(len, buf.length);
     for (int i = 0; i < buf.length; i++) {
-      Assert.assertEquals("Position " + i, data[i], buf[i]);
+      assertEquals(data[i], buf[i], "Position " + i);
     }
     
-    Assert.assertTrue("Deleted", fSys.delete(path, false));
+    assertTrue(fSys.delete(path, false), "Deleted");
     
-    Assert.assertFalse("No longer exists", exists(fSys, path));
+    assertFalse(exists(fSys, path), "No longer exists");
 
   }
   
@@ -715,12 +719,12 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
 
     createFile(path);
     
-    Assert.assertTrue("Exists", exists(fSys, path));
-    Assert.assertEquals("Length", data.length, fSys.getFileStatus(path).getLen());
+    assertTrue(exists(fSys, path), "Exists");
+    assertEquals(data.length, fSys.getFileStatus(path).getLen(), "Length");
     
     try {
       createFile(path);
-      Assert.fail("Should throw IOException.");
+      fail("Should throw IOException.");
     } catch (IOException e) {
       // Expected
     }
@@ -729,27 +733,27 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     out.write(data, 0, data.length);
     out.close();
     
-    Assert.assertTrue("Exists", exists(fSys, path));
-    Assert.assertEquals("Length", data.length, fSys.getFileStatus(path).getLen());
+    assertTrue(exists(fSys, path), "Exists");
+    assertEquals(data.length, fSys.getFileStatus(path).getLen(), "Length");
     
   }
   
   @Test
   public void testWriteInNonExistentDirectory() throws IOException {
     Path path = getTestRootPath(fSys, "test/hadoop/file");
-    Assert.assertFalse("Parent doesn't exist", exists(fSys, path.getParent()));
+    assertFalse(exists(fSys, path.getParent()), "Parent doesn't exist");
     createFile(path);
     
-    Assert.assertTrue("Exists", exists(fSys, path));
-    Assert.assertEquals("Length", data.length, fSys.getFileStatus(path).getLen());
-    Assert.assertTrue("Parent exists", exists(fSys, path.getParent()));
+    assertTrue(exists(fSys, path), "Exists");
+    assertEquals(data.length, fSys.getFileStatus(path).getLen(), "Length");
+    assertTrue(exists(fSys, path.getParent()), "Parent exists");
   }
 
   @Test
   public void testDeleteNonExistentFile() throws IOException {
     Path path = getTestRootPath(fSys, "test/hadoop/file");    
-    Assert.assertFalse("Doesn't exist", exists(fSys, path));
-    Assert.assertFalse("No deletion", fSys.delete(path, true));
+    assertFalse(exists(fSys, path), "Doesn't exist");
+    assertFalse(fSys.delete(path, true), "No deletion");
   }
   
   @Test
@@ -761,33 +765,33 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     createFile(file);
     fSys.mkdirs(subdir);
     
-    Assert.assertTrue("File exists", exists(fSys, file));
-    Assert.assertTrue("Dir exists", exists(fSys, dir));
-    Assert.assertTrue("Subdir exists", exists(fSys, subdir));
+    assertTrue(exists(fSys, file), "File exists");
+    assertTrue(exists(fSys, dir), "Dir exists");
+    assertTrue(exists(fSys, subdir), "Subdir exists");
     
     try {
       fSys.delete(dir, false);
-      Assert.fail("Should throw IOException.");
+      fail("Should throw IOException.");
     } catch (IOException e) {
       // expected
     }
-    Assert.assertTrue("File still exists", exists(fSys, file));
-    Assert.assertTrue("Dir still exists", exists(fSys, dir));
-    Assert.assertTrue("Subdir still exists", exists(fSys, subdir));
+    assertTrue(exists(fSys, file), "File still exists");
+    assertTrue(exists(fSys, dir), "Dir still exists");
+    assertTrue(exists(fSys, subdir), "Subdir still exists");
     
-    Assert.assertTrue("Deleted", fSys.delete(dir, true));
-    Assert.assertFalse("File doesn't exist", exists(fSys, file));
-    Assert.assertFalse("Dir doesn't exist", exists(fSys, dir));
-    Assert.assertFalse("Subdir doesn't exist", exists(fSys, subdir));
+    assertTrue(fSys.delete(dir, true), "Deleted");
+    assertFalse(exists(fSys, file), "File doesn't exist");
+    assertFalse(exists(fSys, dir), "Dir doesn't exist");
+    assertFalse(exists(fSys, subdir), "Subdir doesn't exist");
   }
   
   @Test
   public void testDeleteEmptyDirectory() throws IOException {
     Path dir = getTestRootPath(fSys, "test/hadoop");
     fSys.mkdirs(dir);
-    Assert.assertTrue("Dir exists", exists(fSys, dir));
-    Assert.assertTrue("Deleted", fSys.delete(dir, false));
-    Assert.assertFalse("Dir doesn't exist", exists(fSys, dir));
+    assertTrue(exists(fSys, dir), "Dir exists");
+    assertTrue(fSys.delete(dir, false), "Deleted");
+    assertFalse(exists(fSys, dir), "Dir doesn't exist");
   }
   
   @Test
@@ -797,17 +801,17 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     Path dst = getTestRootPath(fSys, "test/new/newpath");
     try {
       rename(src, dst, false, false, false, Rename.NONE);
-      Assert.fail("Should throw FileNotFoundException");
+      fail("Should throw FileNotFoundException");
     } catch (IOException e) {
       Log.getLog().info("XXX", e);
-      Assert.assertTrue(unwrapException(e) instanceof FileNotFoundException);
+      assertTrue(unwrapException(e) instanceof FileNotFoundException);
     }
 
     try {
       rename(src, dst, false, false, false, Rename.OVERWRITE);
-      Assert.fail("Should throw FileNotFoundException");
+      fail("Should throw FileNotFoundException");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileNotFoundException);
+      assertTrue(unwrapException(e) instanceof FileNotFoundException);
     }
   }
 
@@ -821,16 +825,16 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     
     try {
       rename(src, dst, false, true, false, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileNotFoundException);
+      assertTrue(unwrapException(e) instanceof FileNotFoundException);
     }
 
     try {
       rename(src, dst, false, true, false, Rename.OVERWRITE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileNotFoundException);
+      assertTrue(unwrapException(e) instanceof FileNotFoundException);
     }
   }
 
@@ -845,13 +849,13 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     
     try {
       rename(src, dst, false, true, false, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
     }
 
     try {
       rename(src, dst, false, true, false, Rename.OVERWRITE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
     }
   }
@@ -874,14 +878,14 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     createFile(src);
     try {
       rename(src, src, false, true, false, Rename.NONE);
-      Assert.fail("Renamed file to itself");
+      fail("Renamed file to itself");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
+      assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
     }
     // Also fails with overwrite
     try {
       rename(src, src, false, true, false, Rename.OVERWRITE);
-      Assert.fail("Renamed file to itself");
+      fail("Renamed file to itself");
     } catch (IOException e) {
       // worked
     }
@@ -899,9 +903,9 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     // Fails without overwrite option
     try {
       rename(src, dst, false, true, false, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
+      assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
     }
     
     // Succeeds with overwrite option
@@ -920,14 +924,14 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     // Fails without overwrite option
     try {
       rename(src, dst, false, false, true, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
     }
     
     // File cannot be renamed as directory
     try {
       rename(src, dst, false, false, true, Rename.OVERWRITE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
     }
   }
@@ -939,14 +943,14 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     fSys.mkdirs(src);
     try {
       rename(src, src, false, true, false, Rename.NONE);
-      Assert.fail("Renamed directory to itself");
+      fail("Renamed directory to itself");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
+      assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
     }
     // Also fails with overwrite
     try {
       rename(src, src, false, true, false, Rename.OVERWRITE);
-      Assert.fail("Renamed directory to itself");
+      fail("Renamed directory to itself");
     } catch (IOException e) {
       // worked      
     }
@@ -962,7 +966,7 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     
     try {
       rename(src, dst, false, true, false, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
       IOException ioException = unwrapException(e);
       if (!(ioException instanceof FileNotFoundException)) {
@@ -972,7 +976,7 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
 
     try {
       rename(src, dst, false, true, false, Rename.OVERWRITE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
       IOException ioException = unwrapException(e);
       if (!(ioException instanceof FileNotFoundException)) {
@@ -1001,14 +1005,14 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     fSys.mkdirs(dst.getParent());
     
     rename(src, dst, true, false, true, options);
-    Assert.assertFalse("Nested file1 exists", 
-        exists(fSys, getTestRootPath(fSys, "test/hadoop/dir/file1")));
-    Assert.assertFalse("Nested file2 exists", 
-        exists(fSys, getTestRootPath(fSys, "test/hadoop/dir/subdir/file2")));
-    Assert.assertTrue("Renamed nested file1 exists",
-        exists(fSys, getTestRootPath(fSys, "test/new/newdir/file1")));
-    Assert.assertTrue("Renamed nested exists", 
-        exists(fSys, getTestRootPath(fSys, "test/new/newdir/subdir/file2")));
+    assertFalse(exists(fSys, getTestRootPath(fSys,
+        "test/hadoop/dir/file1")), "Nested file1 exists");
+    assertFalse(exists(fSys, getTestRootPath(fSys, "test/hadoop/dir/subdir/file2")),
+        "Nested file2 exists");
+    assertTrue(exists(fSys, getTestRootPath(fSys, "test/new/newdir/file1")),
+        "Renamed nested file1 exists");
+    assertTrue(exists(fSys, getTestRootPath(fSys, "test/new/newdir/subdir/file2")),
+        "Renamed nested exists");
   }
 
   @Test
@@ -1026,10 +1030,10 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     // Fails without overwrite option
     try {
       rename(src, dst, false, true, false, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
       // Expected (cannot over-write non-empty destination)
-      Assert.assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
+      assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
     }
     // Succeeds with the overwrite option
     rename(src, dst, true, false, true, Rename.OVERWRITE);
@@ -1050,15 +1054,15 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     // Fails without overwrite option
     try {
       rename(src, dst, false, true, false, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
       // Expected (cannot over-write non-empty destination)
-      Assert.assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
+      assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
     }
     // Fails even with the overwrite option
     try {
       rename(src, dst, false, true, false, Rename.OVERWRITE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException ex) {
       // Expected (cannot over-write non-empty destination)
     }
@@ -1075,13 +1079,13 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     // Fails without overwrite option
     try {
       rename(src, dst, false, true, true, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
     }
     // Directory cannot be renamed as existing file
     try {
       rename(src, dst, false, true, true, Rename.OVERWRITE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException ex) {
     }
   }
@@ -1117,7 +1121,7 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     FSDataInputStream in = fSys.open(src);
     InputStream is = in.getWrappedStream();
     in.close();
-    Assert.assertNotNull(is);  
+    assertNotNull(is);
   }
   
   @Test
@@ -1130,10 +1134,9 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
     fSys.initialize(new URI("file:///"), conf);
     writeFile(fSys, fileToFS);
     if (fSys.exists(crcFileAtLFS))
-      Assert.assertTrue("CRC files not deleted", fSys
-          .delete(crcFileAtLFS, true));
+      assertTrue(fSys.delete(crcFileAtLFS, true), "CRC files not deleted");
     fSys.copyToLocalFile(false, fileToFS, fileToLFS, true);
-    Assert.assertFalse("CRC files are created", fSys.exists(crcFileAtLFS));
+    assertFalse(fSys.exists(crcFileAtLFS), "CRC files are created");
   }
 
   private void writeFile(FileSystem fs, Path name) throws IOException {
@@ -1155,9 +1158,9 @@ public abstract class FSMainOperationsBaseTest extends FileSystemTestHelper {
       throws IOException {
     fSys.rename(src, dst, options);
     if (!renameShouldSucceed)
-      Assert.fail("rename should have thrown exception");
-    Assert.assertEquals("Source exists", srcExists, exists(fSys, src));
-    Assert.assertEquals("Destination exists", dstExists, exists(fSys, dst));
+      fail("rename should have thrown exception");
+    assertEquals(srcExists, exists(fSys, src), "Source exists");
+    assertEquals(dstExists, exists(fSys, dst), "Destination exists");
   }
   private boolean containsTestRootPath(Path path, FileStatus[] filteredPaths)
     throws IOException {

+ 15 - 14
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextCreateMkdirBaseTest.java

@@ -17,13 +17,14 @@
  */
 package org.apache.hadoop.fs;
 
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 import java.io.IOException;
 
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import static org.apache.hadoop.fs.FileContextTestHelper.*;
 import static org.apache.hadoop.fs.contract.ContractTestUtils.assertIsDirectory;
 import static org.apache.hadoop.fs.contract.ContractTestUtils.assertIsFile;
@@ -72,12 +73,12 @@ public abstract class FileContextCreateMkdirBaseTest {
     return new FileContextTestHelper();
   }
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     fc.mkdir(getTestRootPath(fc), FileContext.DEFAULT_PERM, true);
   }
 
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     fc.delete(getTestRootPath(fc), true);
   }
@@ -92,7 +93,7 @@ public abstract class FileContextCreateMkdirBaseTest {
   public void testMkdirNonRecursiveWithExistingDir() throws IOException {
     Path f = getTestRootPath(fc, "aDir");
     fc.mkdir(f, FileContext.DEFAULT_PERM, false);
-    Assert.assertTrue(isDir(fc, f));
+    assertTrue(isDir(fc, f));
   }
   
   @Test
@@ -100,7 +101,7 @@ public abstract class FileContextCreateMkdirBaseTest {
     try {
       fc.mkdir(getTestRootPath(fc,"NonExistant/aDir"),
           FileContext.DEFAULT_PERM, false);
-      Assert.fail("Mkdir with non existing parent dir should have failed");
+      fail("Mkdir with non existing parent dir should have failed");
     } catch (IOException e) {
       // failed As expected
     }
@@ -111,7 +112,7 @@ public abstract class FileContextCreateMkdirBaseTest {
   public void testMkdirRecursiveWithExistingDir() throws IOException {
     Path f = getTestRootPath(fc, "aDir");
     fc.mkdir(f, FileContext.DEFAULT_PERM, true);
-    Assert.assertTrue(isDir(fc, f));
+    assertTrue(isDir(fc, f));
   }
   
   
@@ -119,7 +120,7 @@ public abstract class FileContextCreateMkdirBaseTest {
   public void testMkdirRecursiveWithNonExistingDir() throws IOException {
     Path f = getTestRootPath(fc, "NonExistant2/aDir");
     fc.mkdir(f, FileContext.DEFAULT_PERM, true);
-    Assert.assertTrue(isDir(fc, f));
+    assertTrue(isDir(fc, f));
   }
 
   @Test
@@ -194,14 +195,14 @@ public abstract class FileContextCreateMkdirBaseTest {
   public void testCreateNonRecursiveWithExistingDir() throws IOException {
     Path f = getTestRootPath(fc, "foo");
     createFile(fc, f);
-    Assert.assertTrue(isFile(fc, f));
+    assertTrue(isFile(fc, f));
   }
   
   @Test
   public void testCreateNonRecursiveWithNonExistingDir() {
     try {
       createFileNonRecursive(fc, getTestRootPath(fc, "NonExisting/foo"));
-      Assert.fail("Create with non existing parent dir should have failed");
+      fail("Create with non existing parent dir should have failed");
     } catch (IOException e) {
       // As expected
     }
@@ -212,7 +213,7 @@ public abstract class FileContextCreateMkdirBaseTest {
   public void testCreateRecursiveWithExistingDir() throws IOException {
     Path f = getTestRootPath(fc,"foo");
     createFile(fc, f);
-    Assert.assertTrue(isFile(fc, f));
+    assertTrue(isFile(fc, f));
   }
   
   
@@ -220,7 +221,7 @@ public abstract class FileContextCreateMkdirBaseTest {
   public void testCreateRecursiveWithNonExistingDir() throws IOException {
     Path f = getTestRootPath(fc,"NonExisting/foo");
     createFile(fc, f);
-    Assert.assertTrue(isFile(fc, f));
+    assertTrue(isFile(fc, f));
   }
 
   private Path getTestRootPath(FileContext fc) {

+ 216 - 197
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextMainOperationsBaseTest.java

@@ -18,6 +18,15 @@
 
 package org.apache.hadoop.fs;
 
+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.assertNotNull;
+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 java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -33,11 +42,9 @@ import org.apache.hadoop.fs.contract.ContractTestUtils;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.security.AccessControlException;
 import org.apache.hadoop.test.GenericTestUtils;
-import org.junit.After;
-import org.junit.Assert;
-import static org.junit.Assert.*;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -114,7 +121,7 @@ public abstract class FileContextMainOperationsBaseTest  {
   private static final byte[] data = getFileData(numBlocks,
       getDefaultBlockSize());
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     File testBuildData = GenericTestUtils.getRandomizedTestDir();
     Path rootPath = new Path(testBuildData.getAbsolutePath(), 
@@ -123,7 +130,7 @@ public abstract class FileContextMainOperationsBaseTest  {
     fc.mkdir(getTestRootPath(fc, "test"), FileContext.DEFAULT_PERM, true);
   }
   
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     if (fc != null) {
       final Path testRoot = fileContextTestHelper.getAbsoluteTestRootPath(fc);
@@ -161,11 +168,11 @@ public abstract class FileContextMainOperationsBaseTest  {
   @Test
   public void testFsStatus() throws Exception {
     FsStatus fsStatus = fc.getFsStatus(null);
-    Assert.assertNotNull(fsStatus);
+    assertNotNull(fsStatus);
     //used, free and capacity are non-negative longs
-    Assert.assertTrue(fsStatus.getUsed() >= 0);
-    Assert.assertTrue(fsStatus.getRemaining() >= 0);
-    Assert.assertTrue(fsStatus.getCapacity() >= 0);
+    assertTrue(fsStatus.getUsed() >= 0);
+    assertTrue(fsStatus.getRemaining() >= 0);
+    assertTrue(fsStatus.getCapacity() >= 0);
   }
   
   @Test
@@ -174,31 +181,31 @@ public abstract class FileContextMainOperationsBaseTest  {
     // First we cd to our test root
     Path workDir = new Path(fileContextTestHelper.getAbsoluteTestRootPath(fc), new Path("test"));
     fc.setWorkingDirectory(workDir);
-    Assert.assertEquals(workDir, fc.getWorkingDirectory());
+    assertEquals(workDir, fc.getWorkingDirectory());
 
     fc.setWorkingDirectory(new Path("."));
-    Assert.assertEquals(workDir, fc.getWorkingDirectory());
+    assertEquals(workDir, fc.getWorkingDirectory());
 
     fc.setWorkingDirectory(new Path(".."));
-    Assert.assertEquals(workDir.getParent(), fc.getWorkingDirectory());
+    assertEquals(workDir.getParent(), fc.getWorkingDirectory());
     
     // cd using a relative path
 
     // Go back to our test root
     workDir = new Path(fileContextTestHelper.getAbsoluteTestRootPath(fc), new Path("test"));
     fc.setWorkingDirectory(workDir);
-    Assert.assertEquals(workDir, fc.getWorkingDirectory());
+    assertEquals(workDir, fc.getWorkingDirectory());
     
     Path relativeDir = new Path("existingDir1");
     Path absoluteDir = new Path(workDir,"existingDir1");
     fc.mkdir(absoluteDir, FileContext.DEFAULT_PERM, true);
     fc.setWorkingDirectory(relativeDir);
-    Assert.assertEquals(absoluteDir, fc.getWorkingDirectory());
+    assertEquals(absoluteDir, fc.getWorkingDirectory());
     // cd using a absolute path
     absoluteDir = getTestRootPath(fc, "test/existingDir2");
     fc.mkdir(absoluteDir, FileContext.DEFAULT_PERM, true);
     fc.setWorkingDirectory(absoluteDir);
-    Assert.assertEquals(absoluteDir, fc.getWorkingDirectory());
+    assertEquals(absoluteDir, fc.getWorkingDirectory());
     
     // Now open a file relative to the wd we just set above.
     Path absolutePath = new Path(absoluteDir, "foo");
@@ -208,12 +215,12 @@ public abstract class FileContextMainOperationsBaseTest  {
     
     // Now mkdir relative to the dir we cd'ed to
     fc.mkdir(new Path("newDir"), FileContext.DEFAULT_PERM, true);
-    Assert.assertTrue(isDir(fc, new Path(absoluteDir, "newDir")));
+    assertTrue(isDir(fc, new Path(absoluteDir, "newDir")));
 
     absoluteDir = getTestRootPath(fc, "nonexistingPath");
     try {
       fc.setWorkingDirectory(absoluteDir);
-      Assert.fail("cd to non existing dir should have failed");
+      fail("cd to non existing dir should have failed");
     } catch (Exception e) {
       // Exception as expected
     }
@@ -223,7 +230,7 @@ public abstract class FileContextMainOperationsBaseTest  {
     absoluteDir = new Path(localFsRootPath, "existingDir");
     fc.mkdir(absoluteDir, FileContext.DEFAULT_PERM, true);
     fc.setWorkingDirectory(absoluteDir);
-    Assert.assertEquals(absoluteDir, fc.getWorkingDirectory());
+    assertEquals(absoluteDir, fc.getWorkingDirectory());
 
     Path aRegularFile = new Path("aRegularFile");
     createFile(aRegularFile);
@@ -238,48 +245,48 @@ public abstract class FileContextMainOperationsBaseTest  {
   @Test
   public void testMkdirs() throws Exception {
     Path testDir = getTestRootPath(fc, "test/hadoop");
-    Assert.assertFalse(exists(fc, testDir));
-    Assert.assertFalse(isFile(fc, testDir));
+    assertFalse(exists(fc, testDir));
+    assertFalse(isFile(fc, testDir));
 
     fc.mkdir(testDir, FsPermission.getDefault(), true);
 
-    Assert.assertTrue(exists(fc, testDir));
-    Assert.assertFalse(isFile(fc, testDir));
+    assertTrue(exists(fc, testDir));
+    assertFalse(isFile(fc, testDir));
     
     fc.mkdir(testDir, FsPermission.getDefault(), true);
 
-    Assert.assertTrue(exists(fc, testDir));
-    Assert.assertFalse(isFile(fc, testDir));
+    assertTrue(exists(fc, testDir));
+    assertFalse(isFile(fc, testDir));
 
     Path parentDir = testDir.getParent();
-    Assert.assertTrue(exists(fc, parentDir));
-    Assert.assertFalse(isFile(fc, parentDir));
+    assertTrue(exists(fc, parentDir));
+    assertFalse(isFile(fc, parentDir));
 
     Path grandparentDir = parentDir.getParent();
-    Assert.assertTrue(exists(fc, grandparentDir));
-    Assert.assertFalse(isFile(fc, grandparentDir));
+    assertTrue(exists(fc, grandparentDir));
+    assertFalse(isFile(fc, grandparentDir));
     
   }
   
   @Test
   public void testMkdirsFailsForSubdirectoryOfExistingFile() throws Exception {
     Path testDir = getTestRootPath(fc, "test/hadoop");
-    Assert.assertFalse(exists(fc, testDir));
+    assertFalse(exists(fc, testDir));
     fc.mkdir(testDir, FsPermission.getDefault(), true);
-    Assert.assertTrue(exists(fc, testDir));
+    assertTrue(exists(fc, testDir));
     
     createFile(getTestRootPath(fc, "test/hadoop/file"));
     
     Path testSubDir = getTestRootPath(fc, "test/hadoop/file/subdir");
     try {
       fc.mkdir(testSubDir, FsPermission.getDefault(), true);
-      Assert.fail("Should throw IOException.");
+      fail("Should throw IOException.");
     } catch (IOException e) {
       // expected
     }
 
     try {
-      Assert.assertFalse(exists(fc, testSubDir));
+      assertFalse(exists(fc, testSubDir));
     } catch (AccessControlException e) {
       // Expected : HDFS-11132 Checks on paths under file may be rejected by
       // file missing execute permission.
@@ -288,13 +295,13 @@ public abstract class FileContextMainOperationsBaseTest  {
     Path testDeepSubDir = getTestRootPath(fc, "test/hadoop/file/deep/sub/dir");
     try {
       fc.mkdir(testDeepSubDir, FsPermission.getDefault(), true);
-      Assert.fail("Should throw IOException.");
+      fail("Should throw IOException.");
     } catch (IOException e) {
       // expected
     }
 
     try {
-      Assert.assertFalse(exists(fc, testDeepSubDir));
+      assertFalse(exists(fc, testDeepSubDir));
     } catch (AccessControlException e) {
       // Expected : HDFS-11132 Checks on paths under file may be rejected by
       // file missing execute permission.
@@ -307,7 +314,7 @@ public abstract class FileContextMainOperationsBaseTest  {
     throws Exception {
     try {
       fc.getFileStatus(getTestRootPath(fc, "test/hadoop/file"));
-      Assert.fail("Should throw FileNotFoundException");
+      fail("Should throw FileNotFoundException");
     } catch (FileNotFoundException e) {
       // expected
     }
@@ -318,7 +325,7 @@ public abstract class FileContextMainOperationsBaseTest  {
                                                     throws Exception {
     try {
       fc.listStatus(getTestRootPath(fc, "test/hadoop/file"));
-      Assert.fail("Should throw FileNotFoundException");
+      fail("Should throw FileNotFoundException");
     } catch (FileNotFoundException fnfe) {
       // expected
     }
@@ -330,7 +337,7 @@ public abstract class FileContextMainOperationsBaseTest  {
         getTestRootPath(fc, "test/hadoop/a"),
         getTestRootPath(fc, "test/hadoop/b"),
         getTestRootPath(fc, "test/hadoop/c/1"), };
-    Assert.assertFalse(exists(fc, testDirs[0]));
+    assertFalse(exists(fc, testDirs[0]));
 
     for (Path path : testDirs) {
       fc.mkdir(path, FsPermission.getDefault(), true);
@@ -338,28 +345,28 @@ public abstract class FileContextMainOperationsBaseTest  {
 
     // test listStatus that returns an array
     FileStatus[] paths = fc.util().listStatus(getTestRootPath(fc, "test"));
-    Assert.assertEquals(1, paths.length);
-    Assert.assertEquals(getTestRootPath(fc, "test/hadoop"), paths[0].getPath());
+    assertEquals(1, paths.length);
+    assertEquals(getTestRootPath(fc, "test/hadoop"), paths[0].getPath());
 
     paths = fc.util().listStatus(getTestRootPath(fc, "test/hadoop"));
-    Assert.assertEquals(3, paths.length);
+    assertEquals(3, paths.length);
 
-    Assert.assertTrue(containsPath(getTestRootPath(fc, "test/hadoop/a"),
+    assertTrue(containsPath(getTestRootPath(fc, "test/hadoop/a"),
         paths));
-    Assert.assertTrue(containsPath(getTestRootPath(fc, "test/hadoop/b"),
+    assertTrue(containsPath(getTestRootPath(fc, "test/hadoop/b"),
         paths));
-    Assert.assertTrue(containsPath(getTestRootPath(fc, "test/hadoop/c"),
+    assertTrue(containsPath(getTestRootPath(fc, "test/hadoop/c"),
         paths));
 
     paths = fc.util().listStatus(getTestRootPath(fc, "test/hadoop/a"));
-    Assert.assertEquals(0, paths.length);
+    assertEquals(0, paths.length);
     
     // test listStatus that returns an iterator
     RemoteIterator<FileStatus> pathsIterator = 
       fc.listStatus(getTestRootPath(fc, "test"));
-    Assert.assertEquals(getTestRootPath(fc, "test/hadoop"), 
+    assertEquals(getTestRootPath(fc, "test/hadoop"),
         pathsIterator.next().getPath());
-    Assert.assertFalse(pathsIterator.hasNext());
+    assertFalse(pathsIterator.hasNext());
 
     pathsIterator = fc.listStatus(getTestRootPath(fc, "test/hadoop"));
     FileStatus[] subdirs = new FileStatus[3];
@@ -367,18 +374,18 @@ public abstract class FileContextMainOperationsBaseTest  {
     while(i<3 && pathsIterator.hasNext()) {
       subdirs[i++] = pathsIterator.next();
     }
-    Assert.assertFalse(pathsIterator.hasNext());
-    Assert.assertTrue(i==3);
+    assertFalse(pathsIterator.hasNext());
+    assertTrue(i==3);
     
-    Assert.assertTrue(containsPath(getTestRootPath(fc, "test/hadoop/a"),
+    assertTrue(containsPath(getTestRootPath(fc, "test/hadoop/a"),
         subdirs));
-    Assert.assertTrue(containsPath(getTestRootPath(fc, "test/hadoop/b"),
+    assertTrue(containsPath(getTestRootPath(fc, "test/hadoop/b"),
         subdirs));
-    Assert.assertTrue(containsPath(getTestRootPath(fc, "test/hadoop/c"),
+    assertTrue(containsPath(getTestRootPath(fc, "test/hadoop/c"),
         subdirs));
 
     pathsIterator = fc.listStatus(getTestRootPath(fc, "test/hadoop/a"));
-    Assert.assertFalse(pathsIterator.hasNext());
+    assertFalse(pathsIterator.hasNext());
   }
 
   @Test
@@ -436,7 +443,7 @@ public abstract class FileContextMainOperationsBaseTest  {
     // listStatus with filters returns empty correctly
     FileStatus[] filteredPaths = fc.util().listStatus(
         getTestRootPath(fc, "test"), TEST_X_FILTER);
-    Assert.assertEquals(0,filteredPaths.length);
+    assertEquals(0, filteredPaths.length);
     
   }
   
@@ -458,10 +465,10 @@ public abstract class FileContextMainOperationsBaseTest  {
     FileStatus[] filteredPaths = fc.util()
         .listStatus(getTestRootPath(fc, "test/hadoop"),
             TEST_X_FILTER);
-    Assert.assertEquals(2,filteredPaths.length);
-    Assert.assertTrue(containsPath(getTestRootPath(fc,
+    assertEquals(2, filteredPaths.length);
+    assertTrue(containsPath(getTestRootPath(fc,
         TEST_DIR_AXA), filteredPaths));
-    Assert.assertTrue(containsPath(getTestRootPath(fc,
+    assertTrue(containsPath(getTestRootPath(fc,
         TEST_DIR_AXX), filteredPaths));
   }
   
@@ -469,14 +476,14 @@ public abstract class FileContextMainOperationsBaseTest  {
   public void testGlobStatusNonExistentFile() throws Exception {
     FileStatus[] paths = fc.util().globStatus(
           getTestRootPath(fc, "test/hadoopfsdf"));
-    Assert.assertNull(paths);
+    assertNull(paths);
 
     paths = fc.util().globStatus(
         getTestRootPath(fc, "test/hadoopfsdf/?"));
-    Assert.assertEquals(0, paths.length);
+    assertEquals(0, paths.length);
     paths = fc.util().globStatus(
         getTestRootPath(fc, "test/hadoopfsdf/xyz*/?"));
-    Assert.assertEquals(0, paths.length);
+    assertEquals(0, paths.length);
   }
   
   @Test
@@ -496,7 +503,7 @@ public abstract class FileContextMainOperationsBaseTest  {
     // should return nothing
     FileStatus[] paths = fc.util().globStatus(
         getTestRootPath(fc, "test/hadoop/?"));
-    Assert.assertEquals(0, paths.length);
+    assertEquals(0, paths.length);
   }
   
   @Test
@@ -516,10 +523,10 @@ public abstract class FileContextMainOperationsBaseTest  {
     // Should return two items ("/test/hadoop" and "/test/hadoop2")
     FileStatus[] paths = fc.util().globStatus(
         getTestRootPath(fc, "test/hadoop*"));
-    Assert.assertEquals(2, paths.length);
-    Assert.assertTrue(containsPath(getTestRootPath(fc,
+    assertEquals(2, paths.length);
+    assertTrue(containsPath(getTestRootPath(fc,
         "test/hadoop"), paths));
-    Assert.assertTrue(containsPath(getTestRootPath(fc,
+    assertTrue(containsPath(getTestRootPath(fc,
         "test/hadoop2"), paths));
   }
   
@@ -541,11 +548,11 @@ public abstract class FileContextMainOperationsBaseTest  {
     //"/test/hadoop/axx", and "/test/hadoop2/axx")
     FileStatus[] paths = fc.util().globStatus(
         getTestRootPath(fc, "test/hadoop*/*"));
-    Assert.assertEquals(4, paths.length);
-    Assert.assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AAA), paths));
-    Assert.assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AXA), paths));
-    Assert.assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AXX), paths));
-    Assert.assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AAA2), paths));
+    assertEquals(4, paths.length);
+    assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AAA), paths));
+    assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AXA), paths));
+    assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AXX), paths));
+    assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AAA2), paths));
   }
   
   @Test
@@ -565,10 +572,10 @@ public abstract class FileContextMainOperationsBaseTest  {
     //Should return only 2 items ("/test/hadoop/axa", "/test/hadoop/axx")
     FileStatus[] paths = fc.util().globStatus(
         getTestRootPath(fc, "test/hadoop/ax?"));
-    Assert.assertEquals(2, paths.length);
-    Assert.assertTrue(containsPath(getTestRootPath(fc,
+    assertEquals(2, paths.length);
+    assertTrue(containsPath(getTestRootPath(fc,
         TEST_DIR_AXA), paths));
-    Assert.assertTrue(containsPath(getTestRootPath(fc,
+    assertTrue(containsPath(getTestRootPath(fc,
         TEST_DIR_AXX), paths));
   }
   
@@ -590,7 +597,7 @@ public abstract class FileContextMainOperationsBaseTest  {
     FileStatus[] filteredPaths = fc.util().globStatus(
         getTestRootPath(fc, "test/hadoop/?"),
         DEFAULT_FILTER);
-    Assert.assertEquals(0,filteredPaths.length);
+    assertEquals(0, filteredPaths.length);
   }
   
   @Test
@@ -612,12 +619,12 @@ public abstract class FileContextMainOperationsBaseTest  {
     FileStatus[] filteredPaths = fc.util().globStatus(
         getTestRootPath(fc, "test/hadoop/*"),
         DEFAULT_FILTER);
-    Assert.assertEquals(3, filteredPaths.length);
-    Assert.assertTrue(containsPath(getTestRootPath(fc,
+    assertEquals(3, filteredPaths.length);
+    assertTrue(containsPath(getTestRootPath(fc,
         TEST_DIR_AAA), filteredPaths));
-    Assert.assertTrue(containsPath(getTestRootPath(fc,
+    assertTrue(containsPath(getTestRootPath(fc,
         TEST_DIR_AXA), filteredPaths));
-    Assert.assertTrue(containsPath(getTestRootPath(fc,
+    assertTrue(containsPath(getTestRootPath(fc,
         TEST_DIR_AXX), filteredPaths));
   }
   
@@ -640,12 +647,12 @@ public abstract class FileContextMainOperationsBaseTest  {
     FileStatus[] filteredPaths = fc.util().globStatus(
         getTestRootPath(fc, "test/hadoop/a??"),
         DEFAULT_FILTER);
-    Assert.assertEquals(3, filteredPaths.length);
-    Assert.assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AAA),
+    assertEquals(3, filteredPaths.length);
+    assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AAA),
         filteredPaths));
-    Assert.assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AXA),
+    assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AXA),
         filteredPaths));
-    Assert.assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AXX),
+    assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AXX),
         filteredPaths));
   }
   
@@ -668,10 +675,10 @@ public abstract class FileContextMainOperationsBaseTest  {
     FileStatus[] filteredPaths = fc.util().globStatus(
         getTestRootPath(fc, "test/hadoop/*"),
         TEST_X_FILTER);
-    Assert.assertEquals(2, filteredPaths.length);
-    Assert.assertTrue(containsPath(getTestRootPath(fc,
+    assertEquals(2, filteredPaths.length);
+    assertTrue(containsPath(getTestRootPath(fc,
         TEST_DIR_AXA), filteredPaths));
-    Assert.assertTrue(containsPath(getTestRootPath(fc,
+    assertTrue(containsPath(getTestRootPath(fc,
         TEST_DIR_AXX), filteredPaths));
   }
   
@@ -694,7 +701,7 @@ public abstract class FileContextMainOperationsBaseTest  {
     FileStatus[] filteredPaths = fc.util().globStatus(
         getTestRootPath(fc, "test/hadoop/?"),
         TEST_X_FILTER);
-    Assert.assertEquals(0,filteredPaths.length);
+    assertEquals(0, filteredPaths.length);
   }
   
   @Test
@@ -716,10 +723,10 @@ public abstract class FileContextMainOperationsBaseTest  {
     FileStatus[] filteredPaths = fc.util().globStatus(
         getTestRootPath(fc, "test/hadoop/a??"),
         TEST_X_FILTER);
-    Assert.assertEquals(2, filteredPaths.length);
-    Assert.assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AXA),
+    assertEquals(2, filteredPaths.length);
+    assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AXA),
         filteredPaths));
-    Assert.assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AXX),
+    assertTrue(containsPath(getTestRootPath(fc, TEST_DIR_AXX),
         filteredPaths));
   }
   
@@ -760,52 +767,60 @@ public abstract class FileContextMainOperationsBaseTest  {
     out.write(data, 0, len);
     out.close();
 
-    Assert.assertTrue("Exists", exists(fc, path));
-    Assert.assertEquals("Length", len, fc.getFileStatus(path).getLen());
+    assertTrue(exists(fc, path), "Exists");
+    assertEquals(len, fc.getFileStatus(path).getLen(), "Length");
 
     FSDataInputStream in = fc.open(path);
     byte[] buf = new byte[len];
     in.readFully(0, buf);
     in.close();
 
-    Assert.assertEquals(len, buf.length);
+    assertEquals(len, buf.length);
     for (int i = 0; i < buf.length; i++) {
-      Assert.assertEquals("Position " + i, data[i], buf[i]);
+      assertEquals(data[i], buf[i], "Position " + i);
     }
     
-    Assert.assertTrue("Deleted", fc.delete(path, false));
+    assertTrue(fc.delete(path, false), "Deleted");
     
-    Assert.assertFalse("No longer exists", exists(fc, path));
+    assertFalse(exists(fc, path), "No longer exists");
 
   }
   
-  @Test(expected=HadoopIllegalArgumentException.class)
+  @Test
   public void testNullCreateFlag() throws IOException {
-    Path p = getTestRootPath(fc, "test/file");
-    fc.create(p, null);
-    Assert.fail("Excepted exception not thrown");
+    assertThrows(HadoopIllegalArgumentException.class, () -> {
+      Path p = getTestRootPath(fc, "test/file");
+      fc.create(p, null);
+      fail("Excepted exception not thrown");
+    });
   }
   
-  @Test(expected=HadoopIllegalArgumentException.class)
+  @Test
   public void testEmptyCreateFlag() throws IOException {
-    Path p = getTestRootPath(fc, "test/file");
-    fc.create(p, EnumSet.noneOf(CreateFlag.class));
-    Assert.fail("Excepted exception not thrown");
+    assertThrows(HadoopIllegalArgumentException.class, () -> {
+      Path p = getTestRootPath(fc, "test/file");
+      fc.create(p, EnumSet.noneOf(CreateFlag.class));
+      fail("Excepted exception not thrown");
+    });
   }
   
-  @Test(expected=FileAlreadyExistsException.class)
+  @Test
   public void testCreateFlagCreateExistingFile() throws IOException {
-    Path p = getTestRootPath(fc, "test/testCreateFlagCreateExistingFile");
-    createFile(p);
-    fc.create(p, EnumSet.of(CREATE));
-    Assert.fail("Excepted exception not thrown");
+    assertThrows(FileAlreadyExistsException.class, () -> {
+      Path p = getTestRootPath(fc, "test/testCreateFlagCreateExistingFile");
+      createFile(p);
+      fc.create(p, EnumSet.of(CREATE));
+      fail("Excepted exception not thrown");
+    });
   }
   
-  @Test(expected=FileNotFoundException.class)
+  @Test
   public void testCreateFlagOverwriteNonExistingFile() throws IOException {
-    Path p = getTestRootPath(fc, "test/testCreateFlagOverwriteNonExistingFile");
-    fc.create(p, EnumSet.of(OVERWRITE));
-    Assert.fail("Excepted exception not thrown");
+    assertThrows(FileNotFoundException.class, () -> {
+      Path p = getTestRootPath(fc, "test/testCreateFlagOverwriteNonExistingFile");
+      fc.create(p, EnumSet.of(OVERWRITE));
+      fail("Excepted exception not thrown");
+    });
   }
   
   @Test
@@ -816,11 +831,13 @@ public abstract class FileContextMainOperationsBaseTest  {
     writeData(fc, p, out, data, data.length);
   }
   
-  @Test(expected=FileNotFoundException.class)
+  @Test
   public void testCreateFlagAppendNonExistingFile() throws IOException {
-    Path p = getTestRootPath(fc, "test/testCreateFlagAppendNonExistingFile");
-    fc.create(p, EnumSet.of(APPEND));
-    Assert.fail("Excepted exception not thrown");
+    assertThrows(FileNotFoundException.class, () -> {
+      Path p = getTestRootPath(fc, "test/testCreateFlagAppendNonExistingFile");
+      fc.create(p, EnumSet.of(APPEND));
+      fail("Excepted exception not thrown");
+    });
   }
   
   @Test
@@ -846,18 +863,22 @@ public abstract class FileContextMainOperationsBaseTest  {
     writeData(fc, p, out, data, 2*data.length);
   }
   
-  @Test(expected=HadoopIllegalArgumentException.class)
+  @Test
   public void testCreateFlagAppendOverwrite() throws IOException {
-    Path p = getTestRootPath(fc, "test/nonExistent");
-    fc.create(p, EnumSet.of(APPEND, OVERWRITE));
-    Assert.fail("Excepted exception not thrown");
+    assertThrows(HadoopIllegalArgumentException.class, () -> {
+      Path p = getTestRootPath(fc, "test/nonExistent");
+      fc.create(p, EnumSet.of(APPEND, OVERWRITE));
+      fail("Excepted exception not thrown");
+    });
   }
   
-  @Test(expected=HadoopIllegalArgumentException.class)
+  @Test
   public void testCreateFlagAppendCreateOverwrite() throws IOException {
-    Path p = getTestRootPath(fc, "test/nonExistent");
-    fc.create(p, EnumSet.of(CREATE, APPEND, OVERWRITE));
-    Assert.fail("Excepted exception not thrown");
+    assertThrows(HadoopIllegalArgumentException.class, () -> {
+      Path p = getTestRootPath(fc, "test/nonExistent");
+      fc.create(p, EnumSet.of(CREATE, APPEND, OVERWRITE));
+      fail("Excepted exception not thrown");
+    });
   }
 
   @Test
@@ -906,26 +927,26 @@ public abstract class FileContextMainOperationsBaseTest  {
       byte[] data, long expectedLen) throws IOException {
     out.write(data, 0, data.length);
     out.close();
-    Assert.assertTrue("Exists", exists(fc, p));
-    Assert.assertEquals("Length", expectedLen, fc.getFileStatus(p).getLen());
+    assertTrue(exists(fc, p), "Exists");
+    assertEquals(expectedLen, fc.getFileStatus(p).getLen(), "Length");
   }
   
   @Test
   public void testWriteInNonExistentDirectory() throws IOException {
     Path path = getTestRootPath(fc, "test/hadoop/file");
-    Assert.assertFalse("Parent doesn't exist", exists(fc, path.getParent()));
+    assertFalse(exists(fc, path.getParent()), "Parent doesn't exist");
     createFile(path);
     
-    Assert.assertTrue("Exists", exists(fc, path));
-    Assert.assertEquals("Length", data.length, fc.getFileStatus(path).getLen());
-    Assert.assertTrue("Parent exists", exists(fc, path.getParent()));
+    assertTrue(exists(fc, path), "Exists");
+    assertEquals(data.length, fc.getFileStatus(path).getLen(), "Length");
+    assertTrue(exists(fc, path.getParent()), "Parent exists");
   }
 
   @Test
   public void testDeleteNonExistentFile() throws IOException {
     Path path = getTestRootPath(fc, "test/hadoop/file");    
-    Assert.assertFalse("Doesn't exist", exists(fc, path));
-    Assert.assertFalse("No deletion", fc.delete(path, true));
+    assertFalse(exists(fc, path), "Doesn't exist");
+    assertFalse(fc.delete(path, true), "No deletion");
   }
   
   @Test
@@ -937,33 +958,33 @@ public abstract class FileContextMainOperationsBaseTest  {
     createFile(file);
     fc.mkdir(subdir,FsPermission.getDefault(), true);
     
-    Assert.assertTrue("File exists", exists(fc, file));
-    Assert.assertTrue("Dir exists", exists(fc, dir));
-    Assert.assertTrue("Subdir exists", exists(fc, subdir));
+    assertTrue(exists(fc, file), "File exists");
+    assertTrue(exists(fc, dir), "Dir exists");
+    assertTrue(exists(fc, subdir), "Subdir exists");
     
     try {
       fc.delete(dir, false);
-      Assert.fail("Should throw IOException.");
+      fail("Should throw IOException.");
     } catch (IOException e) {
       // expected
     }
-    Assert.assertTrue("File still exists", exists(fc, file));
-    Assert.assertTrue("Dir still exists", exists(fc, dir));
-    Assert.assertTrue("Subdir still exists", exists(fc, subdir));
+    assertTrue(exists(fc, file), "File still exists");
+    assertTrue(exists(fc, dir), "Dir still exists");
+    assertTrue(exists(fc, subdir), "Subdir still exists");
     
-    Assert.assertTrue("Deleted", fc.delete(dir, true));
-    Assert.assertFalse("File doesn't exist", exists(fc, file));
-    Assert.assertFalse("Dir doesn't exist", exists(fc, dir));
-    Assert.assertFalse("Subdir doesn't exist", exists(fc, subdir));
+    assertTrue(fc.delete(dir, true), "Deleted");
+    assertFalse(exists(fc, file), "File doesn't exist");
+    assertFalse(exists(fc, dir), "Dir doesn't exist");
+    assertFalse(exists(fc, subdir), "Subdir doesn't exist");
   }
   
   @Test
   public void testDeleteEmptyDirectory() throws IOException {
     Path dir = getTestRootPath(fc, "test/hadoop");
     fc.mkdir(dir, FsPermission.getDefault(), true);
-    Assert.assertTrue("Dir exists", exists(fc, dir));
-    Assert.assertTrue("Deleted", fc.delete(dir, false));
-    Assert.assertFalse("Dir doesn't exist", exists(fc, dir));
+    assertTrue(exists(fc, dir), "Dir exists");
+    assertTrue(fc.delete(dir, false), "Deleted");
+    assertFalse(exists(fc, dir), "Dir doesn't exist");
   }
   
   @Test
@@ -973,16 +994,16 @@ public abstract class FileContextMainOperationsBaseTest  {
     Path dst = getTestRootPath(fc, "test/new/newpath");
     try {
       rename(src, dst, false, false, Rename.NONE);
-      Assert.fail("Should throw FileNotFoundException");
+      fail("Should throw FileNotFoundException");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileNotFoundException);
+      assertTrue(unwrapException(e) instanceof FileNotFoundException);
     }
 
     try {
       rename(src, dst, false, false, Rename.OVERWRITE);
-      Assert.fail("Should throw FileNotFoundException");
+      fail("Should throw FileNotFoundException");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileNotFoundException);
+      assertTrue(unwrapException(e) instanceof FileNotFoundException);
     }
   }
 
@@ -996,16 +1017,16 @@ public abstract class FileContextMainOperationsBaseTest  {
     
     try {
       rename(src, dst, true, false, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileNotFoundException);
+      assertTrue(unwrapException(e) instanceof FileNotFoundException);
     }
 
     try {
       rename(src, dst, true, false, Rename.OVERWRITE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileNotFoundException);
+      assertTrue(unwrapException(e) instanceof FileNotFoundException);
     }
   }
 
@@ -1020,13 +1041,13 @@ public abstract class FileContextMainOperationsBaseTest  {
     
     try {
       rename(src, dst, true, false, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
     }
 
     try {
       rename(src, dst, true, false, Rename.OVERWRITE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
     }
   }
@@ -1049,16 +1070,16 @@ public abstract class FileContextMainOperationsBaseTest  {
     createFile(src);
     try {
       rename(src, src, true, true, Rename.NONE);
-      Assert.fail("Renamed file to itself");
+      fail("Renamed file to itself");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
+      assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
     }
     // Also fails with overwrite
     try {
       rename(src, src, true, true, Rename.OVERWRITE);
-      Assert.fail("Renamed file to itself");
+      fail("Renamed file to itself");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
+      assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
     }
   }
   
@@ -1074,9 +1095,9 @@ public abstract class FileContextMainOperationsBaseTest  {
     // Fails without overwrite option
     try {
       rename(src, dst, true, true, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
+      assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
     }
     
     // Succeeds with overwrite option
@@ -1095,14 +1116,14 @@ public abstract class FileContextMainOperationsBaseTest  {
     // Fails without overwrite option
     try {
       rename(src, dst, true, true, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
     }
     
     // File cannot be renamed as directory
     try {
       rename(src, dst, true, true, Rename.OVERWRITE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
     }
   }
@@ -1114,16 +1135,16 @@ public abstract class FileContextMainOperationsBaseTest  {
     fc.mkdir(src, FileContext.DEFAULT_PERM, true);
     try {
       rename(src, src, true, true, Rename.NONE);
-      Assert.fail("Renamed directory to itself");
+      fail("Renamed directory to itself");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
+      assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
     }
     // Also fails with overwrite
     try {
       rename(src, src, true, true, Rename.OVERWRITE);
-      Assert.fail("Renamed directory to itself");
+      fail("Renamed directory to itself");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);      
+      assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
     }
   }
 
@@ -1137,16 +1158,16 @@ public abstract class FileContextMainOperationsBaseTest  {
     
     try {
       rename(src, dst, true, false, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileNotFoundException);
+      assertTrue(unwrapException(e) instanceof FileNotFoundException);
     }
 
     try {
       rename(src, dst, true, false, Rename.OVERWRITE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
-      Assert.assertTrue(unwrapException(e) instanceof FileNotFoundException);
+      assertTrue(unwrapException(e) instanceof FileNotFoundException);
     }
   }
 
@@ -1169,14 +1190,14 @@ public abstract class FileContextMainOperationsBaseTest  {
     fc.mkdir(dst.getParent(), FileContext.DEFAULT_PERM, true);
     
     rename(src, dst, false, true, options);
-    Assert.assertFalse("Nested file1 exists", 
-        exists(fc, getTestRootPath(fc, "test/hadoop/dir/file1")));
-    Assert.assertFalse("Nested file2 exists", 
-        exists(fc, getTestRootPath(fc, "test/hadoop/dir/subdir/file2")));
-    Assert.assertTrue("Renamed nested file1 exists",
-        exists(fc, getTestRootPath(fc, "test/new/newdir/file1")));
-    Assert.assertTrue("Renamed nested exists", 
-        exists(fc, getTestRootPath(fc, "test/new/newdir/subdir/file2")));
+    assertFalse(exists(fc, getTestRootPath(fc,
+        "test/hadoop/dir/file1")), "Nested file1 exists");
+    assertFalse(exists(fc, getTestRootPath(fc,
+        "test/hadoop/dir/subdir/file2")), "Nested file2 exists");
+    assertTrue(exists(fc, getTestRootPath(fc,
+        "test/new/newdir/file1")), "Renamed nested file1 exists");
+    assertTrue(exists(fc, getTestRootPath(fc,
+        "test/new/newdir/subdir/file2")), "Renamed nested exists");
   }
 
   @Test
@@ -1194,10 +1215,10 @@ public abstract class FileContextMainOperationsBaseTest  {
     // Fails without overwrite option
     try {
       rename(src, dst, true, true, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
       // Expected (cannot over-write non-empty destination)
-      Assert.assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
+      assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
     }
     // Succeeds with the overwrite option
     rename(src, dst, false, true, Rename.OVERWRITE);
@@ -1218,15 +1239,15 @@ public abstract class FileContextMainOperationsBaseTest  {
     // Fails without overwrite option
     try {
       rename(src, dst, true, true, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
       // Expected (cannot over-write non-empty destination)
-      Assert.assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
+      assertTrue(unwrapException(e) instanceof FileAlreadyExistsException);
     }
     // Fails even with the overwrite option
     try {
       rename(src, dst, true, true, Rename.OVERWRITE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException ex) {
       // Expected (cannot over-write non-empty destination)
     }
@@ -1243,13 +1264,13 @@ public abstract class FileContextMainOperationsBaseTest  {
     // Fails without overwrite option
     try {
       rename(src, dst, true, true, Rename.NONE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException e) {
     }
     // Directory cannot be renamed as existing file
     try {
       rename(src, dst, true, true, Rename.OVERWRITE);
-      Assert.fail("Expected exception was not thrown");
+      fail("Expected exception was not thrown");
     } catch (IOException ex) {
     }
   }
@@ -1286,7 +1307,7 @@ public abstract class FileContextMainOperationsBaseTest  {
     if (!fc.getDefaultFileSystem().supportsSymlinks()) {
       try {
         fc.createSymlink(file, link, false);
-        Assert.fail("Created a symlink on a file system that "+
+        fail("Created a symlink on a file system that "+
                     "does not support symlinks.");
       } catch (UnsupportedOperationException e) {
         // Expected
@@ -1294,12 +1315,12 @@ public abstract class FileContextMainOperationsBaseTest  {
       createFile(file);
       try {
         fc.getLinkTarget(file);
-        Assert.fail("Got a link target on a file system that "+
+        fail("Got a link target on a file system that "+
                     "does not support symlinks.");
       } catch (IOException e) {
         // Expected
       }
-      Assert.assertEquals(fc.getFileStatus(file), fc.getFileLinkStatus(file));
+      assertEquals(fc.getFileStatus(file), fc.getFileLinkStatus(file));
     }
   }
   
@@ -1315,8 +1336,8 @@ public abstract class FileContextMainOperationsBaseTest  {
     try {
       fc.rename(src, dst, options);
     } finally {
-      Assert.assertEquals("Source exists", srcExists, exists(fc, src));
-      Assert.assertEquals("Destination exists", dstExists, exists(fc, dst));
+      assertEquals(srcExists, exists(fc, src), "Source exists");
+      assertEquals(dstExists, exists(fc, dst), "Destination exists");
     }
   }
   
@@ -1526,9 +1547,8 @@ public abstract class FileContextMainOperationsBaseTest  {
     CompletableFuture<Long> readAllBytes = fc.openFile(path)
         .build()
         .thenApply(ContractTestUtils::readStream);
-    assertEquals("Wrong number of bytes read from stream",
-        data.length,
-        (long)readAllBytes.get());
+    assertEquals(data.length, (long) readAllBytes.get(),
+        "Wrong number of bytes read from stream");
   }
 
   @Test
@@ -1539,8 +1559,7 @@ public abstract class FileContextMainOperationsBaseTest  {
     CompletableFuture<FSDataInputStream> future = fc.openFile(path).build();
     AtomicBoolean accepted = new AtomicBoolean(false);
     future.thenAcceptAsync(i -> accepted.set(true)).get();
-    assertTrue("async accept operation not invoked",
-        accepted.get());
+    assertTrue(accepted.get(), "async accept operation not invoked");
   }
 
 }

+ 14 - 11
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextTestHelper.java

@@ -17,6 +17,10 @@
  */
 package org.apache.hadoop.fs;
 
+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 java.io.DataInputStream;
 import java.io.IOException;
 import java.io.FileNotFoundException;
@@ -26,7 +30,6 @@ import org.apache.hadoop.fs.Options.CreateOpts;
 import org.apache.hadoop.fs.Options.CreateOpts.BlockSize;
 import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.test.GenericTestUtils;
-import org.junit.Assert;
 
 /**
  * Helper class for unit tests.
@@ -220,28 +223,28 @@ public final class FileContextTestHelper {
   public static void checkFileStatus(FileContext aFc, String path,
       fileType expectedType) throws IOException {
     FileStatus s = aFc.getFileStatus(new Path(path));
-    Assert.assertNotNull(s);
+    assertNotNull(s);
     if (expectedType == fileType.isDir) {
-      Assert.assertTrue(s.isDirectory());
+      assertTrue(s.isDirectory());
     } else if (expectedType == fileType.isFile) {
-      Assert.assertTrue(s.isFile());
+      assertTrue(s.isFile());
     } else if (expectedType == fileType.isSymlink) {
-      Assert.assertTrue(s.isSymlink());
+      assertTrue(s.isSymlink());
     }
-    Assert.assertEquals(aFc.makeQualified(new Path(path)), s.getPath());
+    assertEquals(aFc.makeQualified(new Path(path)), s.getPath());
   }
   
   public static void checkFileLinkStatus(FileContext aFc, String path,
       fileType expectedType) throws IOException {
     FileStatus s = aFc.getFileLinkStatus(new Path(path));
-    Assert.assertNotNull(s);
+    assertNotNull(s);
     if (expectedType == fileType.isDir) {
-      Assert.assertTrue(s.isDirectory());
+      assertTrue(s.isDirectory());
     } else if (expectedType == fileType.isFile) {
-      Assert.assertTrue(s.isFile());
+      assertTrue(s.isFile());
     } else if (expectedType == fileType.isSymlink) {
-      Assert.assertTrue(s.isSymlink());
+      assertTrue(s.isSymlink());
     }
-    Assert.assertEquals(aFc.makeQualified(new Path(path)), s.getPath());
+    assertEquals(aFc.makeQualified(new Path(path)), s.getPath());
   }
 }

+ 14 - 11
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextTestWrapper.java

@@ -17,6 +17,10 @@
  */
 package org.apache.hadoop.fs;
 
+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 java.io.DataInputStream;
 import java.io.IOException;
 import java.io.FileNotFoundException;
@@ -28,7 +32,6 @@ import org.apache.hadoop.fs.Options.Rename;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.security.AccessControlException;
-import org.junit.Assert;
 
 /**
  * Helper class for unit tests.
@@ -169,29 +172,29 @@ public final class FileContextTestWrapper extends FSTestWrapper {
   public void checkFileStatus(String path, fileType expectedType)
       throws IOException {
     FileStatus s = fc.getFileStatus(new Path(path));
-    Assert.assertNotNull(s);
+    assertNotNull(s);
     if (expectedType == fileType.isDir) {
-      Assert.assertTrue(s.isDirectory());
+      assertTrue(s.isDirectory());
     } else if (expectedType == fileType.isFile) {
-      Assert.assertTrue(s.isFile());
+      assertTrue(s.isFile());
     } else if (expectedType == fileType.isSymlink) {
-      Assert.assertTrue(s.isSymlink());
+      assertTrue(s.isSymlink());
     }
-    Assert.assertEquals(fc.makeQualified(new Path(path)), s.getPath());
+    assertEquals(fc.makeQualified(new Path(path)), s.getPath());
   }
 
   public void checkFileLinkStatus(String path, fileType expectedType)
       throws IOException {
     FileStatus s = fc.getFileLinkStatus(new Path(path));
-    Assert.assertNotNull(s);
+    assertNotNull(s);
     if (expectedType == fileType.isDir) {
-      Assert.assertTrue(s.isDirectory());
+      assertTrue(s.isDirectory());
     } else if (expectedType == fileType.isFile) {
-      Assert.assertTrue(s.isFile());
+      assertTrue(s.isFile());
     } else if (expectedType == fileType.isSymlink) {
-      Assert.assertTrue(s.isSymlink());
+      assertTrue(s.isSymlink());
     }
-    Assert.assertEquals(fc.makeQualified(new Path(path)), s.getPath());
+    assertEquals(fc.makeQualified(new Path(path)), s.getPath());
   }
 
   //

+ 92 - 88
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextURIBase.java

@@ -23,16 +23,20 @@ import java.util.ArrayList;
 import java.util.regex.Pattern;
 
 import org.apache.hadoop.test.GenericTestUtils;
-import org.junit.Assert;
 
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.test.LambdaTestUtils;
 import org.apache.hadoop.util.Shell;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import static org.apache.hadoop.fs.FileContextTestHelper.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * <p>
@@ -71,10 +75,10 @@ public abstract class FileContextURIBase {
     return fc.makeQualified(new Path(BASE, path));
   }
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception { }
 
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     // Clean up after test completion
     // No need to clean fc1 as fc1 and fc2 points same location
@@ -101,12 +105,12 @@ public abstract class FileContextURIBase {
       // Create a file on fc2's file system using fc1
       Path testPath = qualifiedPath(f, fc2);
       // Ensure file does not exist
-      Assert.assertFalse(exists(fc2, testPath));
+      assertFalse(exists(fc2, testPath));
 
       // Now create file
       createFile(fc1, testPath);
       // Ensure fc2 has the created file
-      Assert.assertTrue(exists(fc2, testPath));
+      assertTrue(exists(fc2, testPath));
     }
   }
 
@@ -118,11 +122,11 @@ public abstract class FileContextURIBase {
 
       Path testPath = qualifiedPath(fileName, fc2);
       // Ensure file does not exist
-      Assert.assertFalse(exists(fc2, testPath));
+      assertFalse(exists(fc2, testPath));
 
       // Create a file on fc2's file system using fc1
       createFile(fc1, testPath);
-      Assert.fail("Create file with null name should throw IllegalArgumentException.");
+      fail("Create file with null name should throw IllegalArgumentException.");
     } catch (IllegalArgumentException e) {
       // expected
     }
@@ -135,7 +139,7 @@ public abstract class FileContextURIBase {
     Path testPath = qualifiedPath(fileName, fc2);
 
     // Ensure file does not exist
-    Assert.assertFalse(exists(fc2, testPath));
+    assertFalse(exists(fc2, testPath));
 
     // Create a file on fc2's file system using fc1
     createFile(fc1, testPath);
@@ -155,14 +159,14 @@ public abstract class FileContextURIBase {
     Path testPath = qualifiedPath(fileName, fc2);
 
     // Ensure file does not exist
-    Assert.assertFalse(exists(fc2, testPath));
+    assertFalse(exists(fc2, testPath));
 
     // Create a file on fc2's file system using fc1
     createFile(fc1, testPath);
 
     // Ensure using fc2 that file is created
-    Assert.assertTrue(isDir(fc2, testPath.getParent()));
-    Assert.assertEquals("testCreateFileInNonExistingDirectory",
+    assertTrue(isDir(fc2, testPath.getParent()));
+    assertEquals("testCreateFileInNonExistingDirectory",
         testPath.getParent().getName());
     fc2.getFileStatus(testPath);
 
@@ -176,17 +180,17 @@ public abstract class FileContextURIBase {
     Path subDirPath = qualifiedPath("dir0", fc2);
 
     // Ensure that testPath does not exist in fc1
-    Assert.assertFalse(exists(fc1, path));
-    Assert.assertFalse(isFile(fc1, path));
-    Assert.assertFalse(isDir(fc1, path));
+    assertFalse(exists(fc1, path));
+    assertFalse(isFile(fc1, path));
+    assertFalse(isDir(fc1, path));
 
     // Create a directory on fc2's file system using fc1
    fc1.mkdir(path, FsPermission.getDefault(), true);
 
     // Ensure fc2 has directory
-    Assert.assertTrue(isDir(fc2, path));
-    Assert.assertTrue(exists(fc2, path));
-    Assert.assertFalse(isFile(fc2, path));
+    assertTrue(isDir(fc2, path));
+    assertTrue(exists(fc2, path));
+    assertFalse(isFile(fc2, path));
 
     // Test to create same dir twice, (HDFS mkdir is similar to mkdir -p )
    fc1.mkdir(subDirPath, FsPermission.getDefault(), true);
@@ -198,17 +202,17 @@ public abstract class FileContextURIBase {
 
     // Check parent dir
     Path parentDir = path.getParent();
-    Assert.assertTrue(exists(fc2, parentDir));
-    Assert.assertFalse(isFile(fc2, parentDir));
+    assertTrue(exists(fc2, parentDir));
+    assertFalse(isFile(fc2, parentDir));
 
     // Check parent parent dir
     Path grandparentDir = parentDir.getParent();
-    Assert.assertTrue(exists(fc2, grandparentDir));
-    Assert.assertFalse(isFile(fc2, grandparentDir));
+    assertTrue(exists(fc2, grandparentDir));
+    assertFalse(isFile(fc2, grandparentDir));
 
     // Negative test cases
-    Assert.assertFalse(exists(fc2, falsePath));
-    Assert.assertFalse(isDir(fc2, falsePath));
+    assertFalse(exists(fc2, falsePath));
+    assertFalse(isDir(fc2, falsePath));
 
     // TestCase - Create multiple directories
     String dirNames[] = { 
@@ -227,27 +231,27 @@ public abstract class FileContextURIBase {
       // Create a file on fc2's file system using fc1
       Path testPath = qualifiedPath(f, fc2);
       // Ensure file does not exist
-      Assert.assertFalse(exists(fc2, testPath));
+      assertFalse(exists(fc2, testPath));
 
       // Now create directory
      fc1.mkdir(testPath, FsPermission.getDefault(), true);
       // Ensure fc2 has the created directory
-      Assert.assertTrue(exists(fc2, testPath));
-      Assert.assertTrue(isDir(fc2, testPath));
+      assertTrue(exists(fc2, testPath));
+      assertTrue(isDir(fc2, testPath));
     }
     // delete the parent directory and verify that the dir no longer exists
     final Path parent = qualifiedPath("createTest", fc2);
     fc2.delete(parent, true);
-    Assert.assertFalse(exists(fc2, parent));
+    assertFalse(exists(fc2, parent));
 
   }
 
   @Test
   public void testMkdirsFailsForSubdirectoryOfExistingFile() throws Exception {
     Path testDir = qualifiedPath("test/hadoop", fc2);
-    Assert.assertFalse(exists(fc2, testDir));
+    assertFalse(exists(fc2, testDir));
     fc2.mkdir(testDir, FsPermission.getDefault(), true);
-    Assert.assertTrue(exists(fc2, testDir));
+    assertTrue(exists(fc2, testDir));
 
     // Create file on fc1 using fc2 context
     createFile(fc1, qualifiedPath("test/hadoop/file", fc2));
@@ -255,20 +259,20 @@ public abstract class FileContextURIBase {
     Path testSubDir = qualifiedPath("test/hadoop/file/subdir", fc2);
     try {
       fc1.mkdir(testSubDir, FsPermission.getDefault(), true);
-      Assert.fail("Should throw IOException.");
+      fail("Should throw IOException.");
     } catch (IOException e) {
       // expected
     }
-    Assert.assertFalse(exists(fc1, testSubDir));
+    assertFalse(exists(fc1, testSubDir));
 
     Path testDeepSubDir = qualifiedPath("test/hadoop/file/deep/sub/dir", fc1);
     try {
       fc2.mkdir(testDeepSubDir, FsPermission.getDefault(), true);
-      Assert.fail("Should throw IOException.");
+      fail("Should throw IOException.");
     } catch (IOException e) {
       // expected
     }
-    Assert.assertFalse(exists(fc1, testDeepSubDir));
+    assertFalse(exists(fc1, testDeepSubDir));
 
   }
 
@@ -286,11 +290,11 @@ public abstract class FileContextURIBase {
     fc1.mkdir(existingPath, FsPermission.getDefault(), true);
 
     // Ensure fc2 has directory
-    Assert.assertTrue(isDir(fc2, existingPath));
-    Assert.assertTrue(isDir(fc2, pathToRootDir));
+    assertTrue(isDir(fc2, existingPath));
+    assertTrue(isDir(fc2, pathToRootDir));
 
     // Negative test case
-    Assert.assertFalse(isDir(fc2, nonExistingPath));
+    assertFalse(isDir(fc2, nonExistingPath));
 
   }
 
@@ -299,19 +303,19 @@ public abstract class FileContextURIBase {
     Path testPath = qualifiedPath("testDeleteFile", fc2);
 
     // Ensure file does not exist
-    Assert.assertFalse(exists(fc2, testPath));
+    assertFalse(exists(fc2, testPath));
 
     // First create a file on file system using fc1
     createFile(fc1, testPath);
 
     // Ensure file exist
-    Assert.assertTrue(exists(fc2, testPath));
+    assertTrue(exists(fc2, testPath));
 
     // Delete file using fc2
     fc2.delete(testPath, false);
 
     // Ensure fc2 does not have deleted file
-    Assert.assertFalse(exists(fc2, testPath));
+    assertFalse(exists(fc2, testPath));
 
   }
 
@@ -322,23 +326,23 @@ public abstract class FileContextURIBase {
 
     // TestCase1 : Test delete on file never existed
     // Ensure file does not exist
-    Assert.assertFalse(exists(fc2, testPath));
+    assertFalse(exists(fc2, testPath));
 
     // Delete on non existing file should return false
-    Assert.assertFalse(fc2.delete(testPath, false));
+    assertFalse(fc2.delete(testPath, false));
 
     // TestCase2 : Create , Delete , Delete file
     // Create a file on fc2's file system using fc1
     createFile(fc1, testPath);
     // Ensure file exist
-    Assert.assertTrue(exists(fc2, testPath));
+    assertTrue(exists(fc2, testPath));
 
     // Delete test file, deleting existing file should return true
-    Assert.assertTrue(fc2.delete(testPath, false));
+    assertTrue(fc2.delete(testPath, false));
     // Ensure file does not exist
-    Assert.assertFalse(exists(fc2, testPath));
+    assertFalse(exists(fc2, testPath));
     // Delete on non existing file should return false
-    Assert.assertFalse(fc2.delete(testPath, false));
+    assertFalse(fc2.delete(testPath, false));
 
   }
 
@@ -349,23 +353,23 @@ public abstract class FileContextURIBase {
 
     // TestCase1 : Test delete on file never existed
     // Ensure file does not exist
-    Assert.assertFalse(exists(fc2, testPath));
+    assertFalse(exists(fc2, testPath));
 
     // Delete on non existing file should return false
-    Assert.assertFalse(fc2.delete(testPath, false));
+    assertFalse(fc2.delete(testPath, false));
 
     // TestCase2 : Create , Delete , Delete file
     // Create a file on fc2's file system using fc1
     createFile(fc1, testPath);
     // Ensure file exist
-    Assert.assertTrue(exists(fc2, testPath));
+    assertTrue(exists(fc2, testPath));
 
     // Delete test file, deleting existing file should return true
-    Assert.assertTrue(fc2.delete(testPath, false));
+    assertTrue(fc2.delete(testPath, false));
     // Ensure file does not exist
-    Assert.assertFalse(exists(fc2, testPath));
+    assertFalse(exists(fc2, testPath));
     // Delete on non existing file should return false
-    Assert.assertFalse(fc2.delete(testPath, false));
+    assertFalse(fc2.delete(testPath, false));
 
   }
 
@@ -374,19 +378,19 @@ public abstract class FileContextURIBase {
     String dirName = "dirTest";
     Path testDirPath = qualifiedPath(dirName, fc2);
     // Ensure directory does not exist
-    Assert.assertFalse(exists(fc2, testDirPath));
+    assertFalse(exists(fc2, testDirPath));
 
     // Create a directory on fc2's file system using fc1
    fc1.mkdir(testDirPath, FsPermission.getDefault(), true);
 
     // Ensure dir is created
-    Assert.assertTrue(exists(fc2, testDirPath));
-    Assert.assertTrue(isDir(fc2, testDirPath));
+    assertTrue(exists(fc2, testDirPath));
+    assertTrue(isDir(fc2, testDirPath));
 
     fc2.delete(testDirPath, true);
 
     // Ensure that directory is deleted
-    Assert.assertFalse(isDir(fc2, testDirPath));
+    assertFalse(isDir(fc2, testDirPath));
 
     // TestCase - Create and delete multiple directories
     String dirNames[] = { 
@@ -406,18 +410,18 @@ public abstract class FileContextURIBase {
       // Create a file on fc2's file system using fc1
       Path testPath = qualifiedPath(f, fc2);
       // Ensure file does not exist
-      Assert.assertFalse(exists(fc2, testPath));
+      assertFalse(exists(fc2, testPath));
 
       // Now create directory
      fc1.mkdir(testPath, FsPermission.getDefault(), true);
       // Ensure fc2 has the created directory
-      Assert.assertTrue(exists(fc2, testPath));
-      Assert.assertTrue(isDir(fc2, testPath));
+      assertTrue(exists(fc2, testPath));
+      assertTrue(isDir(fc2, testPath));
       // Delete dir
-      Assert.assertTrue(fc2.delete(testPath, true));
+      assertTrue(fc2.delete(testPath, true));
       // verify if directory is deleted
-      Assert.assertFalse(exists(fc2, testPath));
-      Assert.assertFalse(isDir(fc2, testPath));
+      assertFalse(exists(fc2, testPath));
+      assertFalse(isDir(fc2, testPath));
     }
   }
 
@@ -428,24 +432,24 @@ public abstract class FileContextURIBase {
 
     // TestCase1 : Test delete on directory never existed
     // Ensure directory does not exist
-    Assert.assertFalse(exists(fc2, testPath));
+    assertFalse(exists(fc2, testPath));
 
     // Delete on non existing directory should return false
-    Assert.assertFalse(fc2.delete(testPath, false));
+    assertFalse(fc2.delete(testPath, false));
 
     // TestCase2 : Create dir, Delete dir, Delete dir
     // Create a file on fc2's file system using fc1
 
     fc1.mkdir(testPath, FsPermission.getDefault(), true);
     // Ensure dir exist
-    Assert.assertTrue(exists(fc2, testPath));
+    assertTrue(exists(fc2, testPath));
 
     // Delete test file, deleting existing file should return true
-    Assert.assertTrue(fc2.delete(testPath, false));
+    assertTrue(fc2.delete(testPath, false));
     // Ensure file does not exist
-    Assert.assertFalse(exists(fc2, testPath));
+    assertFalse(exists(fc2, testPath));
     // Delete on non existing file should return false
-    Assert.assertFalse(fc2.delete(testPath, false));
+    assertFalse(fc2.delete(testPath, false));
   }
 
   @Test
@@ -461,7 +465,7 @@ public abstract class FileContextURIBase {
     fc1ModificationTime = fc1.getFileStatus(testPath).getModificationTime();
     fc2ModificationTime = fc2.getFileStatus(testPath).getModificationTime();
     // Ensure fc1 and fc2 reports same modification time
-    Assert.assertEquals(fc1ModificationTime, fc2ModificationTime);
+    assertEquals(fc1ModificationTime, fc2ModificationTime);
   }
 
   @Test
@@ -474,10 +478,10 @@ public abstract class FileContextURIBase {
     FsStatus fc2Status = fc2.getFsStatus(path2);
 
     // FsStatus , used, free and capacity are non-negative longs
-    Assert.assertNotNull(fc2Status);
-    Assert.assertTrue(fc2Status.getCapacity() > 0);
-    Assert.assertTrue(fc2Status.getRemaining() > 0);
-    Assert.assertTrue(fc2Status.getUsed() > 0);
+    assertNotNull(fc2Status);
+    assertTrue(fc2Status.getCapacity() > 0);
+    assertTrue(fc2Status.getRemaining() > 0);
+    assertTrue(fc2Status.getUsed() > 0);
 
   }
 
@@ -488,7 +492,7 @@ public abstract class FileContextURIBase {
     Path testPath = qualifiedPath(testFile, fc2);
     try {
       fc1.getFileStatus(testPath);
-      Assert.fail("Should throw FileNotFoundException");
+      fail("Should throw FileNotFoundException");
     } catch (FileNotFoundException e) {
       // expected
     }
@@ -501,7 +505,7 @@ public abstract class FileContextURIBase {
     Path testPath = qualifiedPath(testFile, fc2);
     try {
       fc1.listStatus(testPath);
-      Assert.fail("Should throw FileNotFoundException");
+      fail("Should throw FileNotFoundException");
     } catch (FileNotFoundException fnfe) {
       // expected
     }
@@ -527,7 +531,7 @@ public abstract class FileContextURIBase {
 
       testDirs.add(qualifiedPath(d, fc2));
     }
-    Assert.assertFalse(exists(fc1, testDirs.get(0)));
+    assertFalse(exists(fc1, testDirs.get(0)));
 
     for (Path path : testDirs) {
      fc1.mkdir(path, FsPermission.getDefault(), true);
@@ -535,11 +539,11 @@ public abstract class FileContextURIBase {
 
     // test listStatus that returns an array of FileStatus
     FileStatus[] paths = fc1.util().listStatus(qualifiedPath("test", fc1));
-    Assert.assertEquals(1, paths.length);
-    Assert.assertEquals(qualifiedPath(hPrefix, fc1), paths[0].getPath());
+    assertEquals(1, paths.length);
+    assertEquals(qualifiedPath(hPrefix, fc1), paths[0].getPath());
 
     paths = fc1.util().listStatus(qualifiedPath(hPrefix, fc1));
-    Assert.assertEquals(testDirs.size(), paths.length);
+    assertEquals(testDirs.size(), paths.length);
     for (int i = 0; i < testDirs.size(); i++) {
       boolean found = false;
       for (int j = 0; j < paths.length; j++) {
@@ -549,17 +553,17 @@ public abstract class FileContextURIBase {
           found = true;
         }
       }
-      Assert.assertTrue(testDirs.get(i) + " not found", found);
+      assertTrue(found, testDirs.get(i) + " not found");
     }
 
     paths = fc1.util().listStatus(qualifiedPath(dirs[0], fc1));
-    Assert.assertEquals(0, paths.length);
+    assertEquals(0, paths.length);
     
     // test listStatus that returns an iterator of FileStatus
     RemoteIterator<FileStatus> pathsItor = 
       fc1.listStatus(qualifiedPath("test", fc1));
-    Assert.assertEquals(qualifiedPath(hPrefix, fc1), pathsItor.next().getPath());
-    Assert.assertFalse(pathsItor.hasNext());
+    assertEquals(qualifiedPath(hPrefix, fc1), pathsItor.next().getPath());
+    assertFalse(pathsItor.hasNext());
 
     pathsItor = fc1.listStatus(qualifiedPath(hPrefix, fc1));
     int dirLen = 0;
@@ -572,12 +576,12 @@ public abstract class FileContextURIBase {
           break;
         }
       }
-      Assert.assertTrue(stat.getPath() + " not found", found);
+      assertTrue(found, stat.getPath() + " not found");
     }
-    Assert.assertEquals(testDirs.size(), dirLen);
+    assertEquals(testDirs.size(), dirLen);
 
     pathsItor = fc1.listStatus(qualifiedPath(dirs[0], fc1));
-    Assert.assertFalse(pathsItor.hasNext());
+    assertFalse(pathsItor.hasNext());
   }
 
   /**

+ 137 - 73
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/SymlinkBaseTest.java

@@ -26,11 +26,15 @@ import org.apache.hadoop.fs.Options.Rename;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.test.GenericTestUtils;
 
-import static org.junit.Assert.*;
-import static org.junit.Assume.assumeTrue;
-import org.junit.Test;
-import org.junit.Before;
-import org.junit.After;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.AfterEach;
 
 /**
  * Base test for symbolic links
@@ -75,25 +79,27 @@ public abstract class SymlinkBaseTest {
         CreateOpts.blockSize(blockSize));
   }
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     wrapper.mkdir(new Path(testBaseDir1()), FileContext.DEFAULT_PERM, true);
     wrapper.mkdir(new Path(testBaseDir2()), FileContext.DEFAULT_PERM, true);
   }
 
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     wrapper.delete(new Path(testBaseDir1()), true);
     wrapper.delete(new Path(testBaseDir2()), true);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** The root is not a symlink */
   public void testStatRoot() throws IOException {
     assertFalse(wrapper.getFileLinkStatus(new Path("/")).isSymlink());
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test setWorkingDirectory not resolves symlinks */
   public void testSetWDNotResolvesLinks() throws IOException {
     Path dir       = new Path(testBaseDir1());
@@ -103,7 +109,8 @@ public abstract class SymlinkBaseTest {
     assertEquals(linkToDir.getName(), wrapper.getWorkingDirectory().getName());
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test create a dangling link */
   public void testCreateDanglingLink() throws IOException {
     Path file = new Path("/noSuchFile");
@@ -118,7 +125,8 @@ public abstract class SymlinkBaseTest {
     wrapper.delete(link, false);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test create a link to null and empty path */
   public void testCreateLinkToNullEmpty() throws IOException {
     Path link = new Path(testBaseDir1()+"/link");
@@ -136,7 +144,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Create a link with createParent set */
   public void testCreateLinkCanCreateParent() throws IOException {
     Path file = new Path(testBaseDir1()+"/file");
@@ -154,7 +163,8 @@ public abstract class SymlinkBaseTest {
     readFile(link);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Try to create a directory given a path that refers to a symlink */
   public void testMkdirExistingLink() throws IOException {
     Path file = new Path(testBaseDir1() + "/targetFile");
@@ -173,7 +183,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Try to create a file with parent that is a dangling link */
   public void testCreateFileViaDanglingLinkParent() throws IOException {
     Path dir  = new Path(testBaseDir1()+"/dangling");
@@ -191,7 +202,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Delete a link */
   public void testDeleteLink() throws IOException {
     Path file = new Path(testBaseDir1()+"/file");
@@ -210,7 +222,8 @@ public abstract class SymlinkBaseTest {
     wrapper.createSymlink(file, link, false);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Ensure open resolves symlinks */
   public void testOpenResolvesLinks() throws IOException {
     Path file = new Path(testBaseDir1()+"/noSuchFile");
@@ -225,7 +238,8 @@ public abstract class SymlinkBaseTest {
     wrapper.delete(link, false);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Stat a link to a file */
   public void testStatLinkToFile() throws IOException {
     Path file = new Path(testBaseDir1()+"/file");
@@ -249,7 +263,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Stat a relative link to a file */
   public void testStatRelLinkToFile() throws IOException {
     assumeTrue(!"file".equals(getScheme()));
@@ -265,7 +280,8 @@ public abstract class SymlinkBaseTest {
                  wrapper.getFileLinkStatus(linkToFile).getPath());
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Stat a link to a directory */
   public void testStatLinkToDir() throws IOException {
     Path dir  = new Path(testBaseDir1());
@@ -283,7 +299,8 @@ public abstract class SymlinkBaseTest {
     assertEquals(dir, wrapper.getLinkTarget(linkToDir));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Stat a dangling link */
   public void testStatDanglingLink() throws IOException {
     Path file = new Path("/noSuchFile");
@@ -293,7 +310,8 @@ public abstract class SymlinkBaseTest {
     assertTrue(wrapper.getFileLinkStatus(link).isSymlink());
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Stat a non-existant file */
   public void testStatNonExistentFiles() throws IOException {
     Path fileAbs = new Path("/doesNotExist");
@@ -311,7 +329,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test stat'ing a regular file and directory */
   public void testStatNonLinks() throws IOException {
     Path dir   = new Path(testBaseDir1());
@@ -331,7 +350,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test links that link to each other */
   public void testRecursiveLinks() throws IOException {
     Path link1 = new Path(testBaseDir1()+"/link1");
@@ -420,7 +440,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test creating a symlink using relative paths */
   public void testCreateLinkUsingRelPaths() throws IOException {
     Path fileAbs = new Path(testBaseDir1(), "file");
@@ -446,7 +467,8 @@ public abstract class SymlinkBaseTest {
     readFile(linkViaDir2);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test creating a symlink using absolute paths */
   public void testCreateLinkUsingAbsPaths() throws IOException {
     Path fileAbs = new Path(testBaseDir1()+"/file");
@@ -473,7 +495,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /**
    * Test creating a symlink using fully and partially qualified paths.
    * NB: For local fs this actually tests partially qualified paths,
@@ -506,7 +529,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /**
    * Test creating a symlink using partially qualified paths, ie a scheme
    * but no authority and vice versa. We just test link targets here since
@@ -549,7 +573,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Same as above but vice versa (authority but no scheme) */
   public void testCreateLinkUsingPartQualPath2() throws IOException {
     Path link         = new Path(testBaseDir1(), "linkToFile");
@@ -577,7 +602,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Lstat and readlink on a normal file and directory */
   public void testLinkStatusAndTargetWithNonLink() throws IOException {
     Path schemeAuth = new Path(testURI().toString());
@@ -602,7 +628,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test create symlink to a directory */
   public void testCreateLinkToDirectory() throws IOException {
     Path dir1      = new Path(testBaseDir1());
@@ -616,7 +643,8 @@ public abstract class SymlinkBaseTest {
     assertTrue(wrapper.getFileLinkStatus(linkToDir).isSymlink());
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test create and remove a file through a symlink */
   public void testCreateFileViaSymlink() throws IOException {
     Path dir         = new Path(testBaseDir1());
@@ -633,7 +661,8 @@ public abstract class SymlinkBaseTest {
     assertFalse(wrapper.exists(fileViaLink));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test make and delete directory through a symlink */
   public void testCreateDirViaSymlink() throws IOException {
     Path dir1          = new Path(testBaseDir1());
@@ -648,7 +677,8 @@ public abstract class SymlinkBaseTest {
     assertFalse(wrapper.exists(subDir));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Create symlink through a symlink */
   public void testCreateLinkViaLink() throws IOException {
     Path dir1        = new Path(testBaseDir1());
@@ -670,7 +700,8 @@ public abstract class SymlinkBaseTest {
     assertEquals(fileViaLink, wrapper.getLinkTarget(linkToFile));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test create symlink to a directory */
   public void testListStatusUsingLink() throws IOException {
     Path file  = new Path(testBaseDir1(), "file");
@@ -690,7 +721,8 @@ public abstract class SymlinkBaseTest {
     assertTrue(dirLen == 2 || dirLen == 3);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test create symlink using the same path */
   public void testCreateLinkTwice() throws IOException {
     Path file = new Path(testBaseDir1(), "file");
@@ -705,7 +737,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test access via a symlink to a symlink */
   public void testCreateLinkToLink() throws IOException {
     Path dir1        = new Path(testBaseDir1());
@@ -723,7 +756,8 @@ public abstract class SymlinkBaseTest {
     readFile(fileViaLink);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Can not create a file with path that refers to a symlink */
   public void testCreateFileDirExistingLink() throws IOException {
     Path file = new Path(testBaseDir1(), "file");
@@ -744,7 +778,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test deleting and recreating a symlink */
   public void testUseLinkAferDeleteLink() throws IOException {
     Path file = new Path(testBaseDir1(), "file");
@@ -763,7 +798,8 @@ public abstract class SymlinkBaseTest {
     readFile(link);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test create symlink to . */
   public void testCreateLinkToDot() throws IOException {
     Path dir  = new Path(testBaseDir1());
@@ -780,7 +816,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test create symlink to .. */
   public void testCreateLinkToDotDot() throws IOException {
     Path file        = new Path(testBaseDir1(), "test/file");
@@ -795,7 +832,8 @@ public abstract class SymlinkBaseTest {
     assertEquals(fileSize, wrapper.getFileStatus(fileViaLink).getLen());
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test create symlink to ../file */
   public void testCreateLinkToDotDotPrefix() throws IOException {
     Path file = new Path(testBaseDir1(), "file");
@@ -809,7 +847,8 @@ public abstract class SymlinkBaseTest {
     assertEquals(new Path("../file"), wrapper.getLinkTarget(link));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test rename file using a path that contains a symlink. The rename should
    * work as if the path did not contain a symlink */
   public void testRenameFileViaSymlink() throws IOException {
@@ -826,7 +865,8 @@ public abstract class SymlinkBaseTest {
     assertTrue(wrapper.exists(fileNewViaLink));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test rename a file through a symlink but this time only the
    * destination path has an intermediate symlink. The rename should work
    * as if the path did not contain a symlink */
@@ -848,7 +888,8 @@ public abstract class SymlinkBaseTest {
     assertTrue(wrapper.exists(file));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Similar tests as the previous ones but rename a directory */
   public void testRenameDirViaSymlink() throws IOException {
     Path baseDir       = new Path(testBaseDir1());
@@ -865,7 +906,8 @@ public abstract class SymlinkBaseTest {
     assertTrue(wrapper.exists(dirNewViaLink));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Similar tests as the previous ones but rename a symlink */
   public void testRenameSymlinkViaSymlink() throws IOException {
     Path baseDir        = new Path(testBaseDir1());
@@ -885,7 +927,8 @@ public abstract class SymlinkBaseTest {
     readFile(linkNewViaLink);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test rename a directory to a symlink to a directory */
   public void testRenameDirToSymlinkToDir() throws IOException {
     Path dir1      = new Path(testBaseDir1());
@@ -904,7 +947,8 @@ public abstract class SymlinkBaseTest {
     assertTrue(wrapper.exists(linkToDir));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test rename a directory to a symlink to a file */
   public void testRenameDirToSymlinkToFile() throws IOException {
     Path dir1 = new Path(testBaseDir1());
@@ -923,7 +967,8 @@ public abstract class SymlinkBaseTest {
     assertTrue(wrapper.exists(linkToFile));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test rename a directory to a dangling symlink */
   public void testRenameDirToDanglingSymlink() throws IOException {
     Path dir = new Path(testBaseDir1());
@@ -940,7 +985,8 @@ public abstract class SymlinkBaseTest {
     assertTrue(wrapper.getFileLinkStatus(link) != null);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test rename a file to a symlink to a directory */
   public void testRenameFileToSymlinkToDir() throws IOException {
     Path file   = new Path(testBaseDir1(), "file");
@@ -963,7 +1009,8 @@ public abstract class SymlinkBaseTest {
     assertFalse(wrapper.getFileLinkStatus(link).isSymlink());
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test rename a file to a symlink to a file */
   public void testRenameFileToSymlinkToFile() throws IOException {
     Path file1 = new Path(testBaseDir1(), "file1");
@@ -986,7 +1033,8 @@ public abstract class SymlinkBaseTest {
     assertFalse(wrapper.getFileLinkStatus(link).isSymlink());
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test rename a file to a dangling symlink */
   public void testRenameFileToDanglingSymlink() throws IOException {
     /* NB: Local file system doesn't handle dangling links correctly
@@ -1010,7 +1058,8 @@ public abstract class SymlinkBaseTest {
     assertFalse(wrapper.getFileLinkStatus(link).isSymlink());
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Rename a symlink to a new non-existant name */
   public void testRenameSymlinkNonExistantDest() throws IOException {
     Path file  = new Path(testBaseDir1(), "file");
@@ -1025,7 +1074,8 @@ public abstract class SymlinkBaseTest {
     assertFalse(wrapper.exists(link1));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Rename a symlink to a file that exists */
   public void testRenameSymlinkToExistingFile() throws IOException {
     Path file1 = new Path(testBaseDir1(), "file");
@@ -1047,7 +1097,8 @@ public abstract class SymlinkBaseTest {
     assertEquals(file2, wrapper.getLinkTarget(file1));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Rename a symlink to a directory that exists */
   public void testRenameSymlinkToExistingDir() throws IOException {
     Path dir1   = new Path(testBaseDir1());
@@ -1080,7 +1131,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Rename a symlink to itself */
   public void testRenameSymlinkToItself() throws IOException {
     Path file = new Path(testBaseDir1(), "file");
@@ -1103,7 +1155,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Rename a symlink */
   public void testRenameSymlink() throws IOException {
     Path file  = new Path(testBaseDir1(), "file");
@@ -1124,7 +1177,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Rename a symlink to the file it links to */
   public void testRenameSymlinkToFileItLinksTo() throws IOException {
     /* NB: The rename is not atomic, so file is deleted before renaming
@@ -1162,7 +1216,8 @@ public abstract class SymlinkBaseTest {
     assertEquals(file, wrapper.getLinkTarget(link));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Rename a symlink to the directory it links to */
   public void testRenameSymlinkToDirItLinksTo() throws IOException {
     /* NB: The rename is not atomic, so dir is deleted before renaming
@@ -1200,7 +1255,8 @@ public abstract class SymlinkBaseTest {
     assertEquals(dir, wrapper.getLinkTarget(link));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test rename the symlink's target */
   public void testRenameLinkTarget() throws IOException {
     Path file    = new Path(testBaseDir1(), "file");
@@ -1219,7 +1275,8 @@ public abstract class SymlinkBaseTest {
     readFile(link);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test rename a file to path with destination that has symlink parent */
   public void testRenameFileWithDestParentSymlink() throws IOException {
     Path link  = new Path(testBaseDir1(), "link");
@@ -1257,7 +1314,8 @@ public abstract class SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /**
    * Create, write, read, append, rename, get the block locations,
    * checksums, and delete a file using a path with a symlink as an
@@ -1296,7 +1354,8 @@ public abstract class SymlinkBaseTest {
     assertFalse(wrapper.exists(fileNewViaLink));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /**
    * Operate on a file using a path with an intermediate symlink where
    * the link target was specified as a fully qualified path.
@@ -1315,7 +1374,8 @@ public abstract class SymlinkBaseTest {
     readFile(fileViaLink);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /**
    * Operate on a file using a path with an intermediate symlink where
    * the link target was specified as a relative path.
@@ -1345,7 +1405,8 @@ public abstract class SymlinkBaseTest {
                  wrapper.getFileLinkStatus(file));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test create, list, and delete a directory through a symlink */
   public void testAccessDirViaSymlink() throws IOException {
     Path baseDir    = new Path(testBaseDir1());
@@ -1364,7 +1425,8 @@ public abstract class SymlinkBaseTest {
     assertFalse(wrapper.exists(dir));
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** setTimes affects the target file not the link */
   public void testSetTimesSymlinkToFile() throws IOException {
     Path file = new Path(testBaseDir1(), "file");
@@ -1374,13 +1436,14 @@ public abstract class SymlinkBaseTest {
     long at = wrapper.getFileLinkStatus(link).getAccessTime();
     // the local file system may not support millisecond timestamps
     wrapper.setTimes(link, 2000L, 3000L);
-    assertTrue("The atime of symlink should not be lesser after setTimes()",
-        wrapper.getFileLinkStatus(link).getAccessTime() >= at);
+    assertTrue(wrapper.getFileLinkStatus(link).getAccessTime() >= at,
+        "The atime of symlink should not be lesser after setTimes()");
     assertEquals(2000, wrapper.getFileStatus(file).getModificationTime());
     assertEquals(3000, wrapper.getFileStatus(file).getAccessTime());
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** setTimes affects the target directory not the link */
   public void testSetTimesSymlinkToDir() throws IOException {
     Path dir = new Path(testBaseDir1(), "dir");
@@ -1390,13 +1453,14 @@ public abstract class SymlinkBaseTest {
     long at = wrapper.getFileLinkStatus(link).getAccessTime();
     // the local file system may not support millisecond timestamps
     wrapper.setTimes(link, 2000L, 3000L);
-    assertTrue("The atime of symlink should not be lesser after setTimes()",
-        wrapper.getFileLinkStatus(link).getAccessTime() >= at);
+    assertTrue(wrapper.getFileLinkStatus(link).getAccessTime() >= at,
+        "The atime of symlink should not be lesser after setTimes()");
     assertEquals(2000, wrapper.getFileStatus(dir).getModificationTime());
     assertEquals(3000, wrapper.getFileStatus(dir).getAccessTime());
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** setTimes does not affect the link even though target does not exist */
   public void testSetTimesDanglingLink() throws IOException {
     Path file = new Path("/noSuchFile");
@@ -1409,7 +1473,7 @@ public abstract class SymlinkBaseTest {
     } catch (IOException e) {
       // Expected
     }
-    assertTrue("The atime of symlink should not be lesser after setTimes()",
-        wrapper.getFileLinkStatus(link).getAccessTime() >= at);
+    assertTrue(wrapper.getFileLinkStatus(link).getAccessTime() >= at,
+        "The atime of symlink should not be lesser after setTimes()");
   }
 }

+ 2 - 2
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFSFileContextCreateMkdir.java

@@ -18,13 +18,13 @@
 package org.apache.hadoop.fs;
 
 
-import org.junit.Before;
+import org.junit.jupiter.api.BeforeEach;
 
 public class TestLocalFSFileContextCreateMkdir extends
   FileContextCreateMkdirBaseTest {
 
   @Override
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     fc = FileContext.getLocalFSFileContext();
     super.setUp();

+ 7 - 6
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFSFileContextMainOperations.java

@@ -17,20 +17,21 @@
  */
 package org.apache.hadoop.fs;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.IOException;
 
 import org.apache.hadoop.conf.Configuration;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.apache.hadoop.fs.FileContextTestHelper;
 import org.apache.hadoop.fs.permission.FsPermission;
 
 public class TestLocalFSFileContextMainOperations extends FileContextMainOperationsBaseTest {
 
   @Override
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     fc = FileContext.getLocalFSFileContext();
     super.setUp();
@@ -47,7 +48,7 @@ public class TestLocalFSFileContextMainOperations extends FileContextMainOperati
   @Test
   public void testFileContextNoCache() throws UnsupportedFileSystemException {
     FileContext fc1 = FileContext.getLocalFSFileContext();
-    Assert.assertTrue(fc1 != fc);
+    assertTrue(fc1 != fc);
   }
   
   @Override
@@ -61,7 +62,7 @@ public class TestLocalFSFileContextMainOperations extends FileContextMainOperati
         "testDefaultFilePermission");
     FileContextTestHelper.createFile(fc, file);
     FsPermission expect = FileContext.FILE_DEFAULT_PERM.applyUMask(fc.getUMask());
-    Assert.assertEquals(expect, fc.getFileStatus(file)
+    assertEquals(expect, fc.getFileStatus(file)
         .getPermission());
   }
 }

+ 8 - 7
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFsFCStatistics.java

@@ -18,12 +18,13 @@
 
 package org.apache.hadoop.fs;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 import java.net.URI;
 
 import org.apache.hadoop.fs.FileSystem.Statistics;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 
 /**
  * <p>
@@ -34,13 +35,13 @@ public class TestLocalFsFCStatistics extends FCStatisticsBaseTest {
   
   static final String LOCAL_FS_ROOT_URI =  "file:///tmp/test";
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     fc = FileContext.getLocalFSFileContext();
     fc.mkdir(fileContextTestHelper.getTestRootPath(fc, "test"), FileContext.DEFAULT_PERM, true);
   }
 
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     fc.delete(fileContextTestHelper.getTestRootPath(fc, "test"), true);
   }
@@ -48,13 +49,13 @@ public class TestLocalFsFCStatistics extends FCStatisticsBaseTest {
   @Override
   protected void verifyReadBytes(Statistics stats) {
     // one blockSize for read, one for pread
-    Assert.assertEquals(2*blockSize, stats.getBytesRead());
+    assertEquals(2*blockSize, stats.getBytesRead());
   }
 
   @Override
   protected void verifyWrittenBytes(Statistics stats) {
     //Extra 12 bytes are written apart from the block.
-    Assert.assertEquals(blockSize + 12, stats.getBytesWritten());
+    assertEquals(blockSize + 12, stats.getBytesWritten());
   }
   
   @Override

+ 12 - 8
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestSymlinkLocalFS.java

@@ -18,10 +18,10 @@
 package org.apache.hadoop.fs;
 
 import static org.apache.hadoop.test.PlatformAssumptions.assumeNotWindows;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-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.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 import static org.junit.Assume.assumeTrue;
 
 import java.io.File;
@@ -32,7 +32,8 @@ import java.net.URISyntaxException;
 
 import org.apache.hadoop.util.Shell;
 import org.apache.hadoop.security.UserGroupInformation;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 
 /**
  * Test symbolic links using LocalFs.
@@ -105,7 +106,8 @@ abstract public class TestSymlinkLocalFS extends SymlinkBaseTest {
     super.testStatDanglingLink();
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** lstat a non-existant file using a partially qualified path */
   public void testDanglingLinkFilePartQual() throws IOException {
     Path filePartQual = new Path(getScheme()+":///doesNotExist");
@@ -123,7 +125,8 @@ abstract public class TestSymlinkLocalFS extends SymlinkBaseTest {
     }
   }
   
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Stat and lstat a dangling link */
   public void testDanglingLink() throws IOException {
     assumeNotWindows();
@@ -169,7 +172,8 @@ abstract public class TestSymlinkLocalFS extends SymlinkBaseTest {
     wrapper.getFileStatus(link);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** 
    * Test getLinkTarget with a partially qualified target. 
    * NB: Hadoop does not support fully qualified URIs for the 

+ 2 - 2
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestSymlinkLocalFSFileContext.java

@@ -17,7 +17,7 @@
  */
 package org.apache.hadoop.fs;
 
-import org.junit.BeforeClass;
+import org.junit.jupiter.api.BeforeAll;
 
 import java.io.IOException;
 
@@ -25,7 +25,7 @@ import static org.apache.hadoop.test.PlatformAssumptions.assumeNotWindows;
 
 public class TestSymlinkLocalFSFileContext extends TestSymlinkLocalFS {
 
-  @BeforeClass
+  @BeforeAll
   public static void testSetup() throws Exception {
     FileContext context = FileContext.getLocalFSFileContext();
     wrapper = new FileContextTestWrapper(context);

+ 21 - 15
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestSymlinkLocalFSFileSystem.java

@@ -22,43 +22,48 @@ import java.io.IOException;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Options.Rename;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 
 import static org.apache.hadoop.test.PlatformAssumptions.assumeNotWindows;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 public class TestSymlinkLocalFSFileSystem extends TestSymlinkLocalFS {
 
-  @BeforeClass
+  @BeforeAll
   public static void testSetup() throws Exception {
     FileSystem filesystem = FileSystem.getLocal(new Configuration());
     wrapper = new FileSystemTestWrapper(filesystem);
   }
 
-  @Ignore("RawLocalFileSystem#mkdir does not treat existence of directory" +
+  @Disabled("RawLocalFileSystem#mkdir does not treat existence of directory" +
       " as an error")
   @Override
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   public void testMkdirExistingLink() throws IOException {}
 
-  @Ignore("FileSystem#create defaults to creating parents," +
+  @Disabled("FileSystem#create defaults to creating parents," +
       " throwing an IOException instead of FileNotFoundException")
   @Override
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   public void testCreateFileViaDanglingLinkParent() throws IOException {}
 
-  @Ignore("RawLocalFileSystem does not throw an exception if the path" +
+  @Disabled("RawLocalFileSystem does not throw an exception if the path" +
       " already exists")
   @Override
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   public void testCreateFileDirExistingLink() throws IOException {}
   
-  @Ignore("ChecksumFileSystem does not support append")
+  @Disabled("ChecksumFileSystem does not support append")
   @Override
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   public void testAccessFileViaInterSymlinkAbsTarget() throws IOException {}
 
   @Override
@@ -68,7 +73,8 @@ public class TestSymlinkLocalFSFileSystem extends TestSymlinkLocalFS {
   }
 
   @Override
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Rename a symlink to itself */
   public void testRenameSymlinkToItself() throws IOException {
     Path file = new Path(testBaseDir1(), "file");

+ 4 - 11
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestFSMainOperationsLocalFileSystem.java

@@ -17,18 +17,11 @@
  */
 package org.apache.hadoop.fs.viewfs;
 
-
-
-import java.io.IOException;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSMainOperationsBaseTest;
 import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 
 public class TestFSMainOperationsLocalFileSystem extends FSMainOperationsBaseTest {
   FileSystem fcTarget;
@@ -40,7 +33,7 @@ public class TestFSMainOperationsLocalFileSystem extends FSMainOperationsBaseTes
   }
    
   @Override
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     Configuration conf = new Configuration();
     fcTarget = FileSystem.getLocal(conf);
@@ -48,7 +41,7 @@ public class TestFSMainOperationsLocalFileSystem extends FSMainOperationsBaseTes
   }
 
   @Override
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     super.tearDown();
     ViewFileSystemTestSetup.tearDown(this, fcTarget);

+ 4 - 4
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestFcCreateMkdirLocalFs.java

@@ -20,8 +20,8 @@ package org.apache.hadoop.fs.viewfs;
 
 import org.apache.hadoop.fs.FileContextCreateMkdirBaseTest;
 
-import org.junit.After;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 
 
 public class TestFcCreateMkdirLocalFs  extends 
@@ -29,14 +29,14 @@ public class TestFcCreateMkdirLocalFs  extends
 
 
   @Override
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     fc = ViewFsTestSetup.setupForViewFsLocalFs(fileContextTestHelper);
     super.setUp();
   }
   
   @Override
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     super.tearDown();
     ViewFsTestSetup.tearDownForViewFsLocalFs(fileContextTestHelper);

+ 4 - 4
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestFcMainOperationsLocalFs.java

@@ -22,8 +22,8 @@ import org.apache.hadoop.fs.FileContext;
 import org.apache.hadoop.fs.FileContextMainOperationsBaseTest;
 import org.apache.hadoop.fs.Path;
 
-import org.junit.After;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 
 
 public class TestFcMainOperationsLocalFs  extends 
@@ -33,14 +33,14 @@ public class TestFcMainOperationsLocalFs  extends
   Path targetOfTests;
 
   @Override
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     fc = ViewFsTestSetup.setupForViewFsLocalFs(fileContextTestHelper);
     super.setUp();
   }
   
   @Override
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     super.tearDown();
     ViewFsTestSetup.tearDownForViewFsLocalFs(fileContextTestHelper);

+ 4 - 4
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsLocalFs.java

@@ -20,14 +20,14 @@ package org.apache.hadoop.fs.viewfs;
 import org.apache.hadoop.fs.FileContext;
 
 
-import org.junit.After;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 
 
 public class TestViewFsLocalFs extends ViewFsBaseTest {
 
   @Override
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     // create the test root on local_fs
     fcTarget = FileContext.getLocalFSFileContext();
@@ -36,7 +36,7 @@ public class TestViewFsLocalFs extends ViewFsBaseTest {
   }
 
   @Override
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     super.tearDown();
   }

+ 16 - 17
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsWithAuthorityLocalFs.java

@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.fs.viewfs;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.net.URI;
 
@@ -24,10 +25,9 @@ import org.apache.hadoop.fs.FileContext;
 import org.apache.hadoop.fs.FsConstants;
 import org.apache.hadoop.fs.Path;
 
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 /**
  * 
@@ -42,7 +42,7 @@ public class TestViewFsWithAuthorityLocalFs extends ViewFsBaseTest {
   URI schemeWithAuthority;
 
   @Override
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     // create the test root on local_fs
     fcTarget = FileContext.getLocalFSFileContext();
@@ -55,7 +55,7 @@ public class TestViewFsWithAuthorityLocalFs extends ViewFsBaseTest {
   }
 
   @Override
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     super.tearDown();
   }
@@ -63,16 +63,15 @@ public class TestViewFsWithAuthorityLocalFs extends ViewFsBaseTest {
   @Override
   @Test
   public void testBasicPaths() {
-      Assert.assertEquals(schemeWithAuthority,
-          fcView.getDefaultFileSystem().getUri());
-      Assert.assertEquals(fcView.makeQualified(
-          new Path("/user/" + System.getProperty("user.name"))),
-          fcView.getWorkingDirectory());
-      Assert.assertEquals(fcView.makeQualified(
-          new Path("/user/" + System.getProperty("user.name"))),
-          fcView.getHomeDirectory());
-      Assert.assertEquals(
-          new Path("/foo/bar").makeQualified(schemeWithAuthority, null),
-          fcView.makeQualified(new Path("/foo/bar")));
+    assertEquals(schemeWithAuthority, fcView.getDefaultFileSystem().getUri());
+    assertEquals(fcView.makeQualified(
+        new Path("/user/" + System.getProperty("user.name"))),
+        fcView.getWorkingDirectory());
+    assertEquals(fcView.makeQualified(
+        new Path("/user/" + System.getProperty("user.name"))),
+        fcView.getHomeDirectory());
+    assertEquals(
+        new Path("/foo/bar").makeQualified(schemeWithAuthority, null),
+        fcView.makeQualified(new Path("/foo/bar")));
   }
 }

+ 313 - 237
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java

@@ -17,15 +17,18 @@
  */
 package org.apache.hadoop.fs.viewfs;
 
-import static org.assertj.core.api.Assertions.assertThat;
 import static org.apache.hadoop.fs.FileContextTestHelper.checkFileLinkStatus;
 import static org.apache.hadoop.fs.FileContextTestHelper.checkFileStatus;
 import static org.apache.hadoop.fs.FileContextTestHelper.exists;
 import static org.apache.hadoop.fs.FileContextTestHelper.isDir;
 import static org.apache.hadoop.fs.FileContextTestHelper.isFile;
 import static org.apache.hadoop.fs.viewfs.Constants.PERMISSION_555;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.ArgumentMatchers.anyString;
@@ -71,10 +74,9 @@ import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.test.GenericTestUtils;
 import org.apache.hadoop.test.LambdaTestUtils;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 
 /**
@@ -111,7 +113,7 @@ abstract public class ViewFsBaseTest {
     return new FileContextTestHelper();
   }
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     initializeTargetTestRoot();
     
@@ -163,7 +165,7 @@ abstract public class ViewFsBaseTest {
     fcTarget.mkdir(targetTestRoot, FileContext.DEFAULT_PERM, true);
   }
 
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     fcTarget.delete(fileContextTestHelper.getTestRootPath(fcTarget), true);
   }
@@ -172,7 +174,7 @@ abstract public class ViewFsBaseTest {
   public void testGetMountPoints() {
     ViewFs viewfs = (ViewFs) fcView.getDefaultFileSystem();
     MountPoint[] mountPoints = viewfs.getMountPoints();
-    Assert.assertEquals(8, mountPoints.length);
+    assertEquals(8, mountPoints.length);
   }
   
   int getExpectedDelegationTokenCount() {
@@ -188,21 +190,21 @@ abstract public class ViewFsBaseTest {
   public void testGetDelegationTokens() throws IOException {
     List<Token<?>> delTokens = 
         fcView.getDelegationTokens(new Path("/"), "sanjay");
-    Assert.assertEquals(getExpectedDelegationTokenCount(), delTokens.size());
+    assertEquals(getExpectedDelegationTokenCount(), delTokens.size());
   }
 
   
   @Test
   public void testBasicPaths() {
-    Assert.assertEquals(FsConstants.VIEWFS_URI,
+    assertEquals(FsConstants.VIEWFS_URI,
         fcView.getDefaultFileSystem().getUri());
-    Assert.assertEquals(fcView.makeQualified(
+    assertEquals(fcView.makeQualified(
         new Path("/user/" + System.getProperty("user.name"))),
         fcView.getWorkingDirectory());
-    Assert.assertEquals(fcView.makeQualified(
+    assertEquals(fcView.makeQualified(
         new Path("/user/" + System.getProperty("user.name"))),
         fcView.getHomeDirectory());
-    Assert.assertEquals(
+    assertEquals(
         new Path("/foo/bar").makeQualified(FsConstants.VIEWFS_URI, null),
         fcView.makeQualified(new Path("/foo/bar")));
   }
@@ -220,118 +222,113 @@ abstract public class ViewFsBaseTest {
   public void testOperationsThroughMountLinks() throws IOException {
     // Create file 
     fileContextTestHelper.createFileNonRecursive(fcView, "/user/foo");
-    Assert.assertTrue("Create file should be file",
-		isFile(fcView, new Path("/user/foo")));
-    Assert.assertTrue("Target of created file should be type file",
-        isFile(fcTarget, new Path(targetTestRoot,"user/foo")));
+    assertTrue(isFile(fcView, new Path("/user/foo")),
+        "Create file should be file");
+    assertTrue(isFile(fcTarget, new Path(targetTestRoot, "user/foo")),
+        "Target of created file should be type file");
     
     // Delete the created file
-    Assert.assertTrue("Delete should succeed",
-        fcView.delete(new Path("/user/foo"), false));
-    Assert.assertFalse("File should not exist after delete",
-        exists(fcView, new Path("/user/foo")));
-    Assert.assertFalse("Target File should not exist after delete",
-        exists(fcTarget, new Path(targetTestRoot,"user/foo")));
+    assertTrue(fcView.delete(new Path("/user/foo"), false),
+        "Delete should succeed");
+    assertFalse(exists(fcView, new Path("/user/foo")), "File should not exist after delete");
+    assertFalse(exists(fcTarget, new Path(targetTestRoot, "user/foo")),
+        "Target File should not exist after delete");
     
     // Create file with a 2 component dirs
     fileContextTestHelper.createFileNonRecursive(fcView,
         "/internalDir/linkToDir2/foo");
-    Assert.assertTrue("Created file should be type file",
-        isFile(fcView, new Path("/internalDir/linkToDir2/foo")));
-    Assert.assertTrue("Target of created file should be type file",
-        isFile(fcTarget, new Path(targetTestRoot,"dir2/foo")));
+    assertTrue(isFile(fcView, new Path("/internalDir/linkToDir2/foo")),
+        "Created file should be type file");
+    assertTrue(isFile(fcTarget, new Path(targetTestRoot, "dir2/foo")),
+        "Target of created file should be type file");
     
     // Delete the created file
-    Assert.assertTrue("Delete should succeed",
-        fcView.delete(new Path("/internalDir/linkToDir2/foo"),false));
-    Assert.assertFalse("File should not exist after deletion",
-        exists(fcView, new Path("/internalDir/linkToDir2/foo")));
-    Assert.assertFalse("Target should not exist after deletion",
-        exists(fcTarget, new Path(targetTestRoot,"dir2/foo")));
+    assertTrue(fcView.delete(new Path("/internalDir/linkToDir2/foo"), false),
+        "Delete should succeed");
+    assertFalse(exists(fcView, new Path("/internalDir/linkToDir2/foo")),
+        "File should not exist after deletion");
+    assertFalse(exists(fcTarget, new Path(targetTestRoot, "dir2/foo")),
+        "Target should not exist after deletion");
     
     
     // Create file with a 3 component dirs
     fileContextTestHelper.createFileNonRecursive(fcView,
         "/internalDir/internalDir2/linkToDir3/foo");
-    Assert.assertTrue("Created file should be of type file", 
-        isFile(fcView, new Path("/internalDir/internalDir2/linkToDir3/foo")));
-    Assert.assertTrue("Target of created file should also be type file",
-        isFile(fcTarget, new Path(targetTestRoot,"dir3/foo")));
+    assertTrue(isFile(fcView, new Path("/internalDir/internalDir2/linkToDir3/foo")),
+        "Created file should be of type file");
+    assertTrue(isFile(fcTarget, new Path(targetTestRoot, "dir3/foo")),
+        "Target of created file should also be type file");
     
     // Recursive Create file with missing dirs
     fileContextTestHelper.createFile(fcView,
         "/internalDir/linkToDir2/missingDir/miss2/foo");
-    Assert.assertTrue("Created file should be of type file",
-      isFile(fcView, new Path("/internalDir/linkToDir2/missingDir/miss2/foo")));
-    Assert.assertTrue("Target of created file should also be type file",
-        isFile(fcTarget, new Path(targetTestRoot,"dir2/missingDir/miss2/foo")));
+    assertTrue(isFile(fcView, new Path("/internalDir/linkToDir2/missingDir/miss2/foo")),
+        "Created file should be of type file");
+    assertTrue(isFile(fcTarget, new Path(targetTestRoot, "dir2/missingDir/miss2/foo")),
+        "Target of created file should also be type file");
 
     
     // Delete the created file
-    Assert.assertTrue("Delete should succeed",  fcView.delete(
-        new Path("/internalDir/internalDir2/linkToDir3/foo"), false));
-    Assert.assertFalse("Deleted File should not exist", 
-        exists(fcView, new Path("/internalDir/internalDir2/linkToDir3/foo")));
-    Assert.assertFalse("Target of deleted file should not exist", 
-        exists(fcTarget, new Path(targetTestRoot,"dir3/foo")));
+    assertTrue(fcView.delete(new Path("/internalDir/internalDir2/linkToDir3/foo"), false),
+        "Delete should succeed");
+    assertFalse(exists(fcView, new Path("/internalDir/internalDir2/linkToDir3/foo")),
+        "Deleted File should not exist");
+    assertFalse(exists(fcTarget, new Path(targetTestRoot, "dir3/foo")),
+        "Target of deleted file should not exist");
     
       
     // mkdir
     fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/user/dirX"),
         FileContext.DEFAULT_PERM, false);
-    Assert.assertTrue("New dir should be type dir", 
-        isDir(fcView, new Path("/user/dirX")));
-    Assert.assertTrue("Target of new dir should be of type dir",
-        isDir(fcTarget, new Path(targetTestRoot,"user/dirX")));
+    assertTrue(isDir(fcView, new Path("/user/dirX")), "New dir should be type dir");
+    assertTrue(isDir(fcTarget, new Path(targetTestRoot, "user/dirX")),
+        "Target of new dir should be of type dir");
     
     fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/user/dirX/dirY"),
         FileContext.DEFAULT_PERM, false);
-    Assert.assertTrue("New dir should be type dir", 
-        isDir(fcView, new Path("/user/dirX/dirY")));
-    Assert.assertTrue("Target of new dir should be of type dir",
-        isDir(fcTarget,new Path(targetTestRoot,"user/dirX/dirY")));
+    assertTrue(isDir(fcView, new Path("/user/dirX/dirY")),
+        "New dir should be type dir");
+    assertTrue(isDir(fcTarget, new Path(targetTestRoot, "user/dirX/dirY")),
+        "Target of new dir should be of type dir");
     
 
     // Delete the created dir
-    Assert.assertTrue("Delete should succeed",
-        fcView.delete(new Path("/user/dirX/dirY"), false));
-    Assert.assertFalse("Deleted File should not exist",
-        exists(fcView, new Path("/user/dirX/dirY")));
-    Assert.assertFalse("Deleted Target should not exist", 
-        exists(fcTarget, new Path(targetTestRoot,"user/dirX/dirY")));
+    assertTrue(fcView.delete(new Path("/user/dirX/dirY"), false),
+        "Delete should succeed");
+    assertFalse(exists(fcView, new Path("/user/dirX/dirY")),
+        "Deleted File should not exist");
+    assertFalse(exists(fcTarget, new Path(targetTestRoot, "user/dirX/dirY")),
+        "Deleted Target should not exist");
     
-    Assert.assertTrue("Delete should succeed",
-        fcView.delete(new Path("/user/dirX"), false));
-    Assert.assertFalse("Deleted File should not exist",
-        exists(fcView, new Path("/user/dirX")));
-    Assert.assertFalse("Deleted Target should not exist",
-        exists(fcTarget, new Path(targetTestRoot,"user/dirX")));
+    assertTrue(fcView.delete(new Path("/user/dirX"), false), "Delete should succeed");
+    assertFalse(exists(fcView, new Path("/user/dirX")),
+        "Deleted File should not exist");
+    assertFalse(exists(fcTarget, new Path(targetTestRoot, "user/dirX")),
+        "Deleted Target should not exist");
     
     // Rename a file 
     fileContextTestHelper.createFile(fcView, "/user/foo");
     fcView.rename(new Path("/user/foo"), new Path("/user/fooBar"));
-    Assert.assertFalse("Renamed src should not exist", 
-        exists(fcView, new Path("/user/foo")));
-    Assert.assertFalse(exists(fcTarget, new Path(targetTestRoot,"user/foo")));
-    Assert.assertTrue(isFile(fcView,
+    assertFalse(exists(fcView, new Path("/user/foo")), "Renamed src should not exist");
+    assertFalse(exists(fcTarget, new Path(targetTestRoot, "user/foo")));
+    assertTrue(isFile(fcView,
         fileContextTestHelper.getTestRootPath(fcView,"/user/fooBar")));
-    Assert.assertTrue(isFile(fcTarget, new Path(targetTestRoot,"user/fooBar")));
+    assertTrue(isFile(fcTarget, new Path(targetTestRoot, "user/fooBar")));
     
     fcView.mkdir(new Path("/user/dirFoo"), FileContext.DEFAULT_PERM, false);
     fcView.rename(new Path("/user/dirFoo"), new Path("/user/dirFooBar"));
-    Assert.assertFalse("Renamed src should not exist",
-        exists(fcView, new Path("/user/dirFoo")));
-    Assert.assertFalse("Renamed src should not exist in target",
-        exists(fcTarget, new Path(targetTestRoot,"user/dirFoo")));
-    Assert.assertTrue("Renamed dest should  exist as dir",
-        isDir(fcView,
-        fileContextTestHelper.getTestRootPath(fcView,"/user/dirFooBar")));
-    Assert.assertTrue("Renamed dest should  exist as dir in target",
-        isDir(fcTarget,new Path(targetTestRoot,"user/dirFooBar")));
+    assertFalse(exists(fcView, new Path("/user/dirFoo")),
+        "Renamed src should not exist");
+    assertFalse(exists(fcTarget, new Path(targetTestRoot, "user/dirFoo")),
+        "Renamed src should not exist in target");
+    assertTrue(isDir(fcView, fileContextTestHelper.getTestRootPath(fcView, "/user/dirFooBar")),
+        "Renamed dest should  exist as dir");
+    assertTrue(isDir(fcTarget, new Path(targetTestRoot, "user/dirFooBar")),
+        "Renamed dest should  exist as dir in target");
     
     // Make a directory under a directory that's mounted from the root of another FS
     fcView.mkdir(new Path("/targetRoot/dirFoo"), FileContext.DEFAULT_PERM, false);
-    Assert.assertTrue(exists(fcView, new Path("/targetRoot/dirFoo")));
+    assertTrue(exists(fcView, new Path("/targetRoot/dirFoo")));
     boolean dirFooPresent = false;
     RemoteIterator<FileStatus> dirContents = fcView.listStatus(new Path(
         "/targetRoot/"));
@@ -341,7 +338,7 @@ abstract public class ViewFsBaseTest {
         dirFooPresent = true;
       }
     }
-    Assert.assertTrue(dirFooPresent);
+    assertTrue(dirFooPresent);
     RemoteIterator<LocatedFileStatus> dirLocatedContents =
         fcView.listLocatedStatus(new Path("/targetRoot/"));
     dirFooPresent = false;
@@ -351,7 +348,7 @@ abstract public class ViewFsBaseTest {
         dirFooPresent = true;
       }
     }
-    Assert.assertTrue(dirFooPresent);
+    assertTrue(dirFooPresent);
   }
   
   // rename across mount points that point to same target also fail 
@@ -452,7 +449,7 @@ abstract public class ViewFsBaseTest {
     checkFileStatus(fcView, viewFilePath.toString(), fileType.isFile);
     BlockLocation[] viewBL = fcView.getFileBlockLocations(viewFilePath,
         0, 10240+100);
-    Assert.assertEquals(SupportsBlocks ? 10 : 1, viewBL.length);
+    assertEquals(SupportsBlocks ? 10 : 1, viewBL.length);
     BlockLocation[] targetBL = fcTarget.getFileBlockLocations(targetFilePath, 0, 10240+100);
     compareBLs(viewBL, targetBL);
     
@@ -464,7 +461,7 @@ abstract public class ViewFsBaseTest {
   }
   
   void compareBLs(BlockLocation[] viewBL, BlockLocation[] targetBL) {
-    Assert.assertEquals(targetBL.length, viewBL.length);
+    assertEquals(targetBL.length, viewBL.length);
     int i = 0;
     for (BlockLocation vbl : viewBL) {
       assertThat(vbl.toString()).isEqualTo(targetBL[i].toString());
@@ -489,52 +486,51 @@ abstract public class ViewFsBaseTest {
     
     FileStatus[] dirPaths = fcView.util().listStatus(new Path("/"));
     FileStatus fs;
-    Assert.assertEquals(7, dirPaths.length);
+    assertEquals(7, dirPaths.length);
     fs = fileContextTestHelper.containsPath(fcView, "/user", dirPaths);
-      Assert.assertNotNull(fs);
-      Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
+    assertNotNull(fs);
+    assertTrue(fs.isSymlink(), "A mount should appear as symlink");
     fs = fileContextTestHelper.containsPath(fcView, "/data", dirPaths);
-      Assert.assertNotNull(fs);
-      Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
+    assertNotNull(fs);
+    assertTrue(fs.isSymlink(), "A mount should appear as symlink");
     fs = fileContextTestHelper.containsPath(fcView, "/internalDir", dirPaths);
-      Assert.assertNotNull(fs);
-      Assert.assertTrue("InternalDirs should appear as dir", fs.isDirectory());
+    assertNotNull(fs);
+    assertTrue(fs.isDirectory(), "InternalDirs should appear as dir");
     fs = fileContextTestHelper.containsPath(fcView, "/danglingLink", dirPaths);
-      Assert.assertNotNull(fs);
-      Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
+    assertNotNull(fs);
+    assertTrue(fs.isSymlink(), "A mount should appear as symlink");
     fs = fileContextTestHelper.containsPath(fcView, "/linkToAFile", dirPaths);
-      Assert.assertNotNull(fs);
-      Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
+    assertNotNull(fs);
+    assertTrue(fs.isSymlink(), "A mount should appear as symlink");
       
       
       
-      // list on internal dir
-      dirPaths = fcView.util().listStatus(new Path("/internalDir"));
-      Assert.assertEquals(2, dirPaths.length);
+    // list on internal dir
+    dirPaths = fcView.util().listStatus(new Path("/internalDir"));
+    assertEquals(2, dirPaths.length);
 
-      fs = fileContextTestHelper.containsPath(fcView,
-          "/internalDir/internalDir2", dirPaths);
-        Assert.assertNotNull(fs);
-        Assert.assertTrue("InternalDirs should appear as dir",fs.isDirectory());
-      fs = fileContextTestHelper.containsPath(fcView,
-          "/internalDir/linkToDir2", dirPaths);
-        Assert.assertNotNull(fs);
-        Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
+    fs = fileContextTestHelper.containsPath(fcView, "/internalDir/internalDir2", dirPaths);
+    assertNotNull(fs);
+    assertTrue(fs.isDirectory(), "InternalDirs should appear as dir");
+    fs = fileContextTestHelper.containsPath(fcView, "/internalDir/linkToDir2", dirPaths);
+    assertNotNull(fs);
+    assertTrue(fs.isSymlink(), "A mount should appear as symlink");
   }
       
-  @Test(expected = FileNotFoundException.class)
+  @Test
   public void testFileStatusOnMountLink() throws IOException {
-    Assert.assertTrue("Slash should appear as dir", 
-        fcView.getFileStatus(new Path("/")).isDirectory());
-    checkFileStatus(fcView, "/", fileType.isDir);
-    checkFileStatus(fcView, "/user", fileType.isDir);
-    checkFileStatus(fcView, "/data", fileType.isDir);
-    checkFileStatus(fcView, "/internalDir", fileType.isDir);
-    checkFileStatus(fcView, "/internalDir/linkToDir2", fileType.isDir);
-    checkFileStatus(fcView, "/internalDir/internalDir2/linkToDir3", fileType.isDir);
-    checkFileStatus(fcView, "/linkToAFile", fileType.isFile);
-
-    fcView.getFileStatus(new Path("/danglingLink"));
+    assertThrows(FileNotFoundException.class, () -> {
+      assertTrue(fcView.getFileStatus(new Path("/")).isDirectory(),
+          "Slash should appear as dir");
+      checkFileStatus(fcView, "/", fileType.isDir);
+      checkFileStatus(fcView, "/user", fileType.isDir);
+      checkFileStatus(fcView, "/data", fileType.isDir);
+      checkFileStatus(fcView, "/internalDir", fileType.isDir);
+      checkFileStatus(fcView, "/internalDir/linkToDir2", fileType.isDir);
+      checkFileStatus(fcView, "/internalDir/internalDir2/linkToDir3", fileType.isDir);
+      checkFileStatus(fcView, "/linkToAFile", fileType.isFile);
+      fcView.getFileStatus(new Path("/danglingLink"));
+    });
   }
   
   @Test
@@ -554,15 +550,19 @@ abstract public class ViewFsBaseTest {
     verify(mockAFS).getFileChecksum(new Path("someFile"));
   }
 
-  @Test(expected=FileNotFoundException.class) 
+  @Test
   public void testgetFSonDanglingLink() throws IOException {
-    fcView.getFileStatus(new Path("/danglingLink"));
+    assertThrows(FileNotFoundException.class, () -> {
+      fcView.getFileStatus(new Path("/danglingLink"));
+    });
   }
   
   
-  @Test(expected=FileNotFoundException.class) 
+  @Test
   public void testgetFSonNonExistingInternalDir() throws IOException {
-    fcView.getFileStatus(new Path("/internalDir/nonExisting"));
+    assertThrows(FileNotFoundException.class, () -> {
+      fcView.getFileStatus(new Path("/internalDir/nonExisting"));
+    });
   }
   
   @Test
@@ -577,33 +577,37 @@ abstract public class ViewFsBaseTest {
     checkFileLinkStatus(fcView, "/internalDir/internalDir2", fileType.isDir);
   }
   
-  @Test(expected=FileNotFoundException.class) 
+  @Test
   public void testgetFileLinkStatusonNonExistingInternalDir()
     throws IOException {
-    fcView.getFileLinkStatus(new Path("/internalDir/nonExisting"));
+    assertThrows(FileNotFoundException.class, () -> {
+      fcView.getFileLinkStatus(new Path("/internalDir/nonExisting"));
+    });
   }
   
   @Test
   public void testSymlinkTarget() throws IOException {
 
     // get link target`
-    Assert.assertEquals(fcView.getLinkTarget(new Path("/user")),
+    assertEquals(fcView.getLinkTarget(new Path("/user")),
         (new Path(targetTestRoot,"user")));
-    Assert.assertEquals(fcView.getLinkTarget(new Path("/data")),
+    assertEquals(fcView.getLinkTarget(new Path("/data")),
         (new Path(targetTestRoot,"data")));
-    Assert.assertEquals(
+    assertEquals(
         fcView.getLinkTarget(new Path("/internalDir/linkToDir2")),
         (new Path(targetTestRoot,"dir2")));
-    Assert.assertEquals(
+    assertEquals(
         fcView.getLinkTarget(new Path("/internalDir/internalDir2/linkToDir3")),
         (new Path(targetTestRoot,"dir3")));
-    Assert.assertEquals(fcView.getLinkTarget(new Path("/linkToAFile")),
+    assertEquals(fcView.getLinkTarget(new Path("/linkToAFile")),
         (new Path(targetTestRoot,"aFile")));
   }
   
-  @Test(expected=IOException.class) 
+  @Test
   public void testgetLinkTargetOnNonLink() throws IOException {
-    fcView.getLinkTarget(new Path("/internalDir/internalDir2"));
+    assertThrows(IOException.class, () -> {
+      fcView.getLinkTarget(new Path("/internalDir/internalDir2"));
+    });
   }
   
   /*
@@ -614,19 +618,19 @@ abstract public class ViewFsBaseTest {
   
   @Test
   public void testResolvePathInternalPaths() throws IOException {
-    Assert.assertEquals(new Path("/"), fcView.resolvePath(new Path("/")));
-    Assert.assertEquals(new Path("/internalDir"),
+    assertEquals(new Path("/"), fcView.resolvePath(new Path("/")));
+    assertEquals(new Path("/internalDir"),
                           fcView.resolvePath(new Path("/internalDir")));
   }
   @Test
   public void testResolvePathMountPoints() throws IOException {
-    Assert.assertEquals(new Path(targetTestRoot,"user"),
-                          fcView.resolvePath(new Path("/user")));
-    Assert.assertEquals(new Path(targetTestRoot,"data"),
+    assertEquals(new Path(targetTestRoot, "user"),
+        fcView.resolvePath(new Path("/user")));
+    assertEquals(new Path(targetTestRoot, "data"),
         fcView.resolvePath(new Path("/data")));
-    Assert.assertEquals(new Path(targetTestRoot,"dir2"),
+    assertEquals(new Path(targetTestRoot, "dir2"),
         fcView.resolvePath(new Path("/internalDir/linkToDir2")));
-    Assert.assertEquals(new Path(targetTestRoot,"dir3"),
+    assertEquals(new Path(targetTestRoot, "dir3"),
         fcView.resolvePath(new Path("/internalDir/internalDir2/linkToDir3")));
 
   }
@@ -634,40 +638,45 @@ abstract public class ViewFsBaseTest {
   @Test
   public void testResolvePathThroughMountPoints() throws IOException {
     fileContextTestHelper.createFile(fcView, "/user/foo");
-    Assert.assertEquals(new Path(targetTestRoot,"user/foo"),
-                          fcView.resolvePath(new Path("/user/foo")));
+    assertEquals(new Path(targetTestRoot, "user/foo"),
+        fcView.resolvePath(new Path("/user/foo")));
     
     fcView.mkdir(
         fileContextTestHelper.getTestRootPath(fcView, "/user/dirX"),
-        FileContext.DEFAULT_PERM, false);
-    Assert.assertEquals(new Path(targetTestRoot,"user/dirX"),
+          FileContext.DEFAULT_PERM, false);
+    assertEquals(new Path(targetTestRoot, "user/dirX"),
         fcView.resolvePath(new Path("/user/dirX")));
 
     
     fcView.mkdir(
         fileContextTestHelper.getTestRootPath(fcView, "/user/dirX/dirY"),
-        FileContext.DEFAULT_PERM, false);
-    Assert.assertEquals(new Path(targetTestRoot,"user/dirX/dirY"),
+          FileContext.DEFAULT_PERM, false);
+    assertEquals(new Path(targetTestRoot, "user/dirX/dirY"),
         fcView.resolvePath(new Path("/user/dirX/dirY")));
   }
 
-  @Test(expected=FileNotFoundException.class) 
+  @Test
   public void testResolvePathDanglingLink() throws IOException {
+    assertThrows(FileNotFoundException.class, () -> {
       fcView.resolvePath(new Path("/danglingLink"));
+    });
   }
   
-  @Test(expected=FileNotFoundException.class) 
+  @Test
   public void testResolvePathMissingThroughMountPoints() throws IOException {
-    fcView.resolvePath(new Path("/user/nonExisting"));
+    assertThrows(FileNotFoundException.class, () -> {
+      fcView.resolvePath(new Path("/user/nonExisting"));
+    });
   }
   
 
-  @Test(expected=FileNotFoundException.class) 
+  @Test
   public void testResolvePathMissingThroughMountPoints2() throws IOException {
-    fcView.mkdir(
-        fileContextTestHelper.getTestRootPath(fcView, "/user/dirX"),
-        FileContext.DEFAULT_PERM, false);
-    fcView.resolvePath(new Path("/user/dirX/nonExisting"));
+    assertThrows(FileNotFoundException.class, () -> {
+      fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/user/dirX"),
+          FileContext.DEFAULT_PERM, false);
+      fcView.resolvePath(new Path("/user/dirX/nonExisting"));
+    });
   }
   
   
@@ -681,113 +690,152 @@ abstract public class ViewFsBaseTest {
  
  
   // Mkdir on internal mount table should fail
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalMkdirSlash() throws IOException {
-    fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/"),
-        FileContext.DEFAULT_PERM, false);
+    assertThrows(AccessControlException.class, () -> {
+      fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/"),
+          FileContext.DEFAULT_PERM, false);
+    });
   }
   
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalMkdirExisting1() throws IOException {
-    fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/internalDir"),
-        FileContext.DEFAULT_PERM, false);
+    assertThrows(AccessControlException.class, () -> {
+      fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/internalDir"),
+          FileContext.DEFAULT_PERM, false);
+    });
   }
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalMkdirExisting2() throws IOException {
-    fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView,
-        "/internalDir/linkToDir2"),
-        FileContext.DEFAULT_PERM, false);
+    assertThrows(AccessControlException.class, () -> {
+      fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView,
+          "/internalDir/linkToDir2"),
+          FileContext.DEFAULT_PERM, false);
+    });
   }
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalMkdirNew() throws IOException {
-    fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/dirNew"),
-        FileContext.DEFAULT_PERM, false);
+    assertThrows(AccessControlException.class, () -> {
+      fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/dirNew"),
+          FileContext.DEFAULT_PERM, false);
+    });
   }
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalMkdirNew2() throws IOException {
-    fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/internalDir/dirNew"),
-        FileContext.DEFAULT_PERM, false);
+    assertThrows(AccessControlException.class, () -> {
+      fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/internalDir/dirNew"),
+          FileContext.DEFAULT_PERM, false);
+    });
   }
   
   // Create on internal mount table should fail
   
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalCreate1() throws IOException {
-    fileContextTestHelper.createFileNonRecursive(fcView, "/foo"); // 1 component
+    assertThrows(AccessControlException.class, () -> {
+      fileContextTestHelper.createFileNonRecursive(fcView, "/foo");
+    });
   }
   
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalCreate2() throws IOException {  // 2 component
-    fileContextTestHelper.createFileNonRecursive(fcView, "/internalDir/foo");
+    assertThrows(AccessControlException.class, () -> {
+      fileContextTestHelper.createFileNonRecursive(fcView, "/internalDir/foo");
+    });
   }
   
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalCreateMissingDir() throws IOException {
-    fileContextTestHelper.createFile(fcView, "/missingDir/foo");
+    assertThrows(AccessControlException.class, () -> {
+      fileContextTestHelper.createFile(fcView, "/missingDir/foo");
+    });
   }
   
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalCreateMissingDir2() throws IOException {
-    fileContextTestHelper.createFile(fcView, "/missingDir/miss2/foo");
+    assertThrows(AccessControlException.class, () -> {
+      fileContextTestHelper.createFile(fcView, "/missingDir/miss2/foo");
+    });
   }
   
   
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalCreateMissingDir3() throws IOException {
-    fileContextTestHelper.createFile(fcView, "/internalDir/miss2/foo");
+    assertThrows(AccessControlException.class, () -> {
+      fileContextTestHelper.createFile(fcView, "/internalDir/miss2/foo");
+    });
   }
   
   // Delete on internal mount table should fail
   
-  @Test(expected=FileNotFoundException.class) 
+  @Test
   public void testInternalDeleteNonExisting() throws IOException {
+    assertThrows(FileNotFoundException.class, () -> {
       fcView.delete(new Path("/NonExisting"), false);
+    });
   }
-  @Test(expected=FileNotFoundException.class) 
+  @Test
   public void testInternalDeleteNonExisting2() throws IOException {
+    assertThrows(FileNotFoundException.class, () -> {
       fcView.delete(new Path("/internalDir/NonExisting"), false);
+    });
   }
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalDeleteExisting() throws IOException {
+    assertThrows(AccessControlException.class, () -> {
       fcView.delete(new Path("/internalDir"), false);
+    });
   }
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalDeleteExisting2() throws IOException {
-    Assert.assertTrue("Delete of link to dir should succeed",
-        fcView.getFileStatus(new Path("/internalDir/linkToDir2")).isDirectory());
-    fcView.delete(new Path("/internalDir/linkToDir2"), false);
+    assertThrows(AccessControlException.class, () -> {
+      assertTrue(fcView.getFileStatus(new Path("/internalDir/linkToDir2")).isDirectory(),
+          "Delete of link to dir should succeed");
+      fcView.delete(new Path("/internalDir/linkToDir2"), false);
+    });
   } 
   
   
   // Rename on internal mount table should fail
   
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalRename1() throws IOException {
-    fcView.rename(new Path("/internalDir"), new Path("/newDir"));
+    assertThrows(AccessControlException.class, () -> {
+      fcView.rename(new Path("/internalDir"), new Path("/newDir"));
+    });
   }
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalRename2() throws IOException {
-    Assert.assertTrue("linkTODir2 should be a dir", 
-        fcView.getFileStatus(new Path("/internalDir/linkToDir2")).isDirectory());
-    fcView.rename(new Path("/internalDir/linkToDir2"),
-        new Path("/internalDir/dir1"));
+    assertThrows(AccessControlException.class, () -> {
+      assertTrue(fcView.getFileStatus(new Path("/internalDir/linkToDir2")).isDirectory(),
+          "linkTODir2 should be a dir");
+      fcView.rename(new Path("/internalDir/linkToDir2"), new Path("/internalDir/dir1"));
+    });
   }
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalRename3() throws IOException {
-    fcView.rename(new Path("/user"), new Path("/internalDir/linkToDir2"));
+    assertThrows(AccessControlException.class, () -> {
+      fcView.rename(new Path("/user"), new Path("/internalDir/linkToDir2"));
+    });
   }
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalRenameToSlash() throws IOException {
-    fcView.rename(new Path("/internalDir/linkToDir2/foo"), new Path("/"));
+    assertThrows(AccessControlException.class, () -> {
+      fcView.rename(new Path("/internalDir/linkToDir2/foo"), new Path("/"));
+    });
   }
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalRenameFromSlash() throws IOException {
-    fcView.rename(new Path("/"), new Path("/bar"));
+    assertThrows(AccessControlException.class, () -> {
+      fcView.rename(new Path("/"), new Path("/bar"));
+    });
   }
   
-  @Test(expected=AccessControlException.class) 
+  @Test
   public void testInternalSetOwner() throws IOException {
-    fcView.setOwner(new Path("/internalDir"), "foo", "bar");
+    assertThrows(AccessControlException.class, () -> {
+      fcView.setOwner(new Path("/internalDir"), "foo", "bar");
+    });
   }
 
   /**
@@ -795,31 +843,39 @@ abstract public class ViewFsBaseTest {
    * any mount table entry.
    */
 
-  @Test(expected=AccessControlException.class)
+  @Test
   public void testInternalModifyAclEntries() throws IOException {
-    fcView.modifyAclEntries(new Path("/internalDir"),
-        new ArrayList<AclEntry>());
+    assertThrows(AccessControlException.class, () -> {
+      fcView.modifyAclEntries(new Path("/internalDir"), new ArrayList<AclEntry>());
+    });
   }
 
-  @Test(expected=AccessControlException.class)
+  @Test
   public void testInternalRemoveAclEntries() throws IOException {
-    fcView.removeAclEntries(new Path("/internalDir"),
-        new ArrayList<AclEntry>());
+    assertThrows(AccessControlException.class, () -> {
+      fcView.removeAclEntries(new Path("/internalDir"), new ArrayList<AclEntry>());
+    });
   }
 
-  @Test(expected=AccessControlException.class)
+  @Test
   public void testInternalRemoveDefaultAcl() throws IOException {
-    fcView.removeDefaultAcl(new Path("/internalDir"));
+    assertThrows(AccessControlException.class, () -> {
+      fcView.removeDefaultAcl(new Path("/internalDir"));
+    });
   }
 
-  @Test(expected=AccessControlException.class)
+  @Test
   public void testInternalRemoveAcl() throws IOException {
-    fcView.removeAcl(new Path("/internalDir"));
+    assertThrows(AccessControlException.class, () -> {
+      fcView.removeAcl(new Path("/internalDir"));
+    });
   }
 
-  @Test(expected=AccessControlException.class)
+  @Test
   public void testInternalSetAcl() throws IOException {
-    fcView.setAcl(new Path("/internalDir"), new ArrayList<AclEntry>());
+    assertThrows(AccessControlException.class, () -> {
+      fcView.setAcl(new Path("/internalDir"), new ArrayList<AclEntry>());
+    });
   }
 
   @Test
@@ -834,55 +890,75 @@ abstract public class ViewFsBaseTest {
     assertFalse(aclStatus.isStickyBit());
   }
 
-  @Test(expected=AccessControlException.class)
+  @Test
   public void testInternalSetXAttr() throws IOException {
-    fcView.setXAttr(new Path("/internalDir"), "xattrName", null);
+    assertThrows(AccessControlException.class, () -> {
+      fcView.setXAttr(new Path("/internalDir"), "xattrName", null);
+    });
   }
 
-  @Test(expected=NotInMountpointException.class)
+  @Test
   public void testInternalGetXAttr() throws IOException {
-    fcView.getXAttr(new Path("/internalDir"), "xattrName");
+    assertThrows(NotInMountpointException.class, () -> {
+      fcView.getXAttr(new Path("/internalDir"), "xattrName");
+    });
   }
 
-  @Test(expected=NotInMountpointException.class)
+  @Test
   public void testInternalGetXAttrs() throws IOException {
-    fcView.getXAttrs(new Path("/internalDir"));
+    assertThrows(NotInMountpointException.class, () -> {
+      fcView.getXAttrs(new Path("/internalDir"));
+    });
   }
 
-  @Test(expected=NotInMountpointException.class)
+  @Test
   public void testInternalGetXAttrsWithNames() throws IOException {
-    fcView.getXAttrs(new Path("/internalDir"), new ArrayList<String>());
+    assertThrows(NotInMountpointException.class, () -> {
+      fcView.getXAttrs(new Path("/internalDir"), new ArrayList<String>());
+    });
   }
 
-  @Test(expected=NotInMountpointException.class)
+  @Test
   public void testInternalListXAttr() throws IOException {
-    fcView.listXAttrs(new Path("/internalDir"));
+    assertThrows(NotInMountpointException.class, () -> {
+      fcView.listXAttrs(new Path("/internalDir"));
+    });
   }
 
-  @Test(expected=AccessControlException.class)
+  @Test
   public void testInternalRemoveXAttr() throws IOException {
-    fcView.removeXAttr(new Path("/internalDir"), "xattrName");
+    assertThrows(AccessControlException.class, () -> {
+      fcView.removeXAttr(new Path("/internalDir"), "xattrName");
+    });
   }
 
-  @Test(expected = AccessControlException.class)
+  @Test
   public void testInternalCreateSnapshot1() throws IOException {
-    fcView.createSnapshot(new Path("/internalDir"));
+    assertThrows(AccessControlException.class, () -> {
+      fcView.createSnapshot(new Path("/internalDir"));
+    });
   }
 
-  @Test(expected = AccessControlException.class)
+  @Test
   public void testInternalCreateSnapshot2() throws IOException {
-    fcView.createSnapshot(new Path("/internalDir"), "snap1");
+    assertThrows(AccessControlException.class, () -> {
+      fcView.createSnapshot(new Path("/internalDir"), "snap1");
+    });
   }
 
-  @Test(expected = AccessControlException.class)
+  @Test
   public void testInternalRenameSnapshot() throws IOException {
-    fcView.renameSnapshot(new Path("/internalDir"), "snapOldName",
-        "snapNewName");
+    assertThrows(AccessControlException.class, () -> {
+      fcView.renameSnapshot(new Path("/internalDir"), "snapOldName",
+          "snapNewName");
+    });
   }
 
-  @Test(expected = AccessControlException.class)
+  @Test
   public void testInternalDeleteSnapshot() throws IOException {
-    fcView.deleteSnapshot(new Path("/internalDir"), "snap1");
+    assertThrows(AccessControlException.class, () -> {
+      fcView.deleteSnapshot(new Path("/internalDir"), "snap1");
+    });
   }
 
   @Test

+ 28 - 17
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestSymlinkHdfs.java

@@ -17,8 +17,8 @@
  */
 package org.apache.hadoop.fs;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
 
 import java.io.IOException;
 import java.net.URI;
@@ -39,9 +39,10 @@ import org.apache.hadoop.hdfs.web.WebHdfsTestUtil;
 import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.ipc.RemoteException;
 import org.apache.hadoop.test.GenericTestUtils;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.event.Level;
@@ -90,7 +91,7 @@ abstract public class TestSymlinkHdfs extends SymlinkBaseTest {
     return e;
   }
 
-  @BeforeClass
+  @BeforeAll
   public static void beforeClassSetup() throws Exception {
     Configuration conf = new HdfsConfiguration();
     conf.set(FsPermission.UMASK_LABEL, "000");
@@ -100,7 +101,7 @@ abstract public class TestSymlinkHdfs extends SymlinkBaseTest {
     dfs = cluster.getFileSystem();
   }
 
-  @AfterClass
+  @AfterAll
   public static void afterClassTeardown() throws Exception {
     if (cluster != null) {
       cluster.shutdown();
@@ -108,7 +109,8 @@ abstract public class TestSymlinkHdfs extends SymlinkBaseTest {
     IOUtils.cleanupWithLogger(LOG, webhdfs);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Access a file using a link that spans Hdfs to LocalFs */
   public void testLinkAcrossFileSystems() throws IOException {
     Path localDir = new Path("file://" + wrapper.getAbsoluteTestRootDir()
@@ -127,7 +129,8 @@ abstract public class TestSymlinkHdfs extends SymlinkBaseTest {
     assertEquals(fileSize, wrapper.getFileStatus(link).getLen());
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test renaming a file across two file systems using a link */
   public void testRenameAcrossFileSystemsViaLink() throws IOException {
     Path localDir = new Path("file://" + wrapper.getAbsoluteTestRootDir()
@@ -169,7 +172,8 @@ abstract public class TestSymlinkHdfs extends SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test create symlink to / */
   public void testCreateLinkToSlash() throws IOException {
     Path dir  = new Path(testBaseDir1());
@@ -192,7 +196,8 @@ abstract public class TestSymlinkHdfs extends SymlinkBaseTest {
   }
   
   
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** setPermission affects the target not the link */
   public void testSetPermissionAffectsTarget() throws IOException {
     Path file       = new Path(testBaseDir1(), "file");
@@ -232,7 +237,8 @@ abstract public class TestSymlinkHdfs extends SymlinkBaseTest {
                  wrapper.getFileStatus(linkToDir).getPermission());
   }  
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Create a symlink using a path with scheme but no authority */
   public void testCreateWithPartQualPathFails() throws IOException {
     Path fileWoAuth = new Path("hdfs:///test/file");
@@ -251,7 +257,8 @@ abstract public class TestSymlinkHdfs extends SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** setReplication affects the target not the link */
   public void testSetReplication() throws IOException {
     Path file = new Path(testBaseDir1(), "file");
@@ -264,7 +271,8 @@ abstract public class TestSymlinkHdfs extends SymlinkBaseTest {
     assertEquals(2, wrapper.getFileStatus(file).getReplication());
   }
   
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test create symlink with a max len name */
   public void testCreateLinkMaxPathLink() throws IOException {
     Path dir  = new Path(testBaseDir1());
@@ -300,7 +308,8 @@ abstract public class TestSymlinkHdfs extends SymlinkBaseTest {
     }
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test symlink owner */
   public void testLinkOwner() throws IOException {
     Path file = new Path(testBaseDir1(), "file");
@@ -312,7 +321,8 @@ abstract public class TestSymlinkHdfs extends SymlinkBaseTest {
     assertEquals(statLink.getOwner(), statFile.getOwner());
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test WebHdfsFileSystem.createSymlink(..). */
   public void testWebHDFS() throws IOException {
     Path file = new Path(testBaseDir1(), "file");
@@ -325,7 +335,8 @@ abstract public class TestSymlinkHdfs extends SymlinkBaseTest {
     assertEquals(2, wrapper.getFileStatus(file).getReplication());
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test craeteSymlink(..) with quota. */
   public void testQuota() throws IOException {
     final Path dir = new Path(testBaseDir1());

+ 7 - 5
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestSymlinkHdfsFileContext.java

@@ -17,24 +17,26 @@
  */
 package org.apache.hadoop.fs;
 
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
 
 import java.io.IOException;
 
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 
 public class TestSymlinkHdfsFileContext extends TestSymlinkHdfs {
 
   private static FileContext fc;
 
-  @BeforeClass
+  @BeforeAll
   public static void testSetup() throws Exception {
     fc = FileContext.getFileContext(cluster.getURI(0));
     wrapper = new FileContextTestWrapper(fc, "/tmp/TestSymlinkHdfsFileContext");
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   /** Test access a symlink using AbstractFileSystem */
   public void testAccessLinkFromAbstractFileSystem() throws IOException {
     Path file = new Path(testBaseDir1(), "file");

+ 22 - 15
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestSymlinkHdfsFileSystem.java

@@ -17,35 +17,39 @@
  */
 package org.apache.hadoop.fs;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.IOException;
 
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 
 public class TestSymlinkHdfsFileSystem extends TestSymlinkHdfs {
 
-  @BeforeClass
+  @BeforeAll
   public static void testSetup() throws Exception {
     wrapper = new FileSystemTestWrapper(dfs, "/tmp/TestSymlinkHdfsFileSystem");
   }
 
   @Override
-  @Ignore("FileSystem adds missing authority in absolute URIs")
-  @Test(timeout=10000)
+  @Disabled("FileSystem adds missing authority in absolute URIs")
+  @Test
+  @Timeout(value = 10)
   public void testCreateWithPartQualPathFails() throws IOException {}
 
-  @Ignore("FileSystem#create creates parent directories," +
+  @Disabled("FileSystem#create creates parent directories," +
       " so dangling links to directories are created")
   @Override
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   public void testCreateFileViaDanglingLinkParent() throws IOException {}
 
   // Additional tests for DFS-only methods
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   public void testRecoverLease() throws IOException {
     Path dir  = new Path(testBaseDir1());
     Path file = new Path(testBaseDir1(), "file");
@@ -55,10 +59,11 @@ public class TestSymlinkHdfsFileSystem extends TestSymlinkHdfs {
     wrapper.createSymlink(file, link, false);
     // Attempt recoverLease through a symlink
     boolean closed = dfs.recoverLease(link);
-    assertTrue("Expected recoverLease to return true", closed);
+    assertTrue(closed, "Expected recoverLease to return true");
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   public void testIsFileClosed() throws IOException {
     Path dir  = new Path(testBaseDir1());
     Path file = new Path(testBaseDir1(), "file");
@@ -68,10 +73,11 @@ public class TestSymlinkHdfsFileSystem extends TestSymlinkHdfs {
     wrapper.createSymlink(file, link, false);
     // Attempt recoverLease through a symlink
     boolean closed = dfs.isFileClosed(link);
-    assertTrue("Expected isFileClosed to return true", closed);
+    assertTrue(closed, "Expected isFileClosed to return true");
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   public void testConcat() throws Exception {
     Path dir  = new Path(testBaseDir1());
     Path link = new Path(testBaseDir1(), "link");
@@ -89,7 +95,8 @@ public class TestSymlinkHdfsFileSystem extends TestSymlinkHdfs {
     dfs.concat(target, srcs);
   }
 
-  @Test(timeout=10000)
+  @Test
+  @Timeout(value = 10)
   public void testSnapshot() throws Exception {
     Path dir  = new Path(testBaseDir1());
     Path link = new Path(testBaseDir1(), "link");

File diff suppressed because it is too large
+ 236 - 236
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java


+ 24 - 20
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZonesWithKMS.java

@@ -17,7 +17,8 @@
  */
 package org.apache.hadoop.hdfs;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.util.function.Supplier;
 import org.apache.hadoop.crypto.key.kms.KMSClientProvider;
@@ -34,10 +35,10 @@ import org.apache.hadoop.hdfs.web.WebHdfsFileSystem;
 import org.apache.hadoop.hdfs.web.WebHdfsTestUtil;
 import org.apache.hadoop.test.GenericTestUtils;
 import org.apache.hadoop.test.Whitebox;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 
 import java.io.File;
 import java.util.Arrays;
@@ -53,18 +54,18 @@ public class TestEncryptionZonesWithKMS extends TestEncryptionZones {
         miniKMS.getKMSUrl().toExternalForm().replace("://", "@");
   }
 
-  @Before
+  @BeforeEach
   public void setup() throws Exception {
     File kmsDir = new File("target/test-classes/" +
         UUID.randomUUID().toString());
-    Assert.assertTrue(kmsDir.mkdirs());
+    assertTrue(kmsDir.mkdirs());
     MiniKMS.Builder miniKMSBuilder = new MiniKMS.Builder();
     miniKMS = miniKMSBuilder.setKmsConfDir(kmsDir).build();
     miniKMS.start();
     super.setup();
   }
 
-  @After
+  @AfterEach
   public void teardown() {
     super.teardown();
     miniKMS.stop();
@@ -82,7 +83,8 @@ public class TestEncryptionZonesWithKMS extends TestEncryptionZones {
     return lbkmscp.getProviders()[0];
   }
 
-  @Test(timeout = 120000)
+  @Test
+  @Timeout(value = 120)
   public void testCreateEZPopulatesEDEKCache() throws Exception {
     final Path zonePath = new Path("/TestEncryptionZone");
     fsWrapper.mkdir(zonePath, FsPermission.getDirDefault(), false);
@@ -92,7 +94,8 @@ public class TestEncryptionZonesWithKMS extends TestEncryptionZones {
     assertTrue(kcp.getEncKeyQueueSize(TEST_KEY) > 0);
   }
 
-  @Test(timeout = 120000)
+  @Test
+  @Timeout(value = 120)
   public void testDelegationToken() throws Exception {
     final String renewer = "JobTracker";
     UserGroupInformation.createRemoteUser(renewer);
@@ -100,16 +103,17 @@ public class TestEncryptionZonesWithKMS extends TestEncryptionZones {
     Credentials creds = new Credentials();
     Token<?> tokens[] = fs.addDelegationTokens(renewer, creds);
     LOG.debug("Delegation tokens: " + Arrays.asList(tokens));
-    Assert.assertEquals(2, tokens.length);
-    Assert.assertEquals(2, creds.numberOfTokens());
+    assertEquals(2, tokens.length);
+    assertEquals(2, creds.numberOfTokens());
     
     // If the dt exists, will not get again
     tokens = fs.addDelegationTokens(renewer, creds);
-    Assert.assertEquals(0, tokens.length);
-    Assert.assertEquals(2, creds.numberOfTokens());
+    assertEquals(0, tokens.length);
+    assertEquals(2, creds.numberOfTokens());
   }
 
-  @Test(timeout = 120000)
+  @Test
+  @Timeout(value = 120)
   public void testWarmupEDEKCacheOnStartup() throws Exception {
     Path zonePath = new Path("/TestEncryptionZone");
     fsWrapper.mkdir(zonePath, FsPermission.getDirDefault(), false);
@@ -122,8 +126,8 @@ public class TestEncryptionZonesWithKMS extends TestEncryptionZones {
 
     @SuppressWarnings("unchecked")
     KMSClientProvider spy = getKMSClientProvider();
-    assertTrue("key queue is empty after creating encryption zone",
-        spy.getEncKeyQueueSize(TEST_KEY) > 0);
+    assertTrue(spy.getEncKeyQueueSize(TEST_KEY) > 0,
+        "key queue is empty after creating encryption zone");
 
     conf.setInt(
         DFSConfigKeys.DFS_NAMENODE_EDEKCACHELOADER_INITIAL_DELAY_MS_KEY, 0);
@@ -151,9 +155,9 @@ public class TestEncryptionZonesWithKMS extends TestEncryptionZones {
     Credentials creds = new Credentials();
     final Token<?>[] tokens = webfs.addDelegationTokens("JobTracker", creds);
 
-    Assert.assertEquals(2, tokens.length);
-    Assert.assertEquals(KMSDelegationToken.TOKEN_KIND_STR,
+    assertEquals(2, tokens.length);
+    assertEquals(KMSDelegationToken.TOKEN_KIND_STR,
         tokens[1].getKind().toString());
-    Assert.assertEquals(2, creds.numberOfTokens());
+    assertEquals(2, creds.numberOfTokens());
   }
 }

+ 37 - 27
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestReservedRawPaths.java

@@ -42,9 +42,10 @@ import org.apache.hadoop.hdfs.server.namenode.INodesInPath;
 import org.apache.hadoop.security.AccessControlException;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.test.GenericTestUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 import org.slf4j.LoggerFactory;
 import org.slf4j.event.Level;
 
@@ -52,10 +53,10 @@ import static org.apache.hadoop.hdfs.DFSTestUtil.verifyFilesEqual;
 import static org.apache.hadoop.hdfs.DFSTestUtil.verifyFilesNotEqual;
 import static org.apache.hadoop.test.GenericTestUtils.assertExceptionContains;
 import static org.apache.hadoop.test.GenericTestUtils.assertMatches;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-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.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 public class TestReservedRawPaths {
 
@@ -72,7 +73,7 @@ public class TestReservedRawPaths {
   protected static final EnumSet< CreateEncryptionZoneFlag > NO_TRASH =
       EnumSet.of(CreateEncryptionZoneFlag.NO_TRASH);
 
-  @Before
+  @BeforeEach
   public void setup() throws Exception {
     conf = new HdfsConfiguration();
     fsHelper = new FileSystemTestHelper();
@@ -98,7 +99,7 @@ public class TestReservedRawPaths {
     DFSTestUtil.createKey(TEST_KEY, cluster, conf);
   }
 
-  @After
+  @AfterEach
   public void teardown() {
     if (cluster != null) {
       cluster.shutdown();
@@ -110,7 +111,8 @@ public class TestReservedRawPaths {
    * Verify resolving path will return an iip that tracks if the original
    * path was a raw path.
    */
-  @Test(timeout = 120000)
+  @Test
+  @Timeout(value = 120)
   public void testINodesInPath() throws IOException {
     FSDirectory fsd = cluster.getNamesystem().getFSDirectory();
     final String path = "/path";
@@ -134,7 +136,8 @@ public class TestReservedRawPaths {
    * Compare the raw and non-raw versions of the non-encrypted file to ensure
    *   they're the same.
    */
-  @Test(timeout = 120000)
+  @Test
+  @Timeout(value = 120)
   public void testReadWriteRaw() throws Exception {
     // Create a base file for comparison
     final Path baseFile = new Path("/base");
@@ -164,21 +167,22 @@ public class TestReservedRawPaths {
      * Use accessTime and modificationTime as substitutes for INode to check
      * for resolution to the same underlying file.
      */
-    assertEquals("Access times not equal", p1Stat.getAccessTime(),
-        p2Stat.getAccessTime());
-    assertEquals("Modification times not equal", p1Stat.getModificationTime(),
-        p2Stat.getModificationTime());
-    assertEquals("pathname1 not equal", p1,
-        Path.getPathWithoutSchemeAndAuthority(p1Stat.getPath()));
-    assertEquals("pathname1 not equal", p2,
-            Path.getPathWithoutSchemeAndAuthority(p2Stat.getPath()));
+    assertEquals(p1Stat.getAccessTime(),
+        p2Stat.getAccessTime(), "Access times not equal");
+    assertEquals(p1Stat.getModificationTime(),
+        p2Stat.getModificationTime(), "Modification times not equal");
+    assertEquals(p1, Path.getPathWithoutSchemeAndAuthority(p1Stat.getPath()),
+        "pathname1 not equal");
+    assertEquals(p2, Path.getPathWithoutSchemeAndAuthority(p2Stat.getPath()),
+        "pathname1 not equal");
   }
 
   /**
    * Tests that getFileStatus on raw and non raw resolve to the same
    * file.
    */
-  @Test(timeout = 120000)
+  @Test
+  @Timeout(value = 120)
   public void testGetFileStatus() throws Exception {
     final Path zone = new Path("zone");
     final Path slashZone = new Path("/", zone);
@@ -200,7 +204,8 @@ public class TestReservedRawPaths {
     assertPathEquals(ezEncFile, ezRawEncFile);
   }
 
-  @Test(timeout = 120000)
+  @Test
+  @Timeout(value = 120)
   public void testReservedRoot() throws Exception {
     final Path root = new Path("/");
     final Path rawRoot = new Path("/.reserved/raw");
@@ -210,7 +215,8 @@ public class TestReservedRawPaths {
   }
 
   /* Verify mkdir works ok in .reserved/raw directory. */
-  @Test(timeout = 120000)
+  @Test
+  @Timeout(value = 120)
   public void testReservedRawMkdir() throws Exception {
     final Path zone = new Path("zone");
     final Path slashZone = new Path("/", zone);
@@ -229,7 +235,8 @@ public class TestReservedRawPaths {
     fs.delete(rawDir1EZ, true);
   }
 
-  @Test(timeout = 120000)
+  @Test
+  @Timeout(value = 120)
   public void testRelativePathnames() throws Exception {
     final Path baseFileRaw = new Path("/.reserved/raw/base");
     final int len = 8192;
@@ -248,7 +255,8 @@ public class TestReservedRawPaths {
         "/.reserved/../.reserved/raw/../raw/base"));
   }
 
-  @Test(timeout = 120000)
+  @Test
+  @Timeout(value = 120)
   public void testUserReadAccessOnly() throws Exception {
     final Path zone = new Path("zone");
     final Path slashZone = new Path("/", zone);
@@ -319,7 +327,8 @@ public class TestReservedRawPaths {
     });
   }
 
-  @Test(timeout = 120000)
+  @Test
+  @Timeout(value = 120)
   public void testListDotReserved() throws Exception {
     // Create a base file for comparison
     final Path baseFileRaw = new Path("/.reserved/raw/base");
@@ -343,11 +352,12 @@ public class TestReservedRawPaths {
     }
 
     final FileStatus[] fileStatuses = fs.listStatus(new Path("/.reserved/raw"));
-    assertEquals("expected 1 entry", fileStatuses.length, 1);
+    assertEquals(fileStatuses.length, 1, "expected 1 entry");
     assertMatches(fileStatuses[0].getPath().toString(), "/.reserved/raw/base");
   }
 
-  @Test(timeout = 120000)
+  @Test
+  @Timeout(value = 120)
   public void testListRecursive() throws Exception {
     Path rootPath = new Path("/");
     Path p = rootPath;

+ 35 - 38
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestReencryption.java

@@ -60,25 +60,25 @@ import org.apache.hadoop.ipc.RemoteException;
 import org.apache.hadoop.ipc.RetriableException;
 import org.apache.hadoop.test.GenericTestUtils;
 import org.apache.hadoop.test.Whitebox;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 import static org.apache.hadoop.test.GenericTestUtils.assertExceptionContains;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import org.junit.rules.Timeout;
+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.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 import org.slf4j.LoggerFactory;
 import org.slf4j.event.Level;
 
 /**
  * Test class for re-encryption.
  */
+@Timeout(180)
 public class TestReencryption {
 
   protected static final org.slf4j.Logger LOG =
@@ -105,10 +105,7 @@ public class TestReencryption {
         testRootDir.toString(), "test.jks").toUri();
   }
 
-  @Rule
-  public Timeout globalTimeout = new Timeout(180 * 1000);
-
-  @Before
+  @BeforeEach
   public void setup() throws Exception {
     conf = new HdfsConfiguration();
     fsHelper = new FileSystemTestHelper();
@@ -151,7 +148,7 @@ public class TestReencryption {
         .setKeyProvider(cluster.getNameNode().getNamesystem().getProvider());
   }
 
-  @After
+  @AfterEach
   public void teardown() {
     if (cluster != null) {
       cluster.shutdown();
@@ -414,8 +411,8 @@ public class TestReencryption {
 
     assertKeyVersionEquals(encFile0, fei0new);
     assertKeyVersionEquals(encFile9, fei9new);
-    assertNull("Re-encrypt queue should be empty after restart",
-        getReencryptionStatus().getNextUnprocessedZone());
+    assertNull(getReencryptionStatus().getNextUnprocessedZone(),
+        "Re-encrypt queue should be empty after restart");
   }
 
   @Test
@@ -494,18 +491,18 @@ public class TestReencryption {
     restartClusterDisableReencrypt();
 
     final Long zoneId = fsn.getFSDirectory().getINode(zone.toString()).getId();
-    assertEquals("Re-encrypt should restore to the last checkpoint zone",
-        zoneId, getReencryptionStatus().getNextUnprocessedZone());
-    assertEquals("Re-encrypt should restore to the last checkpoint file",
-        new Path(subdir, "4").toString(),
-        getEzManager().getZoneStatus(zone.toString()).getLastCheckpointFile());
+    assertEquals(zoneId, getReencryptionStatus().getNextUnprocessedZone(),
+        "Re-encrypt should restore to the last checkpoint zone");
+    assertEquals(new Path(subdir, "4").toString(),
+        getEzManager().getZoneStatus(zone.toString()).getLastCheckpointFile(),
+        "Re-encrypt should restore to the last checkpoint file");
 
     getEzManager().resumeReencryptForTesting();
     waitForReencryptedZones(1);
     assertKeyVersionChanged(encFile0, fei0);
     assertKeyVersionChanged(encFile9, fei9);
-    assertNull("Re-encrypt queue should be empty after restart",
-        getReencryptionStatus().getNextUnprocessedZone());
+    assertNull(getReencryptionStatus().getNextUnprocessedZone(),
+        "Re-encrypt queue should be empty after restart");
     assertEquals(11, getZoneStatus(zone.toString()).getFilesReencrypted());
   }
 
@@ -545,8 +542,8 @@ public class TestReencryption {
 
     assertKeyVersionEquals(encFile0, fei0new);
     assertKeyVersionEquals(encFile9, fei9new);
-    assertNull("Re-encrypt queue should be empty after restart",
-        getReencryptionStatus().getNextUnprocessedZone());
+    assertNull(getReencryptionStatus().getNextUnprocessedZone(),
+        "Re-encrypt queue should be empty after restart");
   }
 
   @Test
@@ -613,12 +610,12 @@ public class TestReencryption {
    */
   private void verifyZoneCompletionTime(final ZoneReencryptionStatus zs) {
     assertNotNull(zs);
-    assertTrue("Completion time should be positive. " + zs.getCompletionTime(),
-        zs.getCompletionTime() > 0);
-    assertTrue("Completion time " + zs.getCompletionTime()
-            + " should be no less than submission time "
-            + zs.getSubmissionTime(),
-        zs.getCompletionTime() >= zs.getSubmissionTime());
+    assertTrue(zs.getCompletionTime() > 0,
+        "Completion time should be positive. " + zs.getCompletionTime());
+    assertTrue(zs.getCompletionTime() >= zs.getSubmissionTime(),
+        "Completion time " + zs.getCompletionTime()
+        + " should be no less than submission time "
+        + zs.getSubmissionTime());
   }
 
   @Test
@@ -1381,15 +1378,15 @@ public class TestReencryption {
   private void assertKeyVersionChanged(final Path file,
       final FileEncryptionInfo original) throws Exception {
     final FileEncryptionInfo actual = getFileEncryptionInfo(file);
-    assertNotEquals("KeyVersion should be different",
-        original.getEzKeyVersionName(), actual.getEzKeyVersionName());
+    assertNotEquals(original.getEzKeyVersionName(), actual.getEzKeyVersionName(),
+        "KeyVersion should be different");
   }
 
   private void assertKeyVersionEquals(final Path file,
       final FileEncryptionInfo expected) throws Exception {
     final FileEncryptionInfo actual = getFileEncryptionInfo(file);
-    assertEquals("KeyVersion should be the same",
-        expected.getEzKeyVersionName(), actual.getEzKeyVersionName());
+    assertEquals(expected.getEzKeyVersionName(), actual.getEzKeyVersionName(),
+        "KeyVersion should be the same");
   }
 
   @Test

+ 6 - 6
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestReencryptionWithKMS.java

@@ -24,16 +24,16 @@ import org.apache.hadoop.crypto.key.kms.server.KMSConfiguration;
 import org.apache.hadoop.crypto.key.kms.server.KMSWebApp;
 import org.apache.hadoop.crypto.key.kms.server.MiniKMS;
 import org.apache.hadoop.fs.Path;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import java.io.File;
 import java.io.FileWriter;
 import java.io.Writer;
 import java.util.UUID;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Test class for re-encryption with minikms.
@@ -49,7 +49,7 @@ public class TestReencryptionWithKMS extends TestReencryption{
         miniKMS.getKMSUrl().toExternalForm().replace("://", "@");
   }
 
-  @Before
+  @BeforeEach
   public void setup() throws Exception {
     kmsDir = "target/test-classes/" + UUID.randomUUID().toString();
     final File dir = new File(kmsDir);
@@ -60,7 +60,7 @@ public class TestReencryptionWithKMS extends TestReencryption{
     super.setup();
   }
 
-  @After
+  @AfterEach
   public void teardown() {
     super.teardown();
     if (miniKMS != null) {

+ 28 - 26
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestFSMainOperationsWebHdfs.java

@@ -17,8 +17,12 @@
  */
 package org.apache.hadoop.hdfs.web;
 
-import static org.mockito.Mockito.spy;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -45,10 +49,9 @@ import org.apache.hadoop.security.AccessControlException;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.test.GenericTestUtils;
 import org.slf4j.event.Level;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 public class TestFSMainOperationsWebHdfs extends FSMainOperationsBaseTest {
   {
@@ -68,7 +71,7 @@ public class TestFSMainOperationsWebHdfs extends FSMainOperationsBaseTest {
     return fileSystem;
   }
 
-  @BeforeClass
+  @BeforeAll
   public static void setupCluster() {
     final Configuration conf = new Configuration();
     conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, 1024);
@@ -100,7 +103,7 @@ public class TestFSMainOperationsWebHdfs extends FSMainOperationsBaseTest {
     }
   }
 
-  @AfterClass
+  @AfterAll
   public static void shutdownCluster() {
     if (cluster != null) {
       cluster.shutdown();
@@ -125,16 +128,16 @@ public class TestFSMainOperationsWebHdfs extends FSMainOperationsBaseTest {
 
     Path catPath = new Path("/test/hadoop/catFile");
     DFSTestUtil.createFile(fSys, catPath, 1024, (short) 3, 0);
-    Assert.assertTrue(exists(fSys, catPath));
+    assertTrue(exists(fSys, catPath));
 
     fSys.concat(catPath, paths);
 
-    Assert.assertFalse(exists(fSys, paths[0]));
-    Assert.assertFalse(exists(fSys, paths[1]));
-    Assert.assertFalse(exists(fSys, paths[2]));
+    assertFalse(exists(fSys, paths[0]));
+    assertFalse(exists(fSys, paths[1]));
+    assertFalse(exists(fSys, paths[2]));
 
     FileStatus fileStatus = fSys.getFileStatus(catPath);
-    Assert.assertEquals(1024*4, fileStatus.getLen());
+    assertEquals(1024*4, fileStatus.getLen());
   }
 
   @Test
@@ -152,16 +155,15 @@ public class TestFSMainOperationsWebHdfs extends FSMainOperationsBaseTest {
 
     boolean isReady = fSys.truncate(file, newLength);
 
-    Assert.assertTrue("Recovery is not expected.", isReady);
+    assertTrue(isReady, "Recovery is not expected.");
 
     FileStatus fileStatus = fSys.getFileStatus(file);
-    Assert.assertEquals(fileStatus.getLen(), newLength);
+    assertEquals(fileStatus.getLen(), newLength);
     AppendTestUtil.checkFullFile(fSys, file, newLength, data, file.toString());
 
     ContentSummary cs = fSys.getContentSummary(dir);
-    Assert.assertEquals("Bad disk space usage", cs.getSpaceConsumed(),
-        newLength * repl);
-    Assert.assertTrue("Deleted", fSys.delete(dir, true));
+    assertEquals(cs.getSpaceConsumed(), newLength * repl, "Bad disk space usage");
+    assertTrue(fSys.delete(dir, true), "Deleted");
   }
 
   // Test that WebHdfsFileSystem.jsonParse() closes the connection's input
@@ -196,11 +198,11 @@ public class TestFSMainOperationsWebHdfs extends FSMainOperationsBaseTest {
     doReturn(myIn).when(spyConn).getInputStream();
 
     try {
-      Assert.assertFalse(closedInputStream);
+      assertFalse(closedInputStream);
       WebHdfsFileSystem.jsonParse(spyConn, false);
-      Assert.assertTrue(closedInputStream);
+      assertTrue(closedInputStream);
     } catch(IOException ioe) {
-      junit.framework.TestCase.fail();
+      fail();
     }
     conn.disconnect();
   }
@@ -209,21 +211,21 @@ public class TestFSMainOperationsWebHdfs extends FSMainOperationsBaseTest {
   @Test
   public void testMkdirsFailsForSubdirectoryOfExistingFile() throws Exception {
     Path testDir = getTestRootPath(fSys, "test/hadoop");
-    Assert.assertFalse(exists(fSys, testDir));
+    assertFalse(exists(fSys, testDir));
     fSys.mkdirs(testDir);
-    Assert.assertTrue(exists(fSys, testDir));
+    assertTrue(exists(fSys, testDir));
     
     createFile(getTestRootPath(fSys, "test/hadoop/file"));
     
     Path testSubDir = getTestRootPath(fSys, "test/hadoop/file/subdir");
     try {
       fSys.mkdirs(testSubDir);
-      Assert.fail("Should throw IOException.");
+      fail("Should throw IOException.");
     } catch (IOException e) {
       // expected
     }
     try {
-      Assert.assertFalse(exists(fSys, testSubDir));
+      assertFalse(exists(fSys, testSubDir));
     } catch(AccessControlException e) {
       // also okay for HDFS.
     }
@@ -231,12 +233,12 @@ public class TestFSMainOperationsWebHdfs extends FSMainOperationsBaseTest {
     Path testDeepSubDir = getTestRootPath(fSys, "test/hadoop/file/deep/sub/dir");
     try {
       fSys.mkdirs(testDeepSubDir);
-      Assert.fail("Should throw IOException.");
+      fail("Should throw IOException.");
     } catch (IOException e) {
       // expected
     }
     try {
-      Assert.assertFalse(exists(fSys, testDeepSubDir));
+      assertFalse(exists(fSys, testDeepSubDir));
     } catch(AccessControlException e) {
       // also okay for HDFS.
     }    

+ 2 - 2
hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/fileContext/TestOSSFileContextCreateMkdir.java

@@ -21,7 +21,7 @@ package org.apache.hadoop.fs.aliyun.oss.fileContext;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileContextCreateMkdirBaseTest;
 import org.apache.hadoop.fs.aliyun.oss.AliyunOSSTestUtils;
-import org.junit.Before;
+import org.junit.jupiter.api.BeforeEach;
 
 import java.io.IOException;
 
@@ -31,7 +31,7 @@ import java.io.IOException;
 public class TestOSSFileContextCreateMkdir
     extends FileContextCreateMkdirBaseTest {
 
-  @Before
+  @BeforeEach
   public void setUp() throws IOException, Exception {
     Configuration conf = new Configuration();
     fc = AliyunOSSTestUtils.createTestFileContext(conf);

+ 8 - 8
hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/fileContext/TestOSSFileContextMainOperations.java

@@ -21,9 +21,9 @@ package org.apache.hadoop.fs.aliyun.oss.fileContext;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileContextMainOperationsBaseTest;
 import org.apache.hadoop.fs.aliyun.oss.AliyunOSSTestUtils;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
 import java.io.IOException;
 
@@ -33,7 +33,7 @@ import java.io.IOException;
 public class TestOSSFileContextMainOperations
     extends FileContextMainOperationsBaseTest {
 
-  @Before
+  @BeforeEach
   public void setUp() throws IOException, Exception {
     Configuration conf = new Configuration();
     fc = AliyunOSSTestUtils.createTestFileContext(conf);
@@ -46,25 +46,25 @@ public class TestOSSFileContextMainOperations
   }
 
   @Test
-  @Ignore
+  @Disabled
   public void testCreateFlagAppendExistingFile() throws IOException {
     // append not supported, so test removed
   }
 
   @Test
-  @Ignore
+  @Disabled
   public void testCreateFlagCreateAppendExistingFile() throws IOException {
     // append not supported, so test removed
   }
 
   @Test
-  @Ignore
+  @Disabled
   public void testSetVerifyChecksum() throws IOException {
     // checksums ignored, so test ignored
   }
 
   @Test
-  @Ignore
+  @Disabled
   public void testBuilderCreateAppendExistingFile() throws IOException {
     // append not supported, so test removed
   }

+ 8 - 7
hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/fileContext/TestOSSFileContextStatistics.java

@@ -18,14 +18,15 @@
 
 package org.apache.hadoop.fs.aliyun.oss.fileContext;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FCStatisticsBaseTest;
 import org.apache.hadoop.fs.FileContext;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.aliyun.oss.AliyunOSSTestUtils;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 
 import java.net.URI;
 
@@ -34,7 +35,7 @@ import java.net.URI;
  */
 public class TestOSSFileContextStatistics extends FCStatisticsBaseTest {
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     Configuration conf = new Configuration();
     fc = AliyunOSSTestUtils.createTestFileContext(conf);
@@ -43,7 +44,7 @@ public class TestOSSFileContextStatistics extends FCStatisticsBaseTest {
     FileContext.clearStatistics();
   }
 
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     if (fc != null) {
       fc.delete(fileContextTestHelper.getTestRootPath(fc, "test"), true);
@@ -53,13 +54,13 @@ public class TestOSSFileContextStatistics extends FCStatisticsBaseTest {
   @Override
   protected void verifyReadBytes(FileSystem.Statistics stats) {
     // one blockSize for read, one for pread
-    Assert.assertEquals(2 * blockSize, stats.getBytesRead());
+    assertEquals(2 * blockSize, stats.getBytesRead());
   }
 
   @Override
   protected void verifyWrittenBytes(FileSystem.Statistics stats) {
     // no extra bytes are written
-    Assert.assertEquals(blockSize, stats.getBytesWritten());
+    assertEquals(blockSize, stats.getBytesWritten());
   }
 
   @Override

+ 5 - 5
hadoop-tools/hadoop-aliyun/src/test/java/org/apache/hadoop/fs/aliyun/oss/fileContext/TestOSSFileContextURI.java

@@ -22,9 +22,9 @@ package org.apache.hadoop.fs.aliyun.oss.fileContext;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileContextURIBase;
 import org.apache.hadoop.fs.aliyun.oss.AliyunOSSTestUtils;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
 import java.io.IOException;
 
@@ -33,7 +33,7 @@ import java.io.IOException;
  */
 public class TestOSSFileContextURI extends FileContextURIBase {
 
-  @Before
+  @BeforeEach
   public void setUp() throws IOException, Exception {
     Configuration conf = new Configuration();
     fc1 = AliyunOSSTestUtils.createTestFileContext(conf);
@@ -43,7 +43,7 @@ public class TestOSSFileContextURI extends FileContextURIBase {
   }
 
   @Test
-  @Ignore
+  @Disabled
   public void testFileStatus() throws IOException {
     // test ignored
     // (the statistics tested with this method are not relevant for an OSSFS)

+ 6 - 7
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AFSMainOperations.java

@@ -20,19 +20,18 @@ package org.apache.hadoop.fs.s3a;
 
 import java.io.IOException;
 
-import org.assertj.core.api.Assertions;
-import org.junit.Ignore;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSMainOperationsBaseTest;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.contract.s3a.S3AContract;
+import org.junit.jupiter.api.Disabled;
 
 import static org.apache.hadoop.fs.s3a.S3ATestUtils.createTestPath;
 import static org.apache.hadoop.fs.s3a.S3ATestUtils.isCreatePerformanceEnabled;
 import static org.apache.hadoop.fs.s3a.S3ATestUtils.setPerformanceFlags;
 import static org.apache.hadoop.fs.s3a.S3ATestUtils.skipIfAnalyticsAcceleratorEnabled;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * S3A Test suite for the FSMainOperationsBaseTest tests.
@@ -64,17 +63,17 @@ public class ITestS3AFSMainOperations extends FSMainOperationsBaseTest {
   }
 
   @Override
-  @Ignore("Permissions not supported")
+  @Disabled("Permissions not supported")
   public void testListStatusThrowsExceptionForUnreadableDir() {
   }
 
   @Override
-  @Ignore("Permissions not supported")
+  @Disabled("Permissions not supported")
   public void testGlobStatusThrowsExceptionForUnreadableDir() {
   }
 
   @Override
-  @Ignore("local FS path setup broken")
+  @Disabled("local FS path setup broken")
   public void testCopyToLocalWithUseRawLocalFileSystemOption()
       throws Exception {
   }
@@ -106,7 +105,7 @@ public class ITestS3AFSMainOperations extends FSMainOperationsBaseTest {
     boolean createPerformance = isCreatePerformanceEnabled(fSys);
     try {
       super.testOverwrite();
-      Assertions.assertThat(createPerformance)
+      assertThat(createPerformance)
           .describedAs("create performance enabled")
           .isFalse();
     } catch (AssertionError e) {

+ 2 - 2
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/fileContext/ITestS3AFileContextCreateMkdir.java

@@ -16,7 +16,7 @@ package org.apache.hadoop.fs.s3a.fileContext;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileContextCreateMkdirBaseTest;
 import org.apache.hadoop.fs.s3a.S3ATestUtils;
-import org.junit.Before;
+import org.junit.jupiter.api.BeforeEach;
 
 import static org.apache.hadoop.fs.s3a.S3ATestUtils.setPerformanceFlags;
 
@@ -26,7 +26,7 @@ import static org.apache.hadoop.fs.s3a.S3ATestUtils.setPerformanceFlags;
 public class ITestS3AFileContextCreateMkdir
         extends FileContextCreateMkdirBaseTest {
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     Configuration conf = setPerformanceFlags(
         new Configuration(),

+ 3 - 3
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/fileContext/ITestS3AFileContextCreateMkdirCreatePerf.java

@@ -13,8 +13,8 @@
  */
 package org.apache.hadoop.fs.s3a.fileContext;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileContextCreateMkdirBaseTest;
@@ -30,7 +30,7 @@ import static org.apache.hadoop.test.LambdaTestUtils.intercept;
 public class ITestS3AFileContextCreateMkdirCreatePerf
         extends FileContextCreateMkdirBaseTest {
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     Configuration conf = setPerformanceFlags(
         new Configuration(),

+ 8 - 8
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/fileContext/ITestS3AFileContextMainOperations.java

@@ -17,9 +17,9 @@ package org.apache.hadoop.fs.s3a.fileContext;
 import java.io.IOException;
 import java.util.UUID;
 
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileContextMainOperationsBaseTest;
@@ -36,7 +36,7 @@ public class ITestS3AFileContextMainOperations
     extends FileContextMainOperationsBaseTest {
 
 
-  @Before
+  @BeforeEach
   public void setUp() throws IOException, Exception {
     Configuration conf = setPerformanceFlags(
         new Configuration(),
@@ -65,25 +65,25 @@ public class ITestS3AFileContextMainOperations
   }
 
   @Test
-  @Ignore
+  @Disabled
   public void testCreateFlagAppendExistingFile() throws IOException {
     //append not supported, so test removed
   }
 
   @Test
-  @Ignore
+  @Disabled
   public void testCreateFlagCreateAppendExistingFile() throws IOException {
     //append not supported, so test removed
   }
 
   @Test
-  @Ignore
+  @Disabled
   public void testBuilderCreateAppendExistingFile() throws IOException {
     // not supported
   }
 
   @Test
-  @Ignore
+  @Disabled
   public void testSetVerifyChecksum() throws IOException {
     //checksums ignored, so test removed
   }

+ 8 - 8
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/fileContext/ITestS3AFileContextStatistics.java

@@ -26,11 +26,11 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.s3a.S3ATestUtils;
 import org.apache.hadoop.fs.s3a.auth.STSClientFactory;
 
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 
 import static org.apache.hadoop.fs.s3a.S3ATestUtils.skipIfAnalyticsAcceleratorEnabled;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * S3a implementation of FCStatisticsBaseTest.
@@ -43,7 +43,7 @@ public class ITestS3AFileContextStatistics extends FCStatisticsBaseTest {
   private Path testRootPath;
   private Configuration conf;
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     conf = new Configuration();
     // Analytics accelerator currently does not support IOStatistics, this will be added as
@@ -57,7 +57,7 @@ public class ITestS3AFileContextStatistics extends FCStatisticsBaseTest {
     FileContext.clearStatistics();
   }
 
-  @After
+  @AfterEach
   public void tearDown() throws Exception {
     S3ATestUtils.callQuietly(LOG,
         () -> fc != null && fc.delete(testRootPath, true));
@@ -66,7 +66,7 @@ public class ITestS3AFileContextStatistics extends FCStatisticsBaseTest {
   @Override
   protected void verifyReadBytes(FileSystem.Statistics stats) {
     // one blockSize for read, one for pread
-    Assert.assertEquals(2 * blockSize, stats.getBytesRead());
+    assertEquals(2 * blockSize, stats.getBytesRead());
   }
 
   /**
@@ -76,8 +76,8 @@ public class ITestS3AFileContextStatistics extends FCStatisticsBaseTest {
   @Override
   protected void verifyWrittenBytes(FileSystem.Statistics stats) {
     //No extra bytes are written
-    Assert.assertEquals("Mismatch in bytes written", blockSize,
-        stats.getBytesWritten());
+    assertEquals(blockSize,
+        stats.getBytesWritten(), "Mismatch in bytes written");
   }
 
   @Override

+ 5 - 5
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/fileContext/ITestS3AFileContextURI.java

@@ -17,9 +17,9 @@ import java.io.IOException;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileContextURIBase;
 import org.apache.hadoop.fs.s3a.S3ATestUtils;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
 import static org.apache.hadoop.fs.s3a.S3ATestUtils.setPerformanceFlags;
 
@@ -30,7 +30,7 @@ public class ITestS3AFileContextURI extends FileContextURIBase {
 
   private Configuration conf;
 
-  @Before
+  @BeforeEach
   public void setUp() throws IOException, Exception {
     conf = setPerformanceFlags(
         new Configuration(),
@@ -42,7 +42,7 @@ public class ITestS3AFileContextURI extends FileContextURIBase {
   }
 
   @Test
-  @Ignore
+  @Disabled
   public void testFileStatus() throws IOException {
     // test disabled
     // (the statistics tested with this method are not relevant for an S3FS)

+ 5 - 4
hadoop-tools/hadoop-azure-datalake/src/test/java/org/apache/hadoop/fs/adl/live/TestAdlFileContextCreateMkdirLive.java

@@ -19,14 +19,15 @@
 
 package org.apache.hadoop.fs.adl.live;
 
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.DelegateToFileSystem;
 import org.apache.hadoop.fs.FileContext;
 import org.apache.hadoop.fs.FileContextCreateMkdirBaseTest;
 import org.apache.hadoop.fs.FileContextTestHelper;
 import org.apache.hadoop.fs.FileSystem;
-import org.junit.Assume;
-import org.junit.BeforeClass;
+import org.junit.jupiter.api.BeforeAll;
 
 import java.net.URI;
 import java.util.UUID;
@@ -38,9 +39,9 @@ public class TestAdlFileContextCreateMkdirLive
     extends FileContextCreateMkdirBaseTest {
   private static final String KEY_FILE_SYSTEM = "test.fs.adl.name";
 
-  @BeforeClass
+  @BeforeAll
   public static void skipTestCheck() {
-    Assume.assumeTrue(AdlStorageConfiguration.isContractTestEnabled());
+    assumeTrue(AdlStorageConfiguration.isContractTestEnabled());
   }
 
   @Override

+ 9 - 8
hadoop-tools/hadoop-azure-datalake/src/test/java/org/apache/hadoop/fs/adl/live/TestAdlFileContextMainOperationsLive.java

@@ -19,11 +19,12 @@
 
 package org.apache.hadoop.fs.adl.live;
 
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.*;
-import org.junit.Assume;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import java.io.IOException;
 import java.net.URI;
@@ -39,9 +40,9 @@ public class TestAdlFileContextMainOperationsLive
 
   private static final String KEY_FILE_SYSTEM = "test.fs.adl.name";
 
-  @BeforeClass
+  @BeforeAll
   public static void skipTestCheck() {
-    Assume.assumeTrue(AdlStorageConfiguration.isContractTestEnabled());
+    assumeTrue(AdlStorageConfiguration.isContractTestEnabled());
   }
 
   @Override
@@ -81,7 +82,7 @@ public class TestAdlFileContextMainOperationsLive
       // set.
       // The test is failing with NPE on windows platform only, with Linux
       // platform test passes.
-      Assume.assumeTrue(false);
+      assumeTrue(false);
     } else {
       super.testWorkingDirectory();
     }
@@ -89,11 +90,11 @@ public class TestAdlFileContextMainOperationsLive
 
   @Override
   public void testUnsupportedSymlink() throws IOException {
-    Assume.assumeTrue(false);
+    assumeTrue(false);
   }
 
   @Test
   public void testSetVerifyChecksum() throws IOException {
-    Assume.assumeTrue(false);
+    assumeTrue(false);
   }
 }

+ 2 - 0
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/TestNativeAzureFileSystemOperationsMocked.java

@@ -23,6 +23,7 @@ import static org.apache.hadoop.test.PlatformAssumptions.assumeNotWindows;
 import org.apache.hadoop.fs.FSMainOperationsBaseTest;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.junit.jupiter.api.BeforeEach;
 
 public class TestNativeAzureFileSystemOperationsMocked extends
     FSMainOperationsBaseTest {
@@ -34,6 +35,7 @@ public class TestNativeAzureFileSystemOperationsMocked extends
     super(TEST_ROOT_DIR);
   }
 
+  @BeforeEach
   @Override
   public void setUp() throws Exception {
     fSys = AzureBlobStorageTestAccount.createMock().getFileSystem();

+ 3 - 4
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemMainOperation.java

@@ -18,11 +18,10 @@
 
 package org.apache.hadoop.fs.azurebfs;
 
-import org.junit.Ignore;
-
 import org.apache.hadoop.fs.FSMainOperationsBaseTest;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.azurebfs.contract.ABFSContractTestBinding;
+import org.junit.jupiter.api.Disabled;
 
 /**
  * Test AzureBlobFileSystem main operations.
@@ -63,14 +62,14 @@ public class ITestAzureBlobFileSystemMainOperation extends FSMainOperationsBaseT
   }
 
   @Override
-  @Ignore("Permission check for getFileInfo doesn't match the HdfsPermissionsGuide")
+  @Disabled("Permission check for getFileInfo doesn't match the HdfsPermissionsGuide")
   public void testListStatusThrowsExceptionForUnreadableDir() {
     // Permission Checks:
     // https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsPermissionsGuide.html
   }
 
   @Override
-  @Ignore("Permission check for getFileInfo doesn't match the HdfsPermissionsGuide")
+  @Disabled("Permission check for getFileInfo doesn't match the HdfsPermissionsGuide")
   public void testGlobStatusThrowsExceptionForUnreadableDir() {
     // Permission Checks:
     // https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsPermissionsGuide.html

Some files were not shown because too many files changed in this diff