Skip to content

HADOOP-19415. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-common Part9. #7668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

import static org.apache.hadoop.fs.FileContextTestHelper.readFile;
import static org.apache.hadoop.fs.FileContextTestHelper.writeFile;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.Arrays;

import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.StringUtils;
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.slf4j.event.Level;

/**
Expand Down Expand Up @@ -57,12 +57,12 @@ public abstract class FileContextUtilBase {
}
}

@Before
@BeforeEach
public void setUp() throws Exception {
fc.mkdir(fileContextTestHelper.getTestRootPath(fc), FileContext.DEFAULT_PERM, true);
}

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

// verify that newly copied file2 exists
assertTrue("Failed to copy file2 ", fc.util().exists(file2));
assertTrue(fc.util().exists(file2), "Failed to copy file2 ");
// verify that file2 contains test string
assertTrue("Copied files does not match ",Arrays.equals(ts.getBytes(),
readFile(fc,file2,ts.getBytes().length)));
assertTrue(Arrays.equals(ts.getBytes(),
readFile(fc, file2, ts.getBytes().length)), "Copied files does not match ");
}

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

// verify that newly copied file2 exists
assertTrue("Failed to copy file2 ", fc.util().exists(file2));
assertTrue(fc.util().exists(file2), "Failed to copy file2 ");
// verify that file2 contains test string
assertTrue("Copied files does not match ",Arrays.equals(ts.getBytes(),
readFile(fc,file2,ts.getBytes().length)));
assertTrue(Arrays.equals(ts.getBytes(),
readFile(fc, file2, ts.getBytes().length)), "Copied files does not match ");
}
}
Loading