Skip to content

Commit d1f75ad

Browse files
committed
HADOOP-19415. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-common Part7.
1 parent db81ea6 commit d1f75ad

File tree

188 files changed

+3223
-2916
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+3223
-2916
lines changed

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfigRedactor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
package org.apache.hadoop.conf;
2020

21-
import org.junit.Test;
21+
import org.junit.jupiter.api.Test;
2222

2323
import java.util.Arrays;
2424
import java.util.List;

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextUtilBase.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919

2020
import static org.apache.hadoop.fs.FileContextTestHelper.readFile;
2121
import static org.apache.hadoop.fs.FileContextTestHelper.writeFile;
22-
import static org.junit.Assert.assertTrue;
22+
import static org.junit.jupiter.api.Assertions.assertTrue;
2323

2424
import java.util.Arrays;
2525

2626
import org.apache.hadoop.test.GenericTestUtils;
2727
import org.apache.hadoop.util.StringUtils;
28-
import org.junit.After;
29-
import org.junit.Before;
30-
import org.junit.Test;
28+
import org.junit.jupiter.api.AfterEach;
29+
import org.junit.jupiter.api.BeforeEach;
30+
import org.junit.jupiter.api.Test;
3131
import org.slf4j.event.Level;
3232

3333
/**
@@ -57,12 +57,12 @@ public abstract class FileContextUtilBase {
5757
}
5858
}
5959

60-
@Before
60+
@BeforeEach
6161
public void setUp() throws Exception {
6262
fc.mkdir(fileContextTestHelper.getTestRootPath(fc), FileContext.DEFAULT_PERM, true);
6363
}
6464

65-
@After
65+
@AfterEach
6666
public void tearDown() throws Exception {
6767
if (fc != null) {
6868
fc.delete(fileContextTestHelper.getTestRootPath(fc), true);
@@ -80,10 +80,10 @@ public void testFcCopy() throws Exception{
8080
fc.util().copy(file1, file2);
8181

8282
// verify that newly copied file2 exists
83-
assertTrue("Failed to copy file2 ", fc.util().exists(file2));
83+
assertTrue(fc.util().exists(file2), "Failed to copy file2 ");
8484
// verify that file2 contains test string
85-
assertTrue("Copied files does not match ",Arrays.equals(ts.getBytes(),
86-
readFile(fc,file2,ts.getBytes().length)));
85+
assertTrue(Arrays.equals(ts.getBytes(),
86+
readFile(fc,file2,ts.getBytes().length)), "Copied files does not match ");
8787
}
8888

8989
@Test
@@ -103,9 +103,9 @@ public void testRecursiveFcCopy() throws Exception {
103103
fc.util().copy(dir1, dir2);
104104

105105
// verify that newly copied file2 exists
106-
assertTrue("Failed to copy file2 ", fc.util().exists(file2));
106+
assertTrue(fc.util().exists(file2), "Failed to copy file2 ");
107107
// verify that file2 contains test string
108-
assertTrue("Copied files does not match ",Arrays.equals(ts.getBytes(),
109-
readFile(fc,file2,ts.getBytes().length)));
108+
assertTrue(Arrays.equals(ts.getBytes(),
109+
readFile(fc,file2,ts.getBytes().length)), "Copied files does not match ");
110110
}
111111
}

0 commit comments

Comments
 (0)