From e9159db62367920c34616179aa4ced46d1ed22e1 Mon Sep 17 00:00:00 2001 From: Abhishek Modi Date: Mon, 7 May 2018 01:15:14 +0900 Subject: [PATCH] MAPREDUCE-7093. Use assertEquals instead of assertTrue(a == b) in TestMapReduceJobControlWithMocks Signed-off-by: Akira Ajisaka --- .../TestMapReduceJobControlWithMocks.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/lib/jobcontrol/TestMapReduceJobControlWithMocks.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/lib/jobcontrol/TestMapReduceJobControlWithMocks.java index e89f090606..a0d5125c01 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/lib/jobcontrol/TestMapReduceJobControlWithMocks.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/lib/jobcontrol/TestMapReduceJobControlWithMocks.java @@ -19,7 +19,6 @@ package org.apache.hadoop.mapreduce.lib.jobcontrol; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -52,10 +51,10 @@ public void testSuccessfulJobs() throws Exception { assertEquals("Success list", 4, jobControl.getSuccessfulJobList().size()); assertEquals("Failed list", 0, jobControl.getFailedJobList().size()); - assertTrue(job1.getJobState() == ControlledJob.State.SUCCESS); - assertTrue(job2.getJobState() == ControlledJob.State.SUCCESS); - assertTrue(job3.getJobState() == ControlledJob.State.SUCCESS); - assertTrue(job4.getJobState() == ControlledJob.State.SUCCESS); + assertEquals(ControlledJob.State.SUCCESS, job1.getJobState()); + assertEquals(ControlledJob.State.SUCCESS, job2.getJobState()); + assertEquals(ControlledJob.State.SUCCESS, job3.getJobState()); + assertEquals(ControlledJob.State.SUCCESS, job4.getJobState()); jobControl.stop(); } @@ -74,10 +73,10 @@ public void testFailedJob() throws Exception { assertEquals("Success list", 1, jobControl.getSuccessfulJobList().size()); assertEquals("Failed list", 3, jobControl.getFailedJobList().size()); - assertTrue(job1.getJobState() == ControlledJob.State.FAILED); - assertTrue(job2.getJobState() == ControlledJob.State.SUCCESS); - assertTrue(job3.getJobState() == ControlledJob.State.DEPENDENT_FAILED); - assertTrue(job4.getJobState() == ControlledJob.State.DEPENDENT_FAILED); + assertEquals(ControlledJob.State.FAILED, job1.getJobState()); + assertEquals(ControlledJob.State.SUCCESS, job2.getJobState()); + assertEquals(ControlledJob.State.DEPENDENT_FAILED, job3.getJobState()); + assertEquals(ControlledJob.State.DEPENDENT_FAILED, job4.getJobState()); jobControl.stop(); } @@ -99,7 +98,7 @@ public void testErrorWhileSubmitting() throws Exception { assertEquals("Success list", 0, jobControl.getSuccessfulJobList().size()); assertEquals("Failed list", 1, jobControl.getFailedJobList().size()); - assertTrue(job1.getJobState() == ControlledJob.State.FAILED); + assertEquals(ControlledJob.State.FAILED, job1.getJobState()); } finally { jobControl.stop(); }