MAPREDUCE-6914. Tests use assertTrue(....equals(...)) instead of 
assertEquals()). (Daniel Templeton via Yufei Gu)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b8e82418
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b8e82418
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b8e82418

Branch: refs/heads/HADOOP-13345
Commit: b8e8241854904e3a92b636ffaa6f4c651e47cea2
Parents: c617fe0
Author: Yufei Gu <yu...@apache.org>
Authored: Thu Aug 3 11:44:34 2017 -0700
Committer: Yufei Gu <yu...@apache.org>
Committed: Thu Aug 3 11:44:34 2017 -0700

----------------------------------------------------------------------
 .../hadoop/mapreduce/v2/app/TestJobEndNotifier.java | 16 ++++++++--------
 .../v2/app/rm/TestRMContainerAllocator.java         |  3 +--
 .../java/org/apache/hadoop/mapred/TestQueue.java    |  8 ++++----
 .../org/apache/hadoop/mapred/TestYARNRunner.java    |  8 ++++----
 .../mapreduce/lib/input/TestMultipleInputs.java     | 10 +++++-----
 5 files changed, 22 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b8e82418/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestJobEndNotifier.java
----------------------------------------------------------------------
diff --git 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestJobEndNotifier.java
 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestJobEndNotifier.java
index d122a9b..5af79d6 100644
--- 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestJobEndNotifier.java
+++ 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestJobEndNotifier.java
@@ -124,20 +124,20 @@ public class TestJobEndNotifier extends JobEndNotifier {
       proxyToUse.type() == Proxy.Type.DIRECT);
     conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "somehost:1000");
     setConf(conf);
-    Assert.assertTrue("Proxy should have been set but wasn't ",
-      proxyToUse.toString().equals("HTTP @ somehost:1000"));
+    Assert.assertEquals("Proxy should have been set but wasn't ",
+      "HTTP @ somehost:1000", proxyToUse.toString());
     conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "socks@somehost:1000");
     setConf(conf);
-    Assert.assertTrue("Proxy should have been socks but wasn't ",
-      proxyToUse.toString().equals("SOCKS @ somehost:1000"));
+    Assert.assertEquals("Proxy should have been socks but wasn't ",
+      "SOCKS @ somehost:1000", proxyToUse.toString());
     conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "SOCKS@somehost:1000");
     setConf(conf);
-    Assert.assertTrue("Proxy should have been socks but wasn't ",
-      proxyToUse.toString().equals("SOCKS @ somehost:1000"));
+    Assert.assertEquals("Proxy should have been socks but wasn't ",
+      "SOCKS @ somehost:1000", proxyToUse.toString());
     conf.set(MRJobConfig.MR_JOB_END_NOTIFICATION_PROXY, "sfafn@somehost:1000");
     setConf(conf);
-    Assert.assertTrue("Proxy should have been http but wasn't ",
-      proxyToUse.toString().equals("HTTP @ somehost:1000"));
+    Assert.assertEquals("Proxy should have been http but wasn't ",
+      "HTTP @ somehost:1000", proxyToUse.toString());
     
   }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b8e82418/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestRMContainerAllocator.java
----------------------------------------------------------------------
diff --git 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestRMContainerAllocator.java
 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestRMContainerAllocator.java
index bc05c62..6c51626 100644
--- 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestRMContainerAllocator.java
+++ 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestRMContainerAllocator.java
@@ -329,8 +329,7 @@ public class TestRMContainerAllocator {
     for(TaskAttemptContainerAssignedEvent event : assigned) {
       if(event.getTaskAttemptID().equals(event3.getAttemptID())) {
         assigned.remove(event);
-        Assert.assertTrue(
-                    event.getContainer().getNodeId().getHost().equals("h3"));
+        Assert.assertEquals("h3", event.getContainer().getNodeId().getHost());
         break;
       }
     }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b8e82418/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestQueue.java
----------------------------------------------------------------------
diff --git 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestQueue.java
 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestQueue.java
index fb2d5e0..796bbee 100644
--- 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestQueue.java
+++ 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestQueue.java
@@ -74,13 +74,13 @@ public class TestQueue {
       assertTrue(root.getChildren().size() == 2);
       Iterator<Queue> iterator = root.getChildren().iterator();
       Queue firstSubQueue = iterator.next();
-      assertTrue(firstSubQueue.getName().equals("first"));
+      assertEquals("first", firstSubQueue.getName());
       assertEquals(
           firstSubQueue.getAcls().get("mapred.queue.first.acl-submit-job")
               .toString(),
           "Users [user1, user2] and members of the groups [group1, group2] are 
allowed");
       Queue secondSubQueue = iterator.next();
-      assertTrue(secondSubQueue.getName().equals("second"));
+      assertEquals("second", secondSubQueue.getName());
       assertEquals(secondSubQueue.getProperties().getProperty("key"), "value");
       assertEquals(secondSubQueue.getProperties().getProperty("key1"), 
"value1");
       // test status
@@ -207,13 +207,13 @@ public class TestQueue {
     assertTrue(root.getChildren().size() == 2);
     Iterator<Queue> iterator = root.getChildren().iterator();
     Queue firstSubQueue = iterator.next();
-    assertTrue(firstSubQueue.getName().equals("first"));
+    assertEquals("first", firstSubQueue.getName());
     assertEquals(
         firstSubQueue.getAcls().get("mapred.queue.first.acl-submit-job")
             .toString(),
         "Users [user1, user2] and members of the groups [group1, group2] are 
allowed");
     Queue secondSubQueue = iterator.next();
-    assertTrue(secondSubQueue.getName().equals("second"));
+    assertEquals("second", secondSubQueue.getName());
 
     assertEquals(firstSubQueue.getState().getStateName(), "running");
     assertEquals(secondSubQueue.getState().getStateName(), "stopped");

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b8e82418/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestYARNRunner.java
----------------------------------------------------------------------
diff --git 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestYARNRunner.java
 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestYARNRunner.java
index bd3e524..55ddea6 100644
--- 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestYARNRunner.java
+++ 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestYARNRunner.java
@@ -871,10 +871,10 @@ public class TestYARNRunner {
     Configuration confSent = BuilderUtils.parseTokensConf(submissionContext);
 
     // configs that match regex should be included
-    Assert.assertTrue(confSent.get("dfs.namenode.rpc-address.mycluster2.nn1")
-        .equals("123.0.0.1"));
-    Assert.assertTrue(confSent.get("dfs.namenode.rpc-address.mycluster2.nn2")
-        .equals("123.0.0.2"));
+    Assert.assertEquals("123.0.0.1",
+        confSent.get("dfs.namenode.rpc-address.mycluster2.nn1"));
+    Assert.assertEquals("123.0.0.2",
+        confSent.get("dfs.namenode.rpc-address.mycluster2.nn2"));
 
     // configs that aren't matching regex should not be included
     Assert.assertTrue(confSent.get("hadoop.tmp.dir") == null || !confSent

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b8e82418/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/lib/input/TestMultipleInputs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/lib/input/TestMultipleInputs.java
 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/lib/input/TestMultipleInputs.java
index 632c40e..a6f8a72 100644
--- 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/lib/input/TestMultipleInputs.java
+++ 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/lib/input/TestMultipleInputs.java
@@ -134,11 +134,11 @@ public class TestMultipleInputs extends HadoopTestCase {
     BufferedReader output = new BufferedReader(new InputStreamReader(fs
         .open(new Path(outDir, "part-r-00000"))));
     // reducer should have counted one key from each file
-    assertTrue(output.readLine().equals("a 2"));
-    assertTrue(output.readLine().equals("b 2"));
-    assertTrue(output.readLine().equals("c 2"));
-    assertTrue(output.readLine().equals("d 2"));
-    assertTrue(output.readLine().equals("e 2"));
+    assertEquals("a 2", output.readLine());
+    assertEquals("b 2", output.readLine());
+    assertEquals("c 2", output.readLine());
+    assertEquals("d 2", output.readLine());
+    assertEquals("e 2", output.readLine());
   }
 
   @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to