From e680cf14d2687dec8714ea7ec5f707f49a33f337 Mon Sep 17 00:00:00 2001 From: zhtttylz Date: Wed, 10 Sep 2025 18:58:13 +0800 Subject: [PATCH] HDFS-17827. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-hdfs-native-client. --- .../native/fuse-dfs/test/TestFuseDFS.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/test/TestFuseDFS.java b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/test/TestFuseDFS.java index 68cd29a703b3c..eb8237ccb7664 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/test/TestFuseDFS.java +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/test/TestFuseDFS.java @@ -32,10 +32,13 @@ import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.util.StringUtils; -import org.junit.Test; -import org.junit.BeforeClass; -import org.junit.AfterClass; -import static org.junit.Assert.*; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.AfterAll; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.fail; /** * Basic functional tests on a fuse-dfs mount. @@ -135,7 +138,7 @@ private static void checkFile(File f, String expectedContents) fi.close(); // NB: leaving f unclosed prevents unmount } String s = new String(b, 0, len); - assertEquals("File content differs", expectedContents, s); + assertEquals(expectedContents, s, "File content differs"); } private static class RedirectToStdoutThread extends Thread { @@ -227,13 +230,14 @@ private static Process establishMount(URI uri) throws IOException { private static void teardownMount() throws IOException { execWaitRet("fusermount -u " + mountPoint); try { - assertEquals(0, fuseProcess.waitFor()); // fuse_dfs should exit cleanly + assertEquals(0, + fuseProcess.waitFor()); // fuse_dfs should exit cleanly } catch (InterruptedException e) { fail("interrupted while waiting for fuse_dfs process to exit."); } } - @BeforeClass + @BeforeAll public static void startUp() throws IOException { Configuration conf = new HdfsConfiguration(); r = Runtime.getRuntime(); @@ -245,7 +249,7 @@ public static void startUp() throws IOException { fuseProcess = establishMount(fs.getUri()); } - @AfterClass + @AfterAll public static void tearDown() throws IOException { // Unmount before taking down the mini cluster // so no outstanding operations hang.