Skip to content

Commit a75c15e

Browse files
committed
HADOOP-19433. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-extras.
1 parent e8a64d0 commit a75c15e

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

hadoop-tools/hadoop-extras/src/test/java/org/apache/hadoop/mapred/tools/TestGetGroups.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,25 @@
2424
import org.apache.hadoop.mapred.tools.GetGroups;
2525
import org.apache.hadoop.tools.GetGroupsTestBase;
2626
import org.apache.hadoop.util.Tool;
27-
import org.junit.After;
28-
import org.junit.Before;
29-
import org.junit.Ignore;
27+
import org.junit.jupiter.api.AfterEach;
28+
import org.junit.jupiter.api.BeforeEach;
29+
import org.junit.jupiter.api.Disabled;
3030

3131
/**
3232
* Tests for the MR implementation of {@link GetGroups}
3333
*/
34-
@Ignore
34+
@Disabled
3535
public class TestGetGroups extends GetGroupsTestBase {
3636

3737
private MiniMRCluster cluster;
3838

39-
@Before
39+
@BeforeEach
4040
public void setUpJobTracker() throws IOException, InterruptedException {
4141
cluster = new MiniMRCluster(0, "file:///", 1);
4242
conf = cluster.createJobConf();
4343
}
4444

45-
@After
45+
@AfterEach
4646
public void tearDownJobTracker() throws IOException {
4747
cluster.shutdown();
4848
}

hadoop-tools/hadoop-extras/src/test/java/org/apache/hadoop/tools/TestDistCh.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@
3838
import org.apache.hadoop.mapred.MiniMRClientClusterFactory;
3939
import org.apache.hadoop.test.GenericTestUtils;
4040
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;
41-
import org.junit.Assert;
42-
import org.junit.Test;
41+
import org.junit.jupiter.api.Test;
4342
import org.slf4j.event.Level;
4443

4544
import static org.slf4j.LoggerFactory.getLogger;
45+
import static org.junit.jupiter.api.Assertions.assertEquals;
46+
import static org.junit.jupiter.api.Assertions.assertTrue;
4647

4748
public class TestDistCh {
4849
{
@@ -77,20 +78,20 @@ static class FileTree {
7778

7879
Path createSmallFile(Path dir) throws IOException {
7980
final Path f = new Path(dir, "f" + ++fcount);
80-
Assert.assertTrue(!fs.exists(f));
81+
assertTrue(!fs.exists(f));
8182
final DataOutputStream out = fs.create(f);
8283
try {
8384
out.writeBytes("createSmallFile: f=" + f);
8485
} finally {
8586
out.close();
8687
}
87-
Assert.assertTrue(fs.exists(f));
88+
assertTrue(fs.exists(f));
8889
return f;
8990
}
9091

9192
Path mkdir(Path dir) throws IOException {
92-
Assert.assertTrue(fs.mkdirs(dir));
93-
Assert.assertTrue(fs.getFileStatus(dir).isDirectory());
93+
assertTrue(fs.mkdirs(dir));
94+
assertTrue(fs.getFileStatus(dir).isDirectory());
9495
return dir;
9596
}
9697

@@ -193,13 +194,13 @@ public void testDistCh() throws Exception {
193194
}
194195

195196
static void checkFileStatus(ChPermissionStatus expected, FileStatus actual) {
196-
Assert.assertEquals(expected.getUserName(), actual.getOwner());
197-
Assert.assertEquals(expected.getGroupName(), actual.getGroup());
197+
assertEquals(expected.getUserName(), actual.getOwner());
198+
assertEquals(expected.getGroupName(), actual.getGroup());
198199
FsPermission perm = expected.getPermission();
199200
if (actual.isFile() && expected.defaultPerm) {
200201
perm = perm.applyUMask(UMASK);
201202
}
202-
Assert.assertEquals(perm, actual.getPermission());
203+
assertEquals(perm, actual.getPermission());
203204
}
204205

205206
private static String runLsr(final FsShell shell, String root, int returnvalue
@@ -213,7 +214,7 @@ private static String runLsr(final FsShell shell, String root, int returnvalue
213214
System.setErr(out);
214215
final String results;
215216
try {
216-
Assert.assertEquals(returnvalue, shell.run(new String[]{"-lsr", root}));
217+
assertEquals(returnvalue, shell.run(new String[]{"-lsr", root}));
217218
results = bytes.toString();
218219
} finally {
219220
IOUtils.closeStream(out);

0 commit comments

Comments
 (0)