diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/pom.xml b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/pom.xml
index ff268cbd04..e3b3511c0c 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/pom.xml
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/pom.xml
@@ -124,26 +124,6 @@
assertj-core
test
-
- org.junit.platform
- junit-platform-launcher
- test
-
-
- org.junit.jupiter
- junit-jupiter-api
- test
-
-
- org.junit.jupiter
- junit-jupiter-engine
- test
-
-
- org.junit.platform
- junit-platform-launcher
- test
-
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/logaggregation/TestContainerLogsUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/logaggregation/TestContainerLogsUtils.java
index cce8a62ba1..0cb71b5990 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/logaggregation/TestContainerLogsUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/logaggregation/TestContainerLogsUtils.java
@@ -38,10 +38,10 @@
import org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileControllerContext;
import org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileControllerFactory;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
/**
* This class contains several utility functions for log aggregation tests.
+ * Any assertion libraries shouldn't be used here because this class is used by
+ * multiple modules including MapReduce.
*/
public final class TestContainerLogsUtils {
@@ -75,13 +75,16 @@ public static void createContainerLogFileInRemoteFS(Configuration conf,
if (fs.exists(rootLogDirPath)) {
fs.delete(rootLogDirPath, true);
}
- assertTrue(fs.mkdirs(rootLogDirPath));
+ fs.mkdirs(rootLogDirPath);
+ // Make sure the target dir is created. If not, FileNotFoundException is thrown
+ fs.getFileStatus(rootLogDirPath);
Path appLogsDir = new Path(rootLogDirPath, appId.toString());
if (fs.exists(appLogsDir)) {
fs.delete(appLogsDir, true);
}
- assertTrue(fs.mkdirs(appLogsDir));
-
+ fs.mkdirs(appLogsDir);
+ // Make sure the target dir is created. If not, FileNotFoundException is thrown
+ fs.getFileStatus(appLogsDir);
createContainerLogInLocalDir(appLogsDir, containerToContent, fs, fileName);
// upload container logs to remote log dir
@@ -95,7 +98,9 @@ public static void createContainerLogFileInRemoteFS(Configuration conf,
if (fs.exists(path) && deleteRemoteLogDir) {
fs.delete(path, true);
}
- assertTrue(fs.mkdirs(path));
+ fs.mkdirs(path);
+ // Make sure the target dir is created. If not, FileNotFoundException is thrown
+ fs.getFileStatus(path);
uploadContainerLogIntoRemoteDir(ugi, conf, rootLogDirList, nodeId, appId,
containerToContent.keySet(), path);
}
@@ -111,7 +116,9 @@ private static void createContainerLogInLocalDir(Path appLogsDir,
if (fs.exists(containerLogsDir)) {
fs.delete(containerLogsDir, true);
}
- assertTrue(fs.mkdirs(containerLogsDir));
+ fs.mkdirs(containerLogsDir);
+ // Make sure the target dir is created. If not, FileNotFoundException is thrown
+ fs.getFileStatus(containerLogsDir);
Writer writer =
new FileWriter(new File(containerLogsDir.toString(), fileName));
writer.write(content);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/WebServicesTestUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/WebServicesTestUtils.java
index f803c5313c..ce93b06e70 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/WebServicesTestUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/WebServicesTestUtils.java
@@ -27,8 +27,7 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
public class WebServicesTestUtils {
public static long getXmlLong(Element element, String name) {
@@ -121,28 +120,24 @@ public static String getXmlAttrString(Element element, String name) {
}
public static void checkStringMatch(String print, String expected, String got) {
- assertTrue(
- got.matches(expected),
- print + " doesn't match, got: " + got + " expected: " + expected);
+ assertThat(got).as(print).matches(expected);
}
public static void checkStringContains(String print, String expected, String got) {
- assertTrue(
- got.contains(expected),
- print + " doesn't contain expected string, got: " + got + " expected: " + expected);
+ assertThat(got).as(print).contains(expected);
}
public static void checkStringEqual(String print, String expected, String got) {
- assertEquals(got, expected);
+ assertThat(got).as(print).isEqualTo(expected);
}
public static void assertResponseStatusCode(StatusType expected,
StatusType actual) {
- assertResponseStatusCode(null, expected, actual);
+ assertThat(expected.getStatusCode()).isEqualTo(actual.getStatusCode());
}
public static void assertResponseStatusCode(String errmsg,
StatusType expected, StatusType actual) {
- assertEquals(expected.getStatusCode(), actual.getStatusCode(), errmsg);
+ assertThat(expected.getStatusCode()).withFailMessage(errmsg).isEqualTo(actual.getStatusCode());
}
}