TEZ-4383: upgrade to mockito 4.3.1 (#190) (Laszlo Attila Toth reviewed by Laszlo Bodor)

diff --git a/pom.xml b/pom.xml
index 1a51c6a..c496e0c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -704,8 +704,8 @@
       </dependency>
       <dependency>
         <groupId>org.mockito</groupId>
-        <artifactId>mockito-all</artifactId>
-        <version>1.10.8</version>
+        <artifactId>mockito-core</artifactId>
+        <version>4.3.1</version>
       </dependency>
       <dependency>
         <groupId>org.apache.commons</groupId>
diff --git a/tez-api/pom.xml b/tez-api/pom.xml
index 4e1825b..cd5abdb 100644
--- a/tez-api/pom.xml
+++ b/tez-api/pom.xml
@@ -107,7 +107,7 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/tez-api/src/test/java/org/apache/tez/client/TestTezClient.java b/tez-api/src/test/java/org/apache/tez/client/TestTezClient.java
index 67c4a60..4f33348 100644
--- a/tez-api/src/test/java/org/apache/tez/client/TestTezClient.java
+++ b/tez-api/src/test/java/org/apache/tez/client/TestTezClient.java
@@ -38,14 +38,14 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.isNull;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.atLeast;
 import static org.mockito.Mockito.doCallRealMethod;
+import static org.mockito.Mockito.isNull;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
@@ -89,9 +89,7 @@
 import org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPB;
 import org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolRPC.GetAMStatusRequestProto;
 import org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolRPC.GetAMStatusResponseProto;
-import org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolRPC.GetDAGStatusRequestProto;
 import org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolRPC.GetDAGStatusResponseProto;
-import org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolRPC.ShutdownSessionRequestProto;
 import org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolRPC.SubmitDAGRequestProto;
 import org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolRPC.TezAppMasterStatusProto;
 import org.apache.tez.dag.api.records.DAGProtos.DAGStatusProto;
@@ -188,10 +186,11 @@
     YarnClient yarnClient = mock(YarnClient.class, RETURNS_DEEP_STUBS);
     when(yarnClient.createApplication().getNewApplicationResponse().getApplicationId()).thenReturn(appId1);
     when(yarnClient.getApplicationReport(appId1).getYarnApplicationState()).thenReturn(YarnApplicationState.NEW);
-    when(yarnClient.submitApplication(any(ApplicationSubmissionContext.class))).thenReturn(appId1);
+    when(yarnClient.submitApplication(any())).thenReturn(appId1);
 
     DAGClientAMProtocolBlockingPB sessionAmProxy = mock(DAGClientAMProtocolBlockingPB.class, RETURNS_DEEP_STUBS);
-    when(sessionAmProxy.getAMStatus(any(RpcController.class), any(GetAMStatusRequestProto.class)))
+    when(sessionAmProxy.getAMStatus(any(), any()))
+        .thenReturn(GetAMStatusResponseProto.newBuilder().setStatus(TezAppMasterStatusProto.RUNNING).build())
         .thenReturn(GetAMStatusResponseProto.newBuilder().setStatus(TezAppMasterStatusProto.RUNNING).build());
 
     client.sessionAmProxy = sessionAmProxy;
@@ -255,7 +254,7 @@
     client.stop();
 
     ArgumentCaptor<SubmitDAGRequestProto> captor = ArgumentCaptor.forClass(SubmitDAGRequestProto.class);
-    verify(client.sessionAmProxy).submitDAG((RpcController)any(), captor.capture());
+    verify(client.sessionAmProxy).submitDAG(any(), captor.capture());
     SubmitDAGRequestProto request = captor.getValue();
 
     if (shouldSerialize) {
@@ -308,12 +307,12 @@
     verify(client2.mockYarnClient, times(0)).submitApplication(captor.capture());
 
     // Validate dag submission from second TezClient as normal */
-    verify(client2.sessionAmProxy, times(1)).submitDAG((RpcController)any(), (SubmitDAGRequestProto) any());
+    verify(client2.sessionAmProxy, times(1)).submitDAG(any(), any());
 
     // Validate stop from new TezClient as normal */
     client2.stop();
-    verify(client2.sessionAmProxy, times(1)).shutdownSession((RpcController) any(),
-            (ShutdownSessionRequestProto) any());
+    verify(client2.sessionAmProxy, times(1)).shutdownSession(any(),
+            any());
     verify(client2.mockYarnClient, times(1)).stop();
     /* END reuse of AM from new TezClient */
   }
@@ -330,7 +329,7 @@
     when(client.mockYarnClient.getApplicationReport(client.mockAppId).getYarnApplicationState())
     .thenReturn(YarnApplicationState.RUNNING);
     client.start();
-    verify(client.mockYarnClient, times(1)).init((Configuration)any());
+    verify(client.mockYarnClient, times(1)).init(any());
     verify(client.mockYarnClient, times(1)).start();
     if (isSession) {
       verify(client.mockYarnClient, times(1)).submitApplication(captor.capture());
@@ -353,6 +352,10 @@
     Vertex vertex = Vertex.create("Vertex", ProcessorDescriptor.create("P"), 1,
         Resource.newInstance(1, 1));
     DAG dag = DAG.create("DAG").addVertex(vertex).addTaskLocalFiles(lrDAG);
+    if (!isSession) {
+      when(client.sessionAmProxy.getAMStatus(any(), any()))
+              .thenReturn(GetAMStatusResponseProto.newBuilder().setStatus(TezAppMasterStatusProto.SHUTDOWN).build());
+    }
     DAGClient dagClient = client.submitDAG(dag);
         
     assertTrue(dagClient.getExecutionContext().contains(client.mockAppId.toString()));
@@ -360,7 +363,7 @@
 
     if (isSession) {
       verify(client.mockYarnClient, times(1)).submitApplication(captor.capture());
-      verify(client.sessionAmProxy, times(1)).submitDAG((RpcController)any(), (SubmitDAGRequestProto) any());
+      verify(client.sessionAmProxy, times(1)).submitDAG(any(), any());
     } else {
       verify(client.mockYarnClient, times(1)).submitApplication(captor.capture());
       ApplicationSubmissionContext context = captor.getValue();
@@ -399,7 +402,7 @@
       assertEquals(dagClient.getSessionIdentifierString(), client.mockAppId.toString());
       // additional resource is sent
       ArgumentCaptor<SubmitDAGRequestProto> captor1 = ArgumentCaptor.forClass(SubmitDAGRequestProto.class);
-      verify(client.sessionAmProxy, times(2)).submitDAG((RpcController)any(), captor1.capture());
+      verify(client.sessionAmProxy, times(2)).submitDAG(any(), captor1.capture());
       SubmitDAGRequestProto proto = captor1.getValue();
       Assert.assertEquals(1, proto.getAdditionalAmResources().getLocalResourcesCount());
       Assert.assertEquals(lrName2, proto.getAdditionalAmResources().getLocalResources(0).getName());
@@ -426,8 +429,8 @@
     if(shouldStop) {
       client.stop();
       if (isSession) {
-        verify(client.sessionAmProxy, times(1)).shutdownSession((RpcController) any(),
-                (ShutdownSessionRequestProto) any());
+        verify(client.sessionAmProxy, times(1)).shutdownSession(any(),
+                any());
       }
       verify(client.mockYarnClient, times(1)).stop();
     }
@@ -443,14 +446,14 @@
         .thenReturn(YarnApplicationState.RUNNING);
     
     when(
-        client.sessionAmProxy.getAMStatus((RpcController) any(), (GetAMStatusRequestProto) any()))
+        client.sessionAmProxy.getAMStatus(any(), any()))
         .thenReturn(GetAMStatusResponseProto.newBuilder().setStatus(TezAppMasterStatusProto.READY).build());
 
     PreWarmVertex vertex = PreWarmVertex.create("PreWarm", 1, Resource.newInstance(1, 1));
     client.preWarm(vertex);
     
     ArgumentCaptor<SubmitDAGRequestProto> captor1 = ArgumentCaptor.forClass(SubmitDAGRequestProto.class);
-    verify(client.sessionAmProxy, times(1)).submitDAG((RpcController)any(), captor1.capture());
+    verify(client.sessionAmProxy, times(1)).submitDAG(any(), captor1.capture());
     SubmitDAGRequestProto proto = captor1.getValue();
     assertTrue(proto.getDAGPlan().getName().startsWith(TezConstants.TEZ_PREWARM_DAG_NAME_PREFIX));
 
@@ -467,7 +470,7 @@
 
     when(client.mockYarnClient.getApplicationReport(client.mockAppId).getYarnApplicationState())
         .thenReturn(YarnApplicationState.RUNNING);
-    when(client.sessionAmProxy.getAMStatus((RpcController) any(), (GetAMStatusRequestProto) any()))
+    when(client.sessionAmProxy.getAMStatus(any(), any()))
         .thenReturn(GetAMStatusResponseProto.newBuilder().setStatus(TezAppMasterStatusProto.READY).build());
 
     PreWarmVertex vertex = PreWarmVertex.create("PreWarm", 1, Resource.newInstance(1, 1));
@@ -480,7 +483,7 @@
   private void setClientToReportStoppedDags(TezClientForTest client) throws Exception {
     when(client.mockYarnClient.getApplicationReport(client.mockAppId).getYarnApplicationState())
       .thenReturn(YarnApplicationState.FINISHED);
-    when(client.sessionAmProxy.getDAGStatus(isNull(RpcController.class), any(GetDAGStatusRequestProto.class)))
+    when(client.sessionAmProxy.getDAGStatus(isNull(), any()))
       .thenReturn(GetDAGStatusResponseProto.newBuilder().setDagStatus(DAGStatusProto.newBuilder()
           .addDiagnostics("Diagnostics_0").setState(DAGStatusStateProto.DAG_SUCCEEDED)
           .setDAGProgress(ProgressProto.newBuilder()
@@ -502,8 +505,8 @@
             spyClient.mockAppId).getYarnApplicationState())
         .thenReturn(YarnApplicationState.RUNNING);
     when(
-        spyClient.sessionAmProxy.getAMStatus((RpcController) any(),
-            (GetAMStatusRequestProto) any()))
+        spyClient.sessionAmProxy.getAMStatus(any(),
+                any()))
         .thenReturn(
             GetAMStatusResponseProto.newBuilder().setStatus(
                 TezAppMasterStatusProto.INITIALIZING).build());
@@ -518,15 +521,15 @@
       endTime = Time.monotonicNow();
       assertTrue("Time taken is not as expected",
           (endTime - startTime) > timeout);
-      verify(spyClient, times(0)).submitDAG(any(DAG.class));
+      verify(spyClient, times(0)).submitDAG(any());
       Assert.assertTrue("Unexpected Exception message",
           te.getMessage().contains("Tez AM not ready"));
 
     }
 
     when(
-        spyClient.sessionAmProxy.getAMStatus((RpcController) any(),
-            (GetAMStatusRequestProto) any()))
+        spyClient.sessionAmProxy.getAMStatus(any(),
+                any()))
         .thenReturn(
             GetAMStatusResponseProto.newBuilder().setStatus(
                 TezAppMasterStatusProto.READY).build());
@@ -536,7 +539,7 @@
       endTime = Time.monotonicNow();
       assertTrue("Time taken is not as expected",
           (endTime - startTime) <= timeout);
-      verify(spyClient, times(1)).submitDAG(any(DAG.class));
+      verify(spyClient, times(1)).submitDAG(any());
     } catch (TezException te) {
       fail("PreWarm should have succeeded!");
     }
@@ -571,7 +574,7 @@
     endTime = Time.monotonicNow();
     assertTrue("Time taken is not as expected",
         (endTime - startTime) <= timeout);
-    verify(spyClient, times(2)).submitDAG(any(DAG.class));
+    verify(spyClient, times(2)).submitDAG(any());
     setClientToReportStoppedDags(client);
     spyClient.stop();
     client.stop();
@@ -926,8 +929,7 @@
       Thread.sleep(1000);
     }
     client.stop();
-    verify(client.sessionAmProxy, atLeast(3)).getAMStatus(any(RpcController.class),
-        any(GetAMStatusRequestProto.class));
+    verify(client.sessionAmProxy, atLeast(3)).getAMStatus(any(), any());
 
     conf.setInt(TezConfiguration.TEZ_AM_CLIENT_HEARTBEAT_TIMEOUT_SECS, -1);
     final TezClientForTest client2 = configureAndCreateTezClient(conf);
@@ -940,10 +942,7 @@
       Thread.sleep(1000);
     }
     client2.stop();
-    verify(client2.sessionAmProxy, times(0)).getAMStatus(any(RpcController.class),
-        any(GetAMStatusRequestProto.class));
-
-
+    verify(client2.sessionAmProxy, times(0)).getAMStatus(any(), any());
   }
 
   @Test(timeout = 20000)
@@ -987,8 +986,7 @@
     final TezClientForTest client = configureAndCreateTezClient(conf);
     client.start();
 
-    when(client.sessionAmProxy.getAMStatus(any(RpcController.class),
-      any(GetAMStatusRequestProto.class))).thenThrow(new ServiceException("error"));
+    when(client.sessionAmProxy.getAMStatus(any(), any())).thenThrow(new ServiceException("error"));
     client.callRealGetSessionAMProxy = true;
     when(client.mockYarnClient.getApplicationReport(client.mockAppId).getYarnApplicationState())
       .thenReturn(YarnApplicationState.FAILED);
diff --git a/tez-api/src/test/java/org/apache/tez/common/security/TestTokenCache.java b/tez-api/src/test/java/org/apache/tez/common/security/TestTokenCache.java
index fcb1e98..4c14417 100644
--- a/tez-api/src/test/java/org/apache/tez/common/security/TestTokenCache.java
+++ b/tez-api/src/test/java/org/apache/tez/common/security/TestTokenCache.java
@@ -18,7 +18,7 @@
 
 package org.apache.tez.common.security;
 
-import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -153,7 +153,7 @@
       throws IOException {
     MockFileSystem mockFs = new MockFileSystem();
     when(mockFs.getCanonicalServiceName()).thenReturn(service);
-    when(mockFs.getDelegationToken(any(String.class))).thenAnswer(
+    when(mockFs.getDelegationToken(any())).thenAnswer(
         new Answer<Token<?>>() {
           int unique = 0;
           @Override
diff --git a/tez-api/src/test/java/org/apache/tez/dag/api/TestEntityDescriptor.java b/tez-api/src/test/java/org/apache/tez/dag/api/TestEntityDescriptor.java
index 606bf42..82c22ad 100644
--- a/tez-api/src/test/java/org/apache/tez/dag/api/TestEntityDescriptor.java
+++ b/tez-api/src/test/java/org/apache/tez/dag/api/TestEntityDescriptor.java
@@ -23,7 +23,6 @@
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
-import java.nio.ByteBuffer;
 
 import org.apache.commons.lang.RandomStringUtils;
 import org.apache.hadoop.conf.Configuration;
@@ -31,11 +30,11 @@
 import org.apache.tez.common.TezUtils;
 import org.junit.Assert;
 import org.junit.Test;
-import org.mockito.Mockito;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
 
 public class TestEntityDescriptor {
 
@@ -57,7 +56,7 @@
     ByteArrayOutputStream bos = new ByteArrayOutputStream(out.getData().length);
     bos.write(out.getData());
 
-    Mockito.verify(entityDescriptor).writeSingular(eq(out), any(ByteBuffer.class));
+    verify(entityDescriptor).writeSingular(eq(out), any());
     deserialized.readFields(new DataInputStream(new ByteArrayInputStream(bos.toByteArray())));
     verifyResults(entityDescriptor, deserialized, payload, confVal);
   }
@@ -69,12 +68,12 @@
     entityDescriptor.write(out);
     out.close();
 
-    Mockito.verify(entityDescriptor).writeSegmented(eq(out), any(ByteBuffer.class));
+    verify(entityDescriptor).writeSegmented(eq(out), any());
     deserialized.readFields(new DataInputStream(new ByteArrayInputStream(bos.toByteArray())));
     verifyResults(entityDescriptor, deserialized, payload, confVal);
   }
 
-  @Test (timeout=1000)
+  @Test (timeout=3000)
   public void testEntityDescriptorHadoopSerialization() throws IOException {
      /* This tests the alternate serialization code path
      * if the DataOutput is not DataOutputBuffer
diff --git a/tez-api/src/test/java/org/apache/tez/dag/api/client/rpc/TestDAGClient.java b/tez-api/src/test/java/org/apache/tez/dag/api/client/rpc/TestDAGClient.java
index f0cc20b..0ea5d1a 100644
--- a/tez-api/src/test/java/org/apache/tez/dag/api/client/rpc/TestDAGClient.java
+++ b/tez-api/src/test/java/org/apache/tez/dag/api/client/rpc/TestDAGClient.java
@@ -20,8 +20,10 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.argThat;
 import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.isNull;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -164,30 +166,22 @@
                     .setVertexCounters(vertexCountersProto)
                     .build();
   }
-  
-  private static class DAGCounterRequestMatcher extends ArgumentMatcher<GetDAGStatusRequestProto>{
+
+  private static class DAGCounterRequestMatcher implements ArgumentMatcher<GetDAGStatusRequestProto>{
 
     @Override
-    public boolean matches(Object argument) {
-      if (argument instanceof GetDAGStatusRequestProto){
-        GetDAGStatusRequestProto requestProto = (GetDAGStatusRequestProto)argument;
-        return requestProto.getStatusOptionsCount() != 0
-            && requestProto.getStatusOptionsList().get(0) == StatusGetOptsProto.GET_COUNTERS;
-      }
-      return false;
+    public boolean matches(GetDAGStatusRequestProto requestProto) {
+      return requestProto != null && requestProto.getStatusOptionsCount() != 0
+              && requestProto.getStatusOptionsList().get(0) == StatusGetOptsProto.GET_COUNTERS;
     }
   }
-  
-  private static class VertexCounterRequestMatcher extends ArgumentMatcher<GetVertexStatusRequestProto>{
+
+  private static class VertexCounterRequestMatcher implements ArgumentMatcher<GetVertexStatusRequestProto>{
 
     @Override
-    public boolean matches(Object argument) {
-      if (argument instanceof GetVertexStatusRequestProto){
-        GetVertexStatusRequestProto requestProto = (GetVertexStatusRequestProto)argument;
-        return requestProto.getStatusOptionsCount() != 0
-            && requestProto.getStatusOptionsList().get(0) == StatusGetOptsProto.GET_COUNTERS;
-      }
-      return false;
+    public boolean matches(GetVertexStatusRequestProto requestProto) {
+      return requestProto != null && requestProto.getStatusOptionsCount() != 0
+          && requestProto.getStatusOptionsList().get(0) == StatusGetOptsProto.GET_COUNTERS;
     }
   }
   
@@ -202,14 +196,14 @@
     dagIdStr = "dag_9999_0001_1";
     mockProxy = mock(DAGClientAMProtocolBlockingPB.class);
     // return the response with Counters is the request match the CounterMatcher
-    when(mockProxy.getDAGStatus(isNull(RpcController.class), any(GetDAGStatusRequestProto.class)))
+    when(mockProxy.getDAGStatus(isNull(), any()))
       .thenReturn(GetDAGStatusResponseProto.newBuilder().setDagStatus(dagStatusProtoWithoutCounters).build());
-    when(mockProxy.getDAGStatus(isNull(RpcController.class), argThat(new DAGCounterRequestMatcher())))
+    when(mockProxy.getDAGStatus(isNull(), argThat(new DAGCounterRequestMatcher())))
       .thenReturn(GetDAGStatusResponseProto.newBuilder().setDagStatus(dagStatusProtoWithCounters).build());
     
-    when(mockProxy.getVertexStatus(isNull(RpcController.class), any(GetVertexStatusRequestProto.class)))
+    when(mockProxy.getVertexStatus(isNull(), any()))
       .thenReturn(GetVertexStatusResponseProto.newBuilder().setVertexStatus(vertexStatusProtoWithoutCounters).build());
-    when(mockProxy.getVertexStatus(isNull(RpcController.class), argThat(new VertexCounterRequestMatcher())))
+    when(mockProxy.getVertexStatus(isNull(), argThat(new VertexCounterRequestMatcher())))
       .thenReturn(GetVertexStatusResponseProto.newBuilder().setVertexStatus(vertexStatusProtoWithCounters).build());
 
     TezConfiguration tezConf = new TezConfiguration();
@@ -270,7 +264,7 @@
   @Test(timeout = 5000)
   public void testWaitForCompletion() throws Exception{
     // first time return DAG_RUNNING, second time return DAG_SUCCEEDED
-    when(mockProxy.getDAGStatus(isNull(RpcController.class), any(GetDAGStatusRequestProto.class)))
+    when(mockProxy.getDAGStatus(isNull(), any()))
       .thenReturn(GetDAGStatusResponseProto.newBuilder().setDagStatus(dagStatusProtoWithoutCounters)
           .build())
       .thenReturn(GetDAGStatusResponseProto.newBuilder().setDagStatus
@@ -291,7 +285,7 @@
   public void testWaitForCompletionWithStatusUpdates() throws Exception{
 
     // first time and second time return DAG_RUNNING, third time return DAG_SUCCEEDED
-    when(mockProxy.getDAGStatus(isNull(RpcController.class), any(GetDAGStatusRequestProto.class)))
+    when(mockProxy.getDAGStatus(isNull(), any()))
         .thenReturn(GetDAGStatusResponseProto.newBuilder().setDagStatus(
             DAGStatusProto.newBuilder(dagStatusProtoWithCounters)
                 .setState(DAGStatusStateProto.DAG_RUNNING).build()).build())
@@ -317,7 +311,7 @@
     verify(mockProxy, times(4))
         .getDAGStatus(rpcControllerArgumentCaptor.capture(), argumentCaptor.capture());
 
-    when(mockProxy.getDAGStatus(isNull(RpcController.class), any(GetDAGStatusRequestProto.class)))
+    when(mockProxy.getDAGStatus(isNull(), any()))
         .thenReturn(GetDAGStatusResponseProto.newBuilder().setDagStatus(
             DAGStatusProto.newBuilder(dagStatusProtoWithCounters)
                 .setState(DAGStatusStateProto.DAG_RUNNING).build()).build())
@@ -555,7 +549,7 @@
         return GetDAGStatusResponseProto.newBuilder().setDagStatus(constructDagStatusProto(
             stateProto)).build();
       }
-    }).when(mock).getDAGStatus(isNull(RpcController.class), any(GetDAGStatusRequestProto.class));
+    }).when(mock).getDAGStatus(isNull(), any());
     return mock;
   }
 
diff --git a/tez-common/pom.xml b/tez-common/pom.xml
index 0fd4255..9ccf02a 100644
--- a/tez-common/pom.xml
+++ b/tez-common/pom.xml
@@ -63,7 +63,7 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/tez-dag/pom.xml b/tez-dag/pom.xml
index 723082c..356ed2c 100644
--- a/tez-dag/pom.xml
+++ b/tez-dag/pom.xml
@@ -88,6 +88,10 @@
       <artifactId>hadoop-yarn-server-web-proxy</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.roaringbitmap</groupId>
+      <artifactId>RoaringBitmap</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>
@@ -123,7 +127,7 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/api/client/TestDAGClientHandler.java b/tez-dag/src/test/java/org/apache/tez/dag/api/client/TestDAGClientHandler.java
index bf07838..c7daebf 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/api/client/TestDAGClientHandler.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/api/client/TestDAGClientHandler.java
@@ -51,11 +51,11 @@
     DAG mockDAG = mock(DAG.class);
     when(mockDAG.getID()).thenReturn(mockTezDAGId);
     DAGStatusBuilder mockDagStatusBuilder = mock(DAGStatusBuilder.class);
-    when(mockDAG.getDAGStatus(anySetOf(StatusGetOpts.class))).thenReturn(
+    when(mockDAG.getDAGStatus(anySet())).thenReturn(
         mockDagStatusBuilder);
     VertexStatusBuilder mockVertexStatusBuilder =
         mock(VertexStatusBuilder.class);
-    when(mockDAG.getVertexStatus(anyString(), anySetOf(StatusGetOpts.class)))
+    when(mockDAG.getVertexStatus(anyString(), anySet()))
         .thenReturn(mockVertexStatusBuilder);
 
     DAGAppMaster mockDagAM = mock(DAGAppMaster.class);
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/api/client/rpc/TestDAGClientAMProtocolBlockingPBServerImpl.java b/tez-dag/src/test/java/org/apache/tez/dag/api/client/rpc/TestDAGClientAMProtocolBlockingPBServerImpl.java
index 040ca2f..1aea8f7 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/api/client/rpc/TestDAGClientAMProtocolBlockingPBServerImpl.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/api/client/rpc/TestDAGClientAMProtocolBlockingPBServerImpl.java
@@ -28,8 +28,11 @@
 import static junit.framework.TestCase.assertEquals;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import org.apache.hadoop.fs.CommonConfigurationKeys;
 import org.apache.hadoop.fs.FileSystem;
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/TestRecoveryParser.java b/tez-dag/src/test/java/org/apache/tez/dag/app/TestRecoveryParser.java
index 1c09d5d..57148ee 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/TestRecoveryParser.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/TestRecoveryParser.java
@@ -111,7 +111,7 @@
     mockAppMaster.dagIDs = new HashSet<String>();
     when(mockAppMaster.getConfig()).thenReturn(new Configuration());
     mockDAGImpl = mock(DAGImpl.class);
-    when(mockAppMaster.createDAG(any(DAGPlan.class), any(TezDAGID.class))).thenReturn(mockDAGImpl);
+    when(mockAppMaster.createDAG(any(), any())).thenReturn(mockDAGImpl);
     parser = new RecoveryParser(mockAppMaster, localFS, recoveryPath, 3);
   }
 
@@ -198,7 +198,7 @@
     assertTrue(dagData.reason.contains("DAG Commit was in progress, not recoverable,"));
     // DAGSubmittedEvent is handled but DAGInitializedEvent and DAGStartedEvent in the next attempt are both skipped
     // due to the dag is not recoerable.
-    verify(mockAppMaster).createDAG(any(DAGPlan.class),any(TezDAGID.class));
+    verify(mockAppMaster).createDAG(any(), any());
     assertNull(dagData.getDAGInitializedEvent());
     assertNull(dagData.getDAGStartedEvent());
   }
@@ -245,7 +245,7 @@
     assertEquals(DAGState.FAILED, dagData.dagState);
     assertEquals(true, dagData.isCompleted);
     // DAGSubmittedEvent, DAGInitializedEvent and DAGFinishedEvent is handled
-    verify(mockAppMaster).createDAG(any(DAGPlan.class),any(TezDAGID.class));
+    verify(mockAppMaster).createDAG(any(), any());
     // DAGInitializedEvent may not been handled before DAGFinishedEvent,
     // because DAGFinishedEvent's writeToRecoveryImmediately is true
     assertNotNull(dagData.getDAGFinishedEvent());
@@ -294,7 +294,7 @@
     assertEquals(null, dagData.reason);
     assertEquals(false, dagData.nonRecoverable);
     // verify DAGSubmitedEvent & DAGInititlizedEvent is handled.
-    verify(mockAppMaster).createDAG(any(DAGPlan.class),any(TezDAGID.class));
+    verify(mockAppMaster).createDAG(any(), any());
     assertNotNull(dagData.getDAGInitializedEvent());
   }
 
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/TestTaskCommunicatorManager.java b/tez-dag/src/test/java/org/apache/tez/dag/app/TestTaskCommunicatorManager.java
index c7f97d3..3935789 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/TestTaskCommunicatorManager.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/TestTaskCommunicatorManager.java
@@ -18,10 +18,10 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.spy;
@@ -187,7 +187,7 @@
 
     AppContext appContext = mock(AppContext.class, RETURNS_DEEP_STUBS);
     NodeId nodeId = NodeId.newInstance("host1", 3131);
-    when(appContext.getAllContainers().get(any(ContainerId.class)).getContainer().getNodeId())
+    when(appContext.getAllContainers().get(any()).getContainer().getNodeId())
         .thenReturn(nodeId);
     TaskHeartbeatHandler thh = mock(TaskHeartbeatHandler.class);
     ContainerHeartbeatHandler chh = mock(ContainerHeartbeatHandler.class);
@@ -348,7 +348,7 @@
       assertTrue(event.getDiagnosticInfo().contains(expectedId));
 
 
-      when(appContext.getAllContainers().get(any(ContainerId.class)).getContainer().getNodeId())
+      when(appContext.getAllContainers().get(any()).getContainer().getNodeId())
           .thenReturn(mock(NodeId.class));
 
       taskCommunicatorManager.registerRunningContainer(mock(ContainerId.class), 0);
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/TestTaskCommunicatorManager1.java b/tez-dag/src/test/java/org/apache/tez/dag/app/TestTaskCommunicatorManager1.java
index 0f8afaa..d7e62ee 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/TestTaskCommunicatorManager1.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/TestTaskCommunicatorManager1.java
@@ -19,7 +19,7 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
@@ -144,7 +144,7 @@
     AMContainer amContainer = mock(AMContainer.class);
     Container container = mock(Container.class);
     doReturn(nodeId).when(container).getNodeId();
-    doReturn(amContainer).when(amContainerMap).get(any(ContainerId.class));
+    doReturn(amContainer).when(amContainerMap).get(any());
     doReturn(container).when(amContainer).getContainer();
 
     Configuration conf = new TezConfiguration();
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/TestTaskCommunicatorManager2.java b/tez-dag/src/test/java/org/apache/tez/dag/app/TestTaskCommunicatorManager2.java
index bb7e94b..ac60001 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/TestTaskCommunicatorManager2.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/TestTaskCommunicatorManager2.java
@@ -16,10 +16,10 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.times;
@@ -256,7 +256,7 @@
       doReturn(dag).when(appContext).getCurrentDAG();
       doReturn(vertex).when(dag).getVertex(eq(vertexId));
       doReturn(new TaskAttemptEventInfo(0, new LinkedList<TezEvent>(), 0)).when(vertex)
-          .getTaskAttemptTezEvents(any(TezTaskAttemptID.class), anyInt(), anyInt(), anyInt());
+          .getTaskAttemptTezEvents(any(), anyInt(), anyInt(), anyInt());
       doReturn(appAttemptId).when(appContext).getApplicationAttemptId();
       doReturn(credentials).when(appContext).getAppCredentials();
       doReturn(appAcls).when(appContext).getApplicationACLs();
@@ -267,7 +267,7 @@
       AMContainer amContainer = mock(AMContainer.class);
       Container container = mock(Container.class);
       doReturn(nodeId).when(container).getNodeId();
-      doReturn(amContainer).when(amContainerMap).get(any(ContainerId.class));
+      doReturn(amContainer).when(amContainerMap).get(any());
       doReturn(container).when(amContainer).getContainer();
 
       userPayload = TezUtils.createUserPayloadFromConf(conf);
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/TestRootInputInitializerManager.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/TestRootInputInitializerManager.java
index ffa4309..2c5aa33 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/TestRootInputInitializerManager.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/TestRootInputInitializerManager.java
@@ -15,8 +15,8 @@
 package org.apache.tez.dag.app.dag;
 
 import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
@@ -101,7 +101,7 @@
     eventList.add(te1);
     initializerWrapper.handleInputInitializerEvents(eventList);
 
-    verify(initializer, never()).handleInputInitializerEvent(any(List.class));
+    verify(initializer, never()).handleInputInitializerEvent(any());
     eventList.clear();
 
     // First attempt, Task success notification
@@ -123,7 +123,7 @@
     eventList.add(te2);
     initializerWrapper.handleInputInitializerEvents(eventList);
 
-    verify(initializer, never()).handleInputInitializerEvent(any(List.class));
+    verify(initializer, never()).handleInputInitializerEvent(any());
     eventList.clear();
     reset(initializer);
 
@@ -176,7 +176,7 @@
     eventList.add(te1);
     initializerWrapper.handleInputInitializerEvents(eventList);
 
-    verify(initializer, never()).handleInputInitializerEvent(any(List.class));
+    verify(initializer, never()).handleInputInitializerEvent(any());
     eventList.clear();
 
     // First attempt, Task success notification
@@ -192,7 +192,7 @@
     TezTaskAttemptID srcTaskAttemptId12 = TezTaskAttemptID.getInstance(srcTaskId1, 2);
     // 2nd attempt succeeded
     initializerWrapper.onTaskSucceeded(srcVertexName, srcTaskId1, srcTaskAttemptId12.getId());
-    verify(initializer, never()).handleInputInitializerEvent(any(List.class));
+    verify(initializer, never()).handleInputInitializerEvent(any());
 
     // 2nd attempt send event
     EventMetaData sourceInfo12 =
@@ -203,7 +203,7 @@
     eventList.add(te2);
     initializerWrapper.handleInputInitializerEvents(eventList);
 
-    verify(initializer, never()).handleInputInitializerEvent(any(List.class));
+    verify(initializer, never()).handleInputInitializerEvent(any());
   }
 
 
@@ -269,4 +269,4 @@
       }
     }
   }
-}
\ No newline at end of file
+}
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/TestStateChangeNotifier.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/TestStateChangeNotifier.java
index d20903d..b43782e 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/TestStateChangeNotifier.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/TestStateChangeNotifier.java
@@ -20,7 +20,7 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
@@ -139,14 +139,14 @@
     verify(mockListener13, times(1)).onStateUpdated(argumentCaptor.capture());
     assertEquals(VertexState.RUNNING,
         argumentCaptor.getValue().getVertexState());
-    verify(mockListener14, never()).onStateUpdated(any(VertexStateUpdate.class));
+    verify(mockListener14, never()).onStateUpdated(any());
 
     // Vertex has not notified of state
     tracker.reset();
     VertexStateUpdateListener mockListener2 = mock(VertexStateUpdateListener.class);
     tracker.registerForVertexUpdates(v2.getName(), null, mockListener2);
     Assert.assertEquals(0, tracker.totalCount.get()); // there should no be any event sent out
-    verify(mockListener2, never()).onStateUpdated(any(VertexStateUpdate.class));
+    verify(mockListener2, never()).onStateUpdated(any());
 
     // Vertex has notified about parallelism update only
     tracker.stateChanged(v3.getVertexId(), new VertexStateUpdateParallelismUpdated(v3.getName(), 23, -1));
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGImpl.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGImpl.java
index f2b16a9..9a3292e 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGImpl.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGImpl.java
@@ -18,11 +18,13 @@
 
 package org.apache.tez.dag.app.dag.impl;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
 import java.io.IOException;
@@ -149,7 +151,6 @@
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 
@@ -856,7 +857,7 @@
     when(appContext.getHadoopShim()).thenReturn(defaultShim);
     when(appContext.getApplicationID()).thenReturn(appAttemptId.getApplicationId());
     
-    Mockito.doAnswer(new Answer() {
+    doAnswer(new Answer() {
       public ListenableFuture<Void> answer(InvocationOnMock invocation) {
           Object[] args = invocation.getArguments();
           CallableEvent e = (CallableEvent) args[0];
@@ -1942,17 +1943,17 @@
     conf.setBoolean(
         TezConfiguration.TEZ_AM_COMMIT_ALL_OUTPUTS_ON_DAG_SUCCESS,
         false);
-    dag = Mockito.spy(new DAGImpl(dagId, conf, dagPlan,
+    dag = spy(new DAGImpl(dagId, conf, dagPlan,
         dispatcher.getEventHandler(), taskCommunicatorManagerInterface,
         fsTokens, clock, "user", thh, appContext));
     StateMachineTez<DAGState, DAGEventType, DAGEvent, DAGImpl> spyStateMachine =
-        Mockito.spy(new StateMachineTez<DAGState, DAGEventType, DAGEvent, DAGImpl>(
+        spy(new StateMachineTez<DAGState, DAGEventType, DAGEvent, DAGImpl>(
             dag.stateMachineFactory.make(dag), dag));
     when(dag.getStateMachine()).thenReturn(spyStateMachine);
     dag.entityUpdateTracker = new StateChangeNotifierForTest(dag);
     doReturn(dag).when(appContext).getCurrentDAG();
-    DAGImpl.OutputKey outputKey = Mockito.mock(DAGImpl.OutputKey.class);
-    ListenableFuture future = Mockito.mock(ListenableFuture.class);
+    DAGImpl.OutputKey outputKey = mock(DAGImpl.OutputKey.class);
+    ListenableFuture future = mock(ListenableFuture.class);
     dag.commitFutures.put(outputKey, future);
     initDAG(dag);
     startDAG(dag);
@@ -1975,7 +1976,7 @@
     DAGEventCommitCompleted dagEvent = new DAGEventCommitCompleted(
         dagId, outputKey, false , new RuntimeException("test"));
     doThrow(new RuntimeException("test")).when(
-        dag).logJobHistoryUnsuccesfulEvent(any(DAGState.class), any(TezCounters.class));
+        dag).logJobHistoryUnsuccesfulEvent(any(), any());
     dag.handle(dagEvent);
     dispatcher.await();
     Assert.assertTrue("DAG did not terminate!", dag.getInternalState() == DAGState.FAILED);
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGRecovery.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGRecovery.java
index acbef67..159dd9f 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGRecovery.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGRecovery.java
@@ -17,11 +17,6 @@
  */
 package org.apache.tez.dag.app.dag.impl;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
@@ -132,13 +127,17 @@
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import static org.junit.Assert.*;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
@@ -326,7 +325,7 @@
     when(appContext.getApplicationID()).thenReturn(appAttemptId.getApplicationId());
     when(appContext.getClock()).thenReturn(new SystemClock());
 
-    Mockito.doAnswer(new Answer() {
+    doAnswer(new Answer() {
       public ListenableFuture<Void> answer(InvocationOnMock invocation) {
         Object[] args = invocation.getArguments();
         CallableEvent e = (CallableEvent) args[0];
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGSchedulerNaturalOrderControlled.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGSchedulerNaturalOrderControlled.java
index 3b1db4c..f79f359 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGSchedulerNaturalOrderControlled.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestDAGSchedulerNaturalOrderControlled.java
@@ -19,7 +19,7 @@
 package org.apache.tez.dag.app.dag.impl;
 
 import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
@@ -65,35 +65,35 @@
     for (int i = 0; i < vertices[0].getTotalTasks(); i++) {
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[0].getVertexId(), i, 0));
     }
-    verify(eventHandler, times(vertices[0].getTotalTasks())).handle(any(Event.class));
+    verify(eventHandler, times(vertices[0].getTotalTasks())).handle(any());
     reset(eventHandler);
 
     // Schedule 3 tasks belonging to v2
     for (int i = 0; i < 3; i++) {
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[2].getVertexId(), i, 0));
     }
-    verify(eventHandler, times(3)).handle(any(Event.class));
+    verify(eventHandler, times(3)).handle(any());
     reset(eventHandler);
 
     // Schedule 3 tasks belonging to v3
     for (int i = 0; i < 3; i++) {
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[3].getVertexId(), i, 0));
     }
-    verify(eventHandler, times(3)).handle(any(Event.class));
+    verify(eventHandler, times(3)).handle(any());
     reset(eventHandler);
 
     // Schedule remaining tasks belonging to v2
     for (int i = 3; i < vertices[2].getTotalTasks(); i++) {
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[2].getVertexId(), i, 0));
     }
-    verify(eventHandler, times(vertices[2].getTotalTasks() - 3)).handle(any(Event.class));
+    verify(eventHandler, times(vertices[2].getTotalTasks() - 3)).handle(any());
     reset(eventHandler);
 
     // Schedule remaining tasks belonging to v3
     for (int i = 3; i < vertices[3].getTotalTasks(); i++) {
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[3].getVertexId(), i, 0));
     }
-    verify(eventHandler, times(vertices[3].getTotalTasks() - 3)).handle(any(Event.class));
+    verify(eventHandler, times(vertices[3].getTotalTasks() - 3)).handle(any());
     reset(eventHandler);
 
 
@@ -101,7 +101,7 @@
     for (int i = 0; i < vertices[4].getTotalTasks(); i++) {
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[4].getVertexId(), i, 0));
     }
-    verify(eventHandler, times(vertices[4].getTotalTasks())).handle(any(Event.class));
+    verify(eventHandler, times(vertices[4].getTotalTasks())).handle(any());
     reset(eventHandler);
   }
 
@@ -124,7 +124,7 @@
     for (int i = 0; i < vertices[0].getTotalTasks(); i++) {
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[0].getVertexId(), i, 0));
     }
-    verify(eventHandler, times(vertices[0].getTotalTasks())).handle(any(Event.class));
+    verify(eventHandler, times(vertices[0].getTotalTasks())).handle(any());
     reset(eventHandler);
 
     // v2 behaving as if configured with slow-start.
@@ -132,14 +132,14 @@
     for (int i = 0; i < vertices[3].getTotalTasks(); i++) {
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[3].getVertexId(), i, 0));
     }
-    verify(eventHandler, times(vertices[3].getTotalTasks())).handle(any(Event.class));
+    verify(eventHandler, times(vertices[3].getTotalTasks())).handle(any());
     reset(eventHandler);
 
     // Scheduling all tasks belonging to v4. None should get scheduled.
     for (int i = 0; i < vertices[4].getTotalTasks(); i++) {
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[4].getVertexId(), i, 0));
     }
-    verify(eventHandler, never()).handle(any(Event.class));
+    verify(eventHandler, never()).handle(any());
     reset(eventHandler);
 
     // v2 now starts scheduling ...
@@ -147,7 +147,7 @@
     for (int i = 0; i < 3; i++) {
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[2].getVertexId(), i, 0));
     }
-    verify(eventHandler, times(3)).handle(any(Event.class));
+    verify(eventHandler, times(3)).handle(any());
     reset(eventHandler);
 
     // Schedule remaining tasks belonging to v2
@@ -192,7 +192,7 @@
     for (int i = 0; i < vertices[0].getTotalTasks(); i++) {
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[0].getVertexId(), i, 0));
     }
-    verify(eventHandler, times(vertices[0].getTotalTasks())).handle(any(Event.class));
+    verify(eventHandler, times(vertices[0].getTotalTasks())).handle(any());
     reset(eventHandler);
 
     assertEquals(10, vertices[2].getTotalTasks());
@@ -202,14 +202,14 @@
     for (int i = 0; i < vertices[3].getTotalTasks(); i++) {
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[3].getVertexId(), i, 0));
     }
-    verify(eventHandler, times(vertices[3].getTotalTasks())).handle(any(Event.class));
+    verify(eventHandler, times(vertices[3].getTotalTasks())).handle(any());
     reset(eventHandler);
 
     // Schedule all tasks belonging to v4
     for (int i = 0; i < vertices[4].getTotalTasks(); i++) {
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[4].getVertexId(), i, 0));
     }
-    verify(eventHandler, never()).handle(any(Event.class));
+    verify(eventHandler, never()).handle(any());
     reset(eventHandler);
 
     // Reset the parallelism for v2.
@@ -221,7 +221,7 @@
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[2].getVertexId(), i, 0));
     }
     verify(eventHandler, times(vertices[2].getTotalTasks() + vertices[4].getTotalTasks()))
-        .handle(any(Event.class));
+        .handle(any());
     reset(eventHandler);
   }
 
@@ -243,7 +243,7 @@
     for (int i = 0; i < vertices[0].getTotalTasks() - 1; i++) {
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[0].getVertexId(), i, 0));
     }
-    verify(eventHandler, times(vertices[0].getTotalTasks() - 1)).handle(any(Event.class));
+    verify(eventHandler, times(vertices[0].getTotalTasks() - 1)).handle(any());
     reset(eventHandler);
 
 
@@ -252,7 +252,7 @@
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[2].getVertexId(), i, 0));
     }
     // Nothing should be scheduled
-    verify(eventHandler, never()).handle(any(Event.class));
+    verify(eventHandler, never()).handle(any());
     reset(eventHandler);
 
     // Schedule an extra attempt for all but 1 task belonging to v0
@@ -260,14 +260,14 @@
       dagScheduler.scheduleTaskEx(createScheduleRequest(vertices[0].getVertexId(), i, 1));
     }
     // Only v0 requests should have gone out
-    verify(eventHandler, times(vertices[0].getTotalTasks() - 1)).handle(any(Event.class));
+    verify(eventHandler, times(vertices[0].getTotalTasks() - 1)).handle(any());
     reset(eventHandler);
 
     // Schedule last task of v0, with attempt 1
     dagScheduler.scheduleTaskEx(
         createScheduleRequest(vertices[0].getVertexId(), vertices[0].getTotalTasks() - 1, 1));
     // One v0 request and all of v2 should have gone out
-    verify(eventHandler, times(1 + vertices[2].getTotalTasks())).handle(any(Event.class));
+    verify(eventHandler, times(1 + vertices[2].getTotalTasks())).handle(any());
   }
 
 
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestEdge.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestEdge.java
index c9c99f5..c6578ff 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestEdge.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestEdge.java
@@ -21,7 +21,7 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.reset;
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestImmediateStartVertexManager.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestImmediateStartVertexManager.java
index a17c7c5..67a9da5 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestImmediateStartVertexManager.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestImmediateStartVertexManager.java
@@ -37,7 +37,7 @@
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 
-import static org.mockito.Matchers.anyList;
+import static org.mockito.Mockito.anyList;
 import static org.mockito.Mockito.anySet;
 import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.doAnswer;
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestRootInputVertexManager.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestRootInputVertexManager.java
index 39a291e..144d28d 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestRootInputVertexManager.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestRootInputVertexManager.java
@@ -23,11 +23,11 @@
 import static org.apache.tez.dag.app.dag.impl.RootInputVertexManager.TEZ_ROOT_INPUT_VERTEX_MANAGER_MIN_SRC_FRACTION;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyListOf;
-import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyList;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -161,7 +161,7 @@
 
     VertexManagerPluginContext mockContext =
         mock(VertexManagerPluginContext.class);
-    when(mockContext.getVertexStatistics(any(String.class)))
+    when(mockContext.getVertexStatistics(any()))
         .thenReturn(mock(VertexStatistics.class));
     when(mockContext.getInputVertexEdgeProperties())
         .thenReturn(mockInputVertices);
@@ -176,7 +176,7 @@
 
     final List<Integer> scheduledTasks = Lists.newLinkedList();
     doAnswer(new ScheduledTasksAnswer(scheduledTasks)).when(
-        mockContext).scheduleTasks(anyListOf(VertexManagerPluginContext.ScheduleTaskRequest.class));
+        mockContext).scheduleTasks(anyList());
 
     // source vertices have 0 tasks. immediate start of all managed tasks
     when(mockContext.getVertexNumTasks(mockSrcVertexId1)).thenReturn(0);
@@ -508,7 +508,7 @@
 
     VertexManagerPluginContext mockContext =
         mock(VertexManagerPluginContext.class);
-    when(mockContext.getVertexStatistics(any(String.class)))
+    when(mockContext.getVertexStatistics(any()))
         .thenReturn(mock(VertexStatistics.class));
     when(mockContext.getInputVertexEdgeProperties())
         .thenReturn(mockInputVertices);
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestTaskAttempt.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestTaskAttempt.java
index dc59b46..d0088bf 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestTaskAttempt.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestTaskAttempt.java
@@ -22,7 +22,9 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.anyInt;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.atLeast;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
@@ -128,7 +130,6 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -181,11 +182,11 @@
     when(mockVertex.getServicePluginInfo()).thenReturn(servicePluginInfo);
     when(mockVertex.getVertexConfig()).thenReturn(new VertexImpl.VertexConfigImpl(conf));
     AppContext appContext = mock(AppContext.class);
-    when(appContext.getTaskScheduerIdentifier(Mockito.anyString())).thenReturn(0);
+    when(appContext.getTaskScheduerIdentifier(anyString())).thenReturn(0);
     when(mockVertex.getAppContext()).thenReturn(appContext);
     AMNodeTracker nodeTracker = mock(AMNodeTracker.class);
-    when(nodeTracker.getNumNodes(Mockito.anyInt())).thenReturn(10);
-    when(nodeTracker.getNumActiveNodes(Mockito.anyInt())).thenReturn(8);
+    when(nodeTracker.getNumNodes(anyInt())).thenReturn(10);
+    when(nodeTracker.getNumActiveNodes(anyInt())).thenReturn(8);
     when(appContext.getNodeTracker()).thenReturn(nodeTracker);
   }
 
@@ -1922,7 +1923,7 @@
 
     assertEquals(true, taImpl.inputFailedReported);
     int expectedEventsAfterFetchFailure = expectedEventsTillSucceeded + 2;
-    arg.getAllValues().clear();
+    arg = ArgumentCaptor.forClass(Event.class);
     verify(eventHandler, times(expectedEventsAfterFetchFailure)).handle(arg.capture());
     Event e = verifyEventType(
         arg.getAllValues().subList(expectedEventsTillSucceeded,
@@ -2195,10 +2196,9 @@
     when(destTaskAttemptId.getTaskID()).thenReturn(mock(TezTaskID.class));
     when(destTaskAttemptId.getVertexID()).thenReturn(mock(TezVertexID.class));
     when(appCtx.getCurrentDAG()).thenReturn(mock(DAG.class));
-    when(appCtx.getCurrentDAG().getVertex(Mockito.any(TezVertexID.class)))
+    when(appCtx.getCurrentDAG().getVertex(any(TezVertexID.class)))
         .thenReturn(mock(Vertex.class));
-    when(appCtx.getCurrentDAG().getVertex(Mockito.any(TezVertexID.class)).getRunningTasks())
-        .thenReturn(100);
+    when(mock(Vertex.class).getRunningTasks()).thenReturn(100);
 
     EventMetaData mockMeta = mock(EventMetaData.class);
     when(mockMeta.getTaskAttemptID()).thenReturn(destTaskAttemptId);
@@ -2228,12 +2228,13 @@
     InputReadErrorEvent inputReadErrorEvent2 =
         InputReadErrorEvent.create("", 1, 1, 1, false, false, "downstream_host_2");
 
-    TezTaskAttemptID destTaskAttemptId = mock(TezTaskAttemptID.class);
+    TezTaskAttemptID destTaskAttemptId = mock(TezTaskAttemptID.class, RETURNS_DEEP_STUBS);
     when(destTaskAttemptId.getTaskID()).thenReturn(mock(TezTaskID.class));
     when(destTaskAttemptId.getTaskID().getVertexID()).thenReturn(mock(TezVertexID.class));
     when(appCtx.getCurrentDAG()).thenReturn(mock(DAG.class));
-    when(appCtx.getCurrentDAG().getVertex(Mockito.any(TezVertexID.class))).thenReturn(mock(Vertex.class));
-    when(appCtx.getCurrentDAG().getVertex(Mockito.any(TezVertexID.class)).getRunningTasks()).thenReturn(100);
+    when(appCtx.getCurrentDAG().getVertex(any(TezVertexID.class)))
+        .thenReturn(mock(Vertex.class));
+    when(mock(Vertex.class).getRunningTasks()).thenReturn(100);
 
     EventMetaData mockMeta = mock(EventMetaData.class);
     when(mockMeta.getTaskAttemptID()).thenReturn(destTaskAttemptId);
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestTaskImpl.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestTaskImpl.java
index f4e40f7..3bf5997 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestTaskImpl.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestTaskImpl.java
@@ -769,7 +769,7 @@
 
     // The task should now have succeeded
     assertTaskSucceededState();
-    verify(mockTask.stateChangeNotifier).taskSucceeded(any(String.class), eq(taskId),
+    verify(mockTask.stateChangeNotifier).taskSucceeded(any(), eq(taskId),
         eq(mockTask.getLastAttempt().getTaskAttemptID().getId()));
 
     ArgumentCaptor<DAGHistoryEvent> argumentCaptor = ArgumentCaptor.forClass(DAGHistoryEvent.class);
@@ -818,7 +818,7 @@
 
     // The task should now have succeeded
     assertTaskSucceededState();
-    verify(mockTask.stateChangeNotifier).taskSucceeded(any(String.class), eq(taskId),
+    verify(mockTask.stateChangeNotifier).taskSucceeded(any(), eq(taskId),
         eq(mockTask.getLastAttempt().getTaskAttemptID().getId()));
 
     eventHandler.events.clear();
@@ -982,7 +982,7 @@
 
     // The task should now have succeeded and sent kill to other attempt
     assertTaskSucceededState();
-    verify(mockTask.stateChangeNotifier).taskSucceeded(any(String.class), eq(taskId),
+    verify(mockTask.stateChangeNotifier).taskSucceeded(any(), eq(taskId),
         eq(firstAttempt.getTaskAttemptID().getId()));
     @SuppressWarnings("rawtypes")
     Event event = eventHandler.events.get(eventHandler.events.size()-1);
@@ -1019,7 +1019,7 @@
 
     // The task should now have succeeded and sent kill to other attempt
     assertTaskSucceededState();
-    verify(mockTask.stateChangeNotifier).taskSucceeded(any(String.class), eq(taskId),
+    verify(mockTask.stateChangeNotifier).taskSucceeded(any(), eq(taskId),
         eq(firstAttempt.getTaskAttemptID().getId()));
     @SuppressWarnings("rawtypes")
     Event event = eventHandler.events.get(eventHandler.events.size()-1);
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
index c118110..10ecfe5 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
@@ -32,9 +32,16 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doCallRealMethod;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.when;
 
 import java.io.ByteArrayOutputStream;
 import java.io.DataInput;
@@ -85,6 +92,7 @@
 import org.apache.tez.runtime.library.common.shuffle.ShuffleUtils;
 import org.apache.tez.runtime.library.shuffle.impl.ShuffleUserPayloads;
 import org.apache.tez.test.GraceShuffleVertexManagerForTest;
+import org.mockito.Mockito;
 import org.roaringbitmap.RoaringBitmap;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -230,7 +238,6 @@
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.mockito.Mockito;
 import org.mockito.internal.util.collections.Sets;
 
 import com.google.common.base.Joiner;
@@ -2739,7 +2746,7 @@
     dagId = TezDAGID.getInstance(appAttemptId.getApplicationId(), 1);
     taskSpecificLaunchCmdOption = mock(TaskSpecificLaunchCmdOption.class);
     doReturn(false).when(taskSpecificLaunchCmdOption).addTaskSpecificLaunchCmdOption(
-        any(String.class),
+        any(),
         anyInt());
   }
 
@@ -2816,7 +2823,7 @@
     execService = mock(ListeningExecutorService.class);
     final ListenableFuture<Void> mockFuture = mock(ListenableFuture.class);
     
-    Mockito.doAnswer(new Answer() {
+    doAnswer(new Answer() {
       public ListenableFuture<Void> answer(InvocationOnMock invocation) {
           Object[] args = invocation.getArguments();
           CallableEvent e = (CallableEvent) args[0];
@@ -3133,7 +3140,7 @@
     Assert.assertEquals("vertex2", listener.events.get(0).getVertexName());
     Assert.assertEquals(org.apache.tez.dag.api.event.VertexState.CONFIGURED,
         listener.events.get(0).getVertexState());
-    updateTracker.unregisterForVertexUpdates("vertex2", listener);    
+    updateTracker.unregisterForVertexUpdates("vertex2", listener);
   }
 
   @Test (timeout=5000)
@@ -7512,8 +7519,7 @@
     checkSpannedVertices();
     runVertices();
     Mockito.verify(appContext.getAppMaster().getContainerLauncherManager(),
-        times(3)).vertexComplete(any(TezVertexID.class),
-        any(JobTokenSecretManager.class), any(Set.class));
+        times(3)).vertexComplete(any(), any(), any());
   }
 
   private void checkSpannedVertices() {
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexManager.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexManager.java
index f7a6037..058dc76 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexManager.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexManager.java
@@ -24,8 +24,9 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
@@ -70,7 +71,6 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 
@@ -92,7 +92,7 @@
     mockAppContext = mock(AppContext.class, RETURNS_DEEP_STUBS);
     execService = mock(ListeningExecutorService.class);
     final ListenableFuture<Void> mockFuture = mock(ListenableFuture.class);
-    Mockito.doAnswer(new Answer() {
+    doAnswer(new Answer() {
       public ListenableFuture<Void> answer(InvocationOnMock invocation) {
           Object[] args = invocation.getArguments();
           CallableEvent e = (CallableEvent) args[0];
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/launcher/TestContainerLauncherManager.java b/tez-dag/src/test/java/org/apache/tez/dag/app/launcher/TestContainerLauncherManager.java
index b3568eb..0bd41f4 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/launcher/TestContainerLauncherManager.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/launcher/TestContainerLauncherManager.java
@@ -19,7 +19,7 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
@@ -340,7 +340,7 @@
 
       // launch container
       doThrow(new RuntimeException("testexception")).when(containerLauncher)
-          .launchContainer(any(ContainerLaunchRequest.class));
+          .launchContainer(any());
       ContainerLaunchContext clc1 = mock(ContainerLaunchContext.class);
       Container container1 = mock(Container.class);
       ContainerLauncherLaunchRequestEvent launchRequestEvent =
@@ -365,7 +365,7 @@
       // stop container
 
       doThrow(new RuntimeException("teststopexception")).when(containerLauncher)
-          .stopContainer(any(ContainerStopRequest.class));
+          .stopContainer(any());
       ContainerId containerId2 = mock(ContainerId.class);
       NodeId nodeId2 = mock(NodeId.class);
       ContainerLauncherStopRequestEvent stopRequestEvent =
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestContainerReuse.java b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestContainerReuse.java
index ef61cad..fe5a888 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestContainerReuse.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestContainerReuse.java
@@ -21,10 +21,10 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
@@ -203,9 +203,9 @@
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
     verify(taskSchedulerManager).taskAllocated(
-      eq(0), eq(ta11), any(Object.class), eq(containerHost1));
+        eq(0), eq(ta11), any(), eq(containerHost1));
     verify(taskSchedulerManager).taskAllocated(
-      eq(0), eq(ta21), any(Object.class), eq(containerHost2));
+        eq(0), eq(ta21), any(), eq(containerHost2));
 
     // Adding the event later so that task1 assigned to containerHost1
     // is deterministic.
@@ -217,9 +217,9 @@
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta11, true, null, null);
     verify(taskSchedulerManager, times(1)).taskAllocated(
-      eq(0), eq(ta31), any(Object.class), eq(containerHost1));
+        eq(0), eq(ta31), any(), eq(containerHost1));
     verify(rmClient, times(0)).releaseAssignedContainer(
-      eq(containerHost1.getId()));
+        eq(containerHost1.getId()));
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);
     eventHandler.reset();
 
@@ -325,8 +325,8 @@
     taskScheduler.onContainersAllocated(Lists.newArrayList(containerHost1, containerHost2));
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta11), any(Object.class), eq(containerHost1));
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta21), any(Object.class),
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta11), any(), eq(containerHost1));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta21), any(),
         eq(containerHost2));
 
     // Adding the event later so that task1 assigned to containerHost1 is deterministic.
@@ -338,7 +338,7 @@
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta21, true, null, null);
     verify(taskSchedulerManager, times(0)).taskAllocated(
-        eq(0), eq(ta31), any(Object.class), eq(containerHost2));
+        eq(0), eq(ta31), any(), eq(containerHost2));
     verify(rmClient, times(1)).releaseAssignedContainer(
       eq(containerHost2.getId()));
     eventHandler.verifyInvocation(AMContainerEventStopRequest.class);
@@ -426,7 +426,7 @@
     taskScheduler.onContainersAllocated(Collections.singletonList(container1));
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta11), any(Object.class),
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta11), any(),
         eq(container1));
 
     // Task assigned to container completed successfully. Container should be re-used.
@@ -435,7 +435,7 @@
             null, 0));
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta11, true, null, null);
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta12), any(Object.class), eq(container1));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta12), any(), eq(container1));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container1.getId()));
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);
     eventHandler.reset();
@@ -447,7 +447,7 @@
             null, 0));
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta12, true, null, null);
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta13), any(Object.class),
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta13), any(),
         eq(container1));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container1.getId()));
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);
@@ -458,7 +458,7 @@
         new AMSchedulerEventTAEnded(ta13, container1.getId(), TaskAttemptState.FAILED, null,
             "TIMEOUT", 0));
     drainableAppCallback.drain();
-    verify(taskSchedulerManager, times(0)).taskAllocated(eq(0), eq(ta14), any(Object.class),
+    verify(taskSchedulerManager, times(0)).taskAllocated(eq(0), eq(ta14), any(),
         eq(container1));
     verifyDeAllocateTask(taskScheduler, ta13, false, null, "TIMEOUT");
     verify(rmClient).releaseAssignedContainer(eq(container1.getId()));
@@ -471,7 +471,7 @@
     taskScheduler.onContainersAllocated(Collections.singletonList(container2));
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta14), any(Object.class),
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta14), any(),
         eq(container2));
 
     // Task assigned to container completed successfully. No pending requests. Container should be released.
@@ -571,7 +571,7 @@
     taskScheduler.onContainersAllocated(Collections.singletonList(container1));
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta11), any(Object.class),
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta11), any(),
         eq(container1));
 
     // First task had profiling on. This container can not be reused further.
@@ -580,7 +580,7 @@
             null, 0));
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta11, true, null, null);
-    verify(taskSchedulerManager, times(0)).taskAllocated(eq(0), eq(ta12), any(Object.class),
+    verify(taskSchedulerManager, times(0)).taskAllocated(eq(0), eq(ta12), any(),
         eq(container1));
     verify(rmClient, times(1)).releaseAssignedContainer(eq(container1.getId()));
     eventHandler.verifyInvocation(AMContainerEventStopRequest.class);
@@ -614,7 +614,7 @@
     taskScheduler.onContainersAllocated(Collections.singletonList(container2));
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta13), any(Object.class), eq(container2));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta13), any(), eq(container2));
 
     // Verify that the container can not be reused when profiling option is turned on
     // Even for 2 tasks having same profiling option can have container reusability.
@@ -623,7 +623,7 @@
             null, 0));
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta13, true, null, null);
-    verify(taskSchedulerManager, times(0)).taskAllocated(eq(0), eq(ta14), any(Object.class),
+    verify(taskSchedulerManager, times(0)).taskAllocated(eq(0), eq(ta14), any(),
         eq(container2));
     verify(rmClient, times(1)).releaseAssignedContainer(eq(container2.getId()));
     eventHandler.verifyInvocation(AMContainerEventStopRequest.class);
@@ -661,7 +661,7 @@
     taskScheduler.onContainersAllocated(Collections.singletonList(container3));
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta15), any(Object.class),
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta15), any(),
         eq(container3));
 
     //Ensure task 6 (of vertex 1) is allocated to same container
@@ -670,7 +670,7 @@
             null, 0));
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta15, true, null, null);
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta16), any(Object.class), eq(container3));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta16), any(), eq(container3));
     eventHandler.reset();
 
     taskScheduler.shutdown();
@@ -759,7 +759,7 @@
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
     verify(taskSchedulerManager).taskAllocated(
-        eq(0), eq(ta11), any(Object.class), eq(container1));
+        eq(0), eq(ta11), any(), eq(container1));
 
     // Send launch request for task2 (vertex2)
     taskSchedulerManager.handleEvent(lrEvent12);
@@ -773,7 +773,7 @@
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta11, true, null, null);
     verify(taskSchedulerManager, times(0)).taskAllocated(
-        eq(0), eq(ta12), any(Object.class), eq(container1));
+        eq(0), eq(ta12), any(), eq(container1));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container1.getId()));
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);
     eventHandler.reset();
@@ -781,7 +781,7 @@
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
     verify(taskSchedulerManager).taskAllocated(
-        eq(0), eq(ta12), any(Object.class), eq(container1));
+        eq(0), eq(ta12), any(), eq(container1));
 
     // TA12 completed.
     taskSchedulerManager.handleEvent(
@@ -887,7 +887,7 @@
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
     verify(taskSchedulerManager).taskAllocated(
-        eq(0), eq(ta11), any(Object.class), eq(container1));
+        eq(0), eq(ta11), any(), eq(container1));
 
     // Send launch request for task2 (vertex2)
     taskSchedulerManager.handleEvent(lrEvent21);
@@ -900,7 +900,7 @@
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta11, true, null, null);
     verify(taskSchedulerManager).taskAllocated(
-        eq(0), eq(ta21), any(Object.class), eq(container1));
+        eq(0), eq(ta21), any(), eq(container1));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container1.getId()));
 
     // Task 2 completes.
@@ -999,7 +999,7 @@
     taskScheduler.onContainersAllocated(Collections.singletonList(container1));
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta111), any(Object.class), eq(container1));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta111), any(), eq(container1));
     assignEvent = (AMContainerEventAssignTA) eventHandler.verifyInvocation(AMContainerEventAssignTA.class);
     assertEquals(1, assignEvent.getRemoteTaskLocalResources().size());
     
@@ -1009,7 +1009,7 @@
             null, 0));
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta111, true, null, null);
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta112), any(Object.class), eq(container1));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta112), any(), eq(container1));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container1.getId()));
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);
     assignEvent = (AMContainerEventAssignTA) eventHandler.verifyInvocation(AMContainerEventAssignTA.class);
@@ -1052,7 +1052,7 @@
 
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta211), any(Object.class),
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta211), any(),
         eq(container1));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container1.getId()));
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);
@@ -1065,7 +1065,7 @@
             null, 0));
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta211, true, null, null);
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta212), any(Object.class), eq(container1));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta212), any(), eq(container1));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container1.getId()));
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);
     assignEvent = (AMContainerEventAssignTA) eventHandler.verifyInvocation(AMContainerEventAssignTA.class);
@@ -1186,7 +1186,7 @@
     taskScheduler.onContainersAllocated(Collections.singletonList(container1));
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta111), any(Object.class), eq(container1));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta111), any(), eq(container1));
     assignEvent = (AMContainerEventAssignTA) eventHandler.verifyInvocation(AMContainerEventAssignTA.class);
     assertEquals(1, assignEvent.getRemoteTaskLocalResources().size());
 
@@ -1196,7 +1196,7 @@
             null, 0));
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta111, true, null, null);
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta112), any(Object.class), eq(container1));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta112), any(), eq(container1));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container1.getId()));
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);
     assignEvent = (AMContainerEventAssignTA) eventHandler.verifyInvocation(AMContainerEventAssignTA.class);
@@ -1217,7 +1217,7 @@
     taskSchedulerManager.handleEvent(lrEvent13);
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta113), any(Object.class), eq(container1));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta113), any(), eq(container1));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container1.getId()));
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);
     eventHandler.reset();
@@ -1234,7 +1234,7 @@
     taskSchedulerManager.handleEvent(lrEvent14);
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta114), any(Object.class), eq(container1));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta114), any(), eq(container1));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container1.getId()));
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);
     eventHandler.reset();
@@ -1276,7 +1276,7 @@
     taskScheduler.onContainersAllocated(Collections.singletonList(container2));
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta211), any(Object.class), eq(container2));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta211), any(), eq(container2));
     eventHandler.reset();
 
     taskSchedulerManager.handleEvent(new AMSchedulerEventTAEnded(ta211, container2.getId(),
@@ -1305,7 +1305,7 @@
     taskSchedulerManager.handleEvent(lrEvent31);
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta311), any(Object.class), eq(container2));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta311), any(), eq(container2));
     eventHandler.reset();
 
     taskScheduler.shutdown();
@@ -1376,7 +1376,7 @@
     taskScheduler.onContainersAllocated(Collections.singletonList(container1));
     drainableAppCallback.drain();
     verify(taskSchedulerManager, times(0)).taskAllocated(eq(0), eq(ta11),
-        any(Object.class), eq(container1));
+        any(), eq(container1));
     taskScheduler.shutdown();
     taskSchedulerManager.close();
   }
@@ -1467,20 +1467,20 @@
     taskScheduler.onContainersAllocated(Collections.singletonList(container1));
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta11), any(Object.class), eq(container1));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta11), any(), eq(container1));
 
     // Second container allocated, should start ta13
     taskScheduler.onContainersAllocated(Collections.singletonList(container2));
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta13), any(Object.class), eq(container2));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta13), any(), eq(container2));
 
     // ta11 finished, should start ta12
     taskSchedulerManager.handleEvent(new AMSchedulerEventTAEnded(ta11, container1.getId(),
         TaskAttemptState.SUCCEEDED, null, null, 0));
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta11, true, null, null);
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta12), any(Object.class), eq(container1));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta12), any(), eq(container1));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container1.getId()));
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);
     eventHandler.reset();
@@ -1490,7 +1490,7 @@
         TaskAttemptState.SUCCEEDED, null, null, 0));
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta13, true, null, null);
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta14), any(Object.class), eq(container2));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta14), any(), eq(container2));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container2.getId()));
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);
     eventHandler.reset();
@@ -1609,14 +1609,14 @@
     taskScheduler.onContainersAllocated(Collections.singletonList(container1));
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta11), any(Object.class), eq(container1));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta11), any(), eq(container1));
 
     // finish ta11, should start ta13
     taskSchedulerManager.handleEvent(new AMSchedulerEventTAEnded(ta11, container1.getId(),
         TaskAttemptState.SUCCEEDED, null, null, 0));
     drainableAppCallback.drain();
     verifyDeAllocateTask(taskScheduler, ta11, true, null, null);
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta13), any(Object.class), eq(container1));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta13), any(), eq(container1));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container1.getId()));
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);
     eventHandler.reset();
@@ -1634,7 +1634,7 @@
     taskScheduler.onContainersAllocated(Collections.singletonList(container2));
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta12), any(Object.class), eq(container2));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta12), any(), eq(container2));
 
     // ta12 finished, cannot reuse container, should release container2
     taskSchedulerManager.handleEvent(new AMSchedulerEventTAEnded(ta12, container2.getId(),
@@ -1649,7 +1649,7 @@
     taskScheduler.onContainersAllocated(Collections.singletonList(container3));
     TestTaskSchedulerHelpers.waitForDelayedDrainNotify(drainNotifier);
     drainableAppCallback.drain();
-    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta14), any(Object.class), eq(container3));
+    verify(taskSchedulerManager).taskAllocated(eq(0), eq(ta14), any(), eq(container3));
 
     // ta14 finished, should release container3
     taskSchedulerManager.handleEvent(new AMSchedulerEventTAEnded(ta14, container3.getId(),
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestDagAwareYarnTaskScheduler.java b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestDagAwareYarnTaskScheduler.java
index 48dd938..1465bfa 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestDagAwareYarnTaskScheduler.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestDagAwareYarnTaskScheduler.java
@@ -77,11 +77,11 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyListOf;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.isNull;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyList;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.isNull;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
@@ -170,23 +170,23 @@
         racks, mockPriority, null, mockCookie1);
     drainableAppCallback.drain();
     verify(mockRMClient, times(1)).
-        addContainerRequest(any(TaskRequest.class));
+        addContainerRequest(any());
 
     // returned from task requests before allocation happens
     assertFalse(scheduler.deallocateTask(mockTask1, true, null, null));
-    verify(mockApp, times(0)).containerBeingReleased(any(ContainerId.class));
+    verify(mockApp, times(0)).containerBeingReleased(any());
     verify(mockRMClient, times(1)).
-        removeContainerRequest(any(TaskRequest.class));
+        removeContainerRequest(any());
     verify(mockRMClient, times(0)).
-        releaseAssignedContainer((ContainerId) any());
+        releaseAssignedContainer(any());
 
     // deallocating unknown task
     assertFalse(scheduler.deallocateTask(mockTask1, true, null, null));
-    verify(mockApp, times(0)).containerBeingReleased(any(ContainerId.class));
+    verify(mockApp, times(0)).containerBeingReleased(any());
     verify(mockRMClient, times(1)).
-        removeContainerRequest(any(TaskRequest.class));
+        removeContainerRequest(any());
     verify(mockRMClient, times(0)).
-        releaseAssignedContainer((ContainerId) any());
+        releaseAssignedContainer(any());
 
     // allocate tasks
     Object mockTask2 = new MockTask("task2");
@@ -237,7 +237,7 @@
     verify(mockApp).taskAllocated(mockTask2, mockCookie2, mockContainer2);
     verify(mockApp).taskAllocated(mockTask3, mockCookie3, mockContainer3);
     // no other allocations returned
-    verify(mockApp, times(3)).taskAllocated(any(), any(), (Container) any());
+    verify(mockApp, times(3)).taskAllocated(any(), any(), any());
     verify(mockRMClient).removeContainerRequest(request1);
     verify(mockRMClient).removeContainerRequest(request2);
     verify(mockRMClient).removeContainerRequest(request3);
@@ -253,7 +253,7 @@
     assertEquals(mockTask2, scheduler.deallocateContainer(mockCId2));
     drainableAppCallback.drain();
     verify(mockRMClient).releaseAssignedContainer(mockCId2);
-    verify(mockRMClient, times(3)).releaseAssignedContainer((ContainerId) any());
+    verify(mockRMClient, times(3)).releaseAssignedContainer(any());
 
     List<ContainerStatus> statuses = new ArrayList<>();
     ContainerStatus mockStatus1 = mock(ContainerStatus.class);
@@ -277,16 +277,16 @@
     // currently allocated container status returned and not released
     verify(mockApp).containerCompleted(mockTask3, mockStatus3);
     // no other statuses returned
-    verify(mockApp, times(3)).containerCompleted(any(), (ContainerStatus) any());
-    verify(mockRMClient, times(3)).releaseAssignedContainer((ContainerId) any());
+    verify(mockApp, times(3)).containerCompleted(any(), any());
+    verify(mockRMClient, times(3)).releaseAssignedContainer(any());
 
     // verify blacklisting
-    verify(mockRMClient, times(0)).updateBlacklist(anyListOf(String.class), anyListOf(String.class));
+    verify(mockRMClient, times(0)).updateBlacklist(anyList(), anyList());
     String badHost = "host6";
     NodeId badNodeId = NodeId.newInstance(badHost, 1);
     scheduler.blacklistNode(badNodeId);
     List<String> badNodeList = Collections.singletonList(badHost);
-    verify(mockRMClient, times(1)).updateBlacklist(eq(badNodeList), isNull(List.class));
+    verify(mockRMClient, times(1)).updateBlacklist(eq(badNodeList), isNull());
     Object mockTask4 = new MockTask("task4");
     Object mockCookie4 = new Object();
     scheduler.allocateTask(mockTask4, mockCapability, null,
@@ -300,10 +300,10 @@
     scheduler.onContainersAllocated(containers);
     drainableAppCallback.drain();
     // no new allocation
-    verify(mockApp, times(3)).taskAllocated(any(), any(), (Container) any());
+    verify(mockApp, times(3)).taskAllocated(any(), any(), any());
     // verify blacklisted container released
     verify(mockRMClient).releaseAssignedContainer(mockCId5);
-    verify(mockRMClient, times(4)).releaseAssignedContainer((ContainerId) any());
+    verify(mockRMClient, times(4)).releaseAssignedContainer(any());
     // verify request added back
     verify(mockRMClient, times(6)).addContainerRequest(requestCaptor.capture());
     NodeId host6 = NodeId.newInstance("host6", 6);
@@ -314,17 +314,17 @@
     scheduler.onContainersAllocated(containers);
     drainableAppCallback.drain();
     // new allocation
-    verify(mockApp, times(4)).taskAllocated(any(), any(), (Container) any());
+    verify(mockApp, times(4)).taskAllocated(any(), any(), any());
     verify(mockApp).taskAllocated(mockTask4, mockCookie4, mockContainer6);
     // deallocate allocated task
     assertTrue(scheduler.deallocateTask(mockTask4, true, null, null));
     drainableAppCallback.drain();
     verify(mockApp).containerBeingReleased(mockCId6);
     verify(mockRMClient).releaseAssignedContainer(mockCId6);
-    verify(mockRMClient, times(5)).releaseAssignedContainer((ContainerId) any());
+    verify(mockRMClient, times(5)).releaseAssignedContainer(any());
     // test unblacklist
     scheduler.unblacklistNode(badNodeId);
-    verify(mockRMClient, times(1)).updateBlacklist(isNull(List.class), eq(badNodeList));
+    verify(mockRMClient, times(1)).updateBlacklist(isNull(), eq(badNodeList));
     assertEquals(0, scheduler.getNumBlacklistedNodes());
 
     float progress = 0.5f;
@@ -335,16 +335,16 @@
     scheduler.allocateTask(mockTask1, mockCapability, hosts, racks,
         mockPriority, null, mockCookie1);
     drainableAppCallback.drain();
-    verify(mockRMClient, times(7)).addContainerRequest(any(TaskRequest.class));
+    verify(mockRMClient, times(7)).addContainerRequest(any());
     verify(mockRMClient, times(6)).
-        removeContainerRequest(any(TaskRequest.class));
+        removeContainerRequest(any());
     scheduler.allocateTask(mockTask1, mockCapability, hosts, racks,
         mockPriority, null, mockCookie1);
     drainableAppCallback.drain();
     // old request removed and new one added
     verify(mockRMClient, times(7)).
-        removeContainerRequest(any(TaskRequest.class));
-    verify(mockRMClient, times(8)).addContainerRequest(any(TaskRequest.class));
+        removeContainerRequest(any());
+    verify(mockRMClient, times(8)).addContainerRequest(any());
     assertFalse(scheduler.deallocateTask(mockTask1, true, null, null));
 
     // test speculative node adjustment
@@ -360,9 +360,9 @@
         mockPriority, null, mockCookie5);
     drainableAppCallback.drain();
     // no new allocation
-    verify(mockApp, times(4)).taskAllocated(any(), any(), (Container) any());
+    verify(mockApp, times(4)).taskAllocated(any(), any(), any());
     // verify container released
-    verify(mockRMClient, times(5)).releaseAssignedContainer((ContainerId) any());
+    verify(mockRMClient, times(5)).releaseAssignedContainer(any());
     // verify request added back
     verify(mockRMClient, times(9)).addContainerRequest(requestCaptor.capture());
 
@@ -377,7 +377,7 @@
     drainableAppCallback.drain();
     verify(mockApp)
         .reportError(eq(YarnTaskSchedulerServiceError.RESOURCEMANAGER_ERROR), argumentCaptor.capture(),
-            any(DagInfo.class));
+            any());
     assertTrue(argumentCaptor.getValue().contains("mockexception"));
 
     scheduler.onShutdownRequest();
@@ -468,8 +468,8 @@
     assertTrue(scheduler.deallocateTask(taskv0t0.task, true, null, null));
     clock.incrementTime(10000);
     drainableAppCallback.drain();
-    verify(mockApp, never()).containerBeingReleased(any(ContainerId.class));
-    verify(mockRMClient, never()).releaseAssignedContainer(any(ContainerId.class));
+    verify(mockApp, never()).containerBeingReleased(any());
+    verify(mockRMClient, never()).releaseAssignedContainer(any());
     verify(mockApp).taskAllocated(taskv0t2.task, taskv0t2.cookie, container1);
     verify(mockRMClient).removeContainerRequest(reqv0t2);
 
@@ -477,8 +477,8 @@
     assertTrue(scheduler.deallocateTask(taskv0t2.task, true, null, null));
     clock.incrementTime(10000);
     drainableAppCallback.drain();
-    verify(mockApp, never()).containerBeingReleased(any(ContainerId.class));
-    verify(mockRMClient, never()).releaseAssignedContainer(any(ContainerId.class));
+    verify(mockApp, never()).containerBeingReleased(any());
+    verify(mockRMClient, never()).releaseAssignedContainer(any());
     verify(mockApp).taskAllocated(taskv1t0.task, taskv1t0.cookie, container1);
     verify(mockRMClient).removeContainerRequest(reqv1t0);
 
@@ -575,8 +575,8 @@
     assertTrue(scheduler.deallocateTask(taskv0t0.task, true, null, null));
     clock.incrementTime(10000);
     drainableAppCallback.drain();
-    verify(mockApp, never()).containerBeingReleased(any(ContainerId.class));
-    verify(mockRMClient, never()).releaseAssignedContainer(any(ContainerId.class));
+    verify(mockApp, never()).containerBeingReleased(any());
+    verify(mockRMClient, never()).releaseAssignedContainer(any());
     verify(mockApp).taskAllocated(taskv1t0.task, taskv1t0.cookie, container1);
     verify(mockRMClient).removeContainerRequest(reqv1t0);
 
@@ -584,8 +584,8 @@
     assertTrue(scheduler.deallocateTask(taskv1t0.task, true, null, null));
     clock.incrementTime(10000);
     drainableAppCallback.drain();
-    verify(mockApp, never()).containerBeingReleased(any(ContainerId.class));
-    verify(mockRMClient, never()).releaseAssignedContainer(any(ContainerId.class));
+    verify(mockApp, never()).containerBeingReleased(any());
+    verify(mockRMClient, never()).releaseAssignedContainer(any());
     verify(mockApp).taskAllocated(taskv0t1.task, taskv0t1.cookie, container1);
     verify(mockRMClient).removeContainerRequest(reqv0t1);
 
@@ -682,8 +682,8 @@
     assertTrue(scheduler.deallocateTask(taskv0t0.task, true, null, null));
     clock.incrementTime(10000);
     drainableAppCallback.drain();
-    verify(mockApp, never()).containerBeingReleased(any(ContainerId.class));
-    verify(mockRMClient, never()).releaseAssignedContainer(any(ContainerId.class));
+    verify(mockApp, never()).containerBeingReleased(any());
+    verify(mockRMClient, never()).releaseAssignedContainer(any());
     verify(mockApp).taskAllocated(taskv1t0.task, taskv1t0.cookie, container1);
     verify(mockRMClient).removeContainerRequest(reqv1t0);
 
@@ -691,8 +691,8 @@
     assertTrue(scheduler.deallocateTask(taskv1t0.task, true, null, null));
     clock.incrementTime(10000);
     drainableAppCallback.drain();
-    verify(mockApp, never()).containerBeingReleased(any(ContainerId.class));
-    verify(mockRMClient, never()).releaseAssignedContainer(any(ContainerId.class));
+    verify(mockApp, never()).containerBeingReleased(any());
+    verify(mockRMClient, never()).releaseAssignedContainer(any());
     verify(mockApp).taskAllocated(taskv0t1.task, taskv0t1.cookie, container1);
     verify(mockRMClient).removeContainerRequest(reqv0t1);
 
@@ -700,8 +700,8 @@
     assertTrue(scheduler.deallocateTask(taskv0t1.task, true, null, null));
     clock.incrementTime(10000);
     drainableAppCallback.drain();
-    verify(mockApp, never()).containerBeingReleased(any(ContainerId.class));
-    verify(mockRMClient, never()).releaseAssignedContainer(any(ContainerId.class));
+    verify(mockApp, never()).containerBeingReleased(any());
+    verify(mockRMClient, never()).releaseAssignedContainer(any());
     verify(mockApp).taskAllocated(taskv0t2.task, taskv0t2.cookie, container1);
     verify(mockRMClient).removeContainerRequest(reqv0t2);
 
@@ -795,8 +795,8 @@
     assertTrue(scheduler.deallocateTask(taskv0t0.task, true, null, null));
     clock.incrementTime(10000);
     drainableAppCallback.drain();
-    verify(mockApp, never()).containerBeingReleased(any(ContainerId.class));
-    verify(mockRMClient, never()).releaseAssignedContainer(any(ContainerId.class));
+    verify(mockApp, never()).containerBeingReleased(any());
+    verify(mockRMClient, never()).releaseAssignedContainer(any());
     verify(mockApp).taskAllocated(taskv1t0.task, taskv1t0.cookie, container1);
     verify(mockRMClient).removeContainerRequest(reqv1t0);
 
@@ -895,8 +895,8 @@
     assertTrue(scheduler.deallocateTask(taskv0t0.task, true, null, null));
     clock.incrementTime(10000);
     drainableAppCallback.drain();
-    verify(mockApp, never()).containerBeingReleased(any(ContainerId.class));
-    verify(mockRMClient, never()).releaseAssignedContainer(any(ContainerId.class));
+    verify(mockApp, never()).containerBeingReleased(any());
+    verify(mockRMClient, never()).releaseAssignedContainer(any());
     verify(mockApp).taskAllocated(taskv2t0.task, taskv2t0.cookie, container1);
     verify(mockRMClient).removeContainerRequest(reqv2t0);
 
@@ -905,8 +905,8 @@
     assertTrue(scheduler.deallocateTask(taskv2t0.task, true, null, null));
     clock.incrementTime(10000);
     drainableAppCallback.drain();
-    verify(mockApp, never()).containerBeingReleased(any(ContainerId.class));
-    verify(mockRMClient, never()).releaseAssignedContainer(any(ContainerId.class));
+    verify(mockApp, never()).containerBeingReleased(any());
+    verify(mockRMClient, never()).releaseAssignedContainer(any());
     verify(mockApp).taskAllocated(taskv0t1.task, taskv0t1.cookie, container1);
     verify(mockRMClient).removeContainerRequest(reqv0t1);
 
@@ -914,8 +914,8 @@
     assertTrue(scheduler.deallocateTask(taskv0t1.task, true, null, null));
     clock.incrementTime(10000);
     drainableAppCallback.drain();
-    verify(mockApp, never()).containerBeingReleased(any(ContainerId.class));
-    verify(mockRMClient, never()).releaseAssignedContainer(any(ContainerId.class));
+    verify(mockApp, never()).containerBeingReleased(any());
+    verify(mockRMClient, never()).releaseAssignedContainer(any());
     verify(mockApp).taskAllocated(taskv1t0.task, taskv1t0.cookie, container1);
     verify(mockRMClient).removeContainerRequest(reqv1t0);
 
@@ -1070,15 +1070,15 @@
     assertTrue(scheduler.deallocateTask(taskv0t4.task, true, null, null));
     assertTrue(scheduler.deallocateTask(taskv0t5.task, true, null, null));
     assertTrue(scheduler.deallocateTask(taskv0t6.task, true, null, null));
-    verify(mockApp, never()).containerBeingReleased(any(ContainerId.class));
-    verify(mockRMClient, never()).releaseAssignedContainer(any(ContainerId.class));
+    verify(mockApp, never()).containerBeingReleased(any());
+    verify(mockRMClient, never()).releaseAssignedContainer(any());
 
     // verify only two of the containers were released after idle expiration
     // and the rest were spread across the nodes and racks
     clock.incrementTime(5000);
     drainableAppCallback.drain();
-    verify(mockApp, times(2)).containerBeingReleased(any(ContainerId.class));
-    verify(mockRMClient, times(2)).releaseAssignedContainer(any(ContainerId.class));
+    verify(mockApp, times(2)).containerBeingReleased(any());
+    verify(mockRMClient, times(2)).releaseAssignedContainer(any());
     Set<String> hosts = new HashSet<>();
     Set<String> racks = new HashSet<>();
     for (HeldContainer hc : scheduler.getSessionContainers()) {
@@ -1202,7 +1202,7 @@
     scheduler.getProgress();
     scheduler.getProgress();
     drainableAppCallback.drain();
-    verify(mockApp, times(1)).preemptContainer(any(ContainerId.class));
+    verify(mockApp, times(1)).preemptContainer(any());
     verify(mockApp).preemptContainer(cid2);
     assertEquals(taskv1t1.task, scheduler.deallocateContainer(cid2));
     drainableAppCallback.drain();
@@ -1226,13 +1226,13 @@
     scheduler.getProgress();
     scheduler.getProgress();
     drainableAppCallback.drain();
-    verify(mockApp, times(1)).preemptContainer(any(ContainerId.class));
+    verify(mockApp, times(1)).preemptContainer(any());
 
     // adding request for v0 should trigger preemption on next heartbeat
     taskRequestCaptor.scheduleTask(taskv0t1);
     scheduler.getProgress();
     drainableAppCallback.drain();
-    verify(mockApp, times(2)).preemptContainer(any(ContainerId.class));
+    verify(mockApp, times(2)).preemptContainer(any());
     verify(mockApp).preemptContainer(cid1);
     assertEquals(taskv1t0.task, scheduler.deallocateContainer(cid1));
     drainableAppCallback.drain();
@@ -1346,7 +1346,7 @@
     scheduler.getProgress();
     scheduler.getProgress();
     drainableAppCallback.drain();
-    verify(mockApp, times(1)).preemptContainer(any(ContainerId.class));
+    verify(mockApp, times(1)).preemptContainer(any());
     verify(mockApp).preemptContainer(cid1);
     String appMsg = "success";
     AppFinalStatus finalStatus =
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestLocalTaskSchedulerService.java b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestLocalTaskSchedulerService.java
index 70e31f3..e193ee9 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestLocalTaskSchedulerService.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestLocalTaskSchedulerService.java
@@ -190,12 +190,12 @@
     Answer<Void> answer = new Answer<Void>() {
       @Override
       public Void answer(InvocationOnMock invocation) {
-        ContainerId containerId = invocation.getArgumentAt(0, ContainerId.class);
+        ContainerId containerId = invocation.getArgument(0, ContainerId.class);
         taskSchedulerService.deallocateContainer(containerId);
         return null;
       }
     };
-    doAnswer(answer).when(mockContext).preemptContainer(any(ContainerId.class));
+    doAnswer(answer).when(mockContext).preemptContainer(any());
 
     taskSchedulerService.initialize();
     taskSchedulerService.start();
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestTaskScheduler.java b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestTaskScheduler.java
index 965b8d7..ff34084 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestTaskScheduler.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestTaskScheduler.java
@@ -23,11 +23,12 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
@@ -70,7 +71,6 @@
 import org.apache.tez.dag.app.rm.TestTaskSchedulerHelpers.TaskSchedulerWithDrainableContext;
 import org.apache.tez.dag.app.rm.YarnTaskSchedulerService.CookieContainerRequest;
 import org.apache.tez.dag.app.rm.YarnTaskSchedulerService.HeldContainer;
-import org.apache.tez.serviceplugins.api.DagInfo;
 import org.apache.tez.serviceplugins.api.TaskSchedulerContext;
 import org.apache.tez.serviceplugins.api.TaskSchedulerContext.AppFinalStatus;
 import org.junit.After;
@@ -79,7 +79,6 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 
@@ -174,7 +173,7 @@
 
     // returned from task requests before allocation happens
     assertFalse(scheduler.deallocateTask(mockTask1, true, null, null));
-    verify(mockApp, times(0)).containerBeingReleased(any(ContainerId.class));
+    verify(mockApp, times(0)).containerBeingReleased(any());
     verify(mockRMClient, times(1)).
                         removeContainerRequest((CookieContainerRequest) any());
     verify(mockRMClient, times(0)).
@@ -182,7 +181,7 @@
 
     // deallocating unknown task
     assertFalse(scheduler.deallocateTask(mockTask1, true, null, null));
-    verify(mockApp, times(0)).containerBeingReleased(any(ContainerId.class));
+    verify(mockApp, times(0)).containerBeingReleased(any());
     verify(mockRMClient, times(1)).
                         removeContainerRequest((CookieContainerRequest) any());
     verify(mockRMClient, times(0)).
@@ -378,7 +377,7 @@
     drainableAppCallback.drain();
     verify(mockApp)
         .reportError(eq(YarnTaskSchedulerServiceError.RESOURCEMANAGER_ERROR), argumentCaptor.capture(),
-            any(DagInfo.class));
+            any());
     assertTrue(argumentCaptor.getValue().contains("mockexception"));
 
     scheduler.onShutdownRequest();
@@ -744,7 +743,7 @@
     scheduler.onError(mockException);
     drainableAppCallback.drain();
     verify(mockApp).reportError(eq(YarnTaskSchedulerServiceError.RESOURCEMANAGER_ERROR), argumentCaptor.capture(),
-            any(DagInfo.class));
+            any());
     assertTrue(argumentCaptor.getValue().contains("mockexception"));
 
     scheduler.onShutdownRequest();
@@ -791,43 +790,43 @@
     Resource r = Resource.newInstance(0, 0);
     ContainerId mockCId1 = ContainerId.newInstance(appId, 0);
     Container c1 = Container.newInstance(mockCId1, emptyHost, null, r, null, null);
-    HeldContainer hc1 = Mockito.spy(new HeldContainer(c1, 0, 0, null, containerSignatureMatcher));
+    HeldContainer hc1 = spy(new HeldContainer(c1, 0, 0, null, containerSignatureMatcher));
     when(hc1.getNode()).thenReturn(node1Rack1);
     when(hc1.getRack()).thenReturn(rack1);
     when(hc1.getContainer()).thenReturn(c1);
     ContainerId mockCId2 = ContainerId.newInstance(appId, 1);
     Container c2 = Container.newInstance(mockCId2, emptyHost, null, r, null, null);
-    HeldContainer hc2 = Mockito.spy(new HeldContainer(c2, 0, 0, null, containerSignatureMatcher));
+    HeldContainer hc2 = spy(new HeldContainer(c2, 0, 0, null, containerSignatureMatcher));
     when(hc2.getNode()).thenReturn(node2Rack1);
     when(hc2.getRack()).thenReturn(rack1);
     when(hc2.getContainer()).thenReturn(c2);
     ContainerId mockCId3 = ContainerId.newInstance(appId, 2);
     Container c3 = Container.newInstance(mockCId3, emptyHost, null, r, null, null);
-    HeldContainer hc3 = Mockito.spy(new HeldContainer(c3, 0, 0, null, containerSignatureMatcher));
+    HeldContainer hc3 = spy(new HeldContainer(c3, 0, 0, null, containerSignatureMatcher));
     when(hc3.getNode()).thenReturn(node1Rack1);
     when(hc3.getRack()).thenReturn(rack1);
     when(hc3.getContainer()).thenReturn(c3);
     ContainerId mockCId4 = ContainerId.newInstance(appId, 3);
     Container c4 = Container.newInstance(mockCId4, emptyHost, null, r, null, null);
-    HeldContainer hc4 = Mockito.spy(new HeldContainer(c4, 0, 0, null, containerSignatureMatcher));
+    HeldContainer hc4 = spy(new HeldContainer(c4, 0, 0, null, containerSignatureMatcher));
     when(hc4.getNode()).thenReturn(node2Rack1);
     when(hc4.getRack()).thenReturn(rack1);
     when(hc4.getContainer()).thenReturn(c4);
     ContainerId mockCId5 = ContainerId.newInstance(appId, 4);
     Container c5 = Container.newInstance(mockCId5, emptyHost, null, r, null, null);
-    HeldContainer hc5 = Mockito.spy(new HeldContainer(c5, 0, 0, null, containerSignatureMatcher));
+    HeldContainer hc5 = spy(new HeldContainer(c5, 0, 0, null, containerSignatureMatcher));
     when(hc5.getNode()).thenReturn(node1Rack2);
     when(hc5.getRack()).thenReturn(rack2);
     when(hc5.getContainer()).thenReturn(c5);
     ContainerId mockCId6 = ContainerId.newInstance(appId, 5);
     Container c6 = Container.newInstance(mockCId6, emptyHost, null, r, null, null);
-    HeldContainer hc6 = Mockito.spy(new HeldContainer(c6, 0, 0, null, containerSignatureMatcher));
+    HeldContainer hc6 = spy(new HeldContainer(c6, 0, 0, null, containerSignatureMatcher));
     when(hc6.getNode()).thenReturn(node2Rack2);
     when(hc6.getRack()).thenReturn(rack2);
     when(hc6.getContainer()).thenReturn(c6);
     ContainerId mockCId7 = ContainerId.newInstance(appId, 6);
     Container c7 = Container.newInstance(mockCId7, emptyHost, null, r, null, null);
-    HeldContainer hc7 = Mockito.spy(new HeldContainer(c7, 0, 0, null, containerSignatureMatcher));
+    HeldContainer hc7 = spy(new HeldContainer(c7, 0, 0, null, containerSignatureMatcher));
     when(hc7.getNode()).thenReturn(node1Rack3);
     when(hc7.getRack()).thenReturn(rack3);
     when(hc7.getContainer()).thenReturn(c7);
@@ -1143,7 +1142,7 @@
 
         });
     
-    Mockito.doAnswer(new Answer() {
+    doAnswer(new Answer() {
       public Object answer(InvocationOnMock invocation) {
           Object[] args = invocation.getArguments();
           ContainerId cId = (ContainerId) args[0];
@@ -1342,7 +1341,7 @@
     List<Container> containers = new ArrayList<Container>();
     containers.add(mockContainer1);
     
-    Mockito.doAnswer(new Answer<Object>() {
+    doAnswer(new Answer<Object>() {
       public Object answer(InvocationOnMock invocation) {
           Object[] args = invocation.getArguments();
           ContainerId cId = (ContainerId) args[0];
@@ -1603,7 +1602,7 @@
     statuses.add(mockStatus2);
     scheduler.onContainersCompleted(statuses);
 
-    verify(mockApp, times(0)).taskAllocated(any(), any(), any(Container.class));
+    verify(mockApp, times(0)).taskAllocated(any(), any(), any());
     verify(mockRMClient, times(3)).addContainerRequest(requestCaptor.capture());
     CookieContainerRequest resubmitRequest = requestCaptor.getValue();
     assertEquals(request2.getCookie().getTask(), resubmitRequest.getCookie().getTask());
@@ -1616,7 +1615,7 @@
     assertFalse(scheduler.deallocateTask(mockTask2, true, null, null));
     scheduler.onContainersAllocated(containers);
     scheduler.onContainersCompleted(statuses);
-    verify(mockApp, times(0)).taskAllocated(any(), any(), any(Container.class));
+    verify(mockApp, times(0)).taskAllocated(any(), any(), any());
     verify(mockRMClient, times(3)).addContainerRequest(requestCaptor.capture());
   }
 
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestTaskSchedulerManager.java b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestTaskSchedulerManager.java
index 3ddd186..095bd4e 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestTaskSchedulerManager.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestTaskSchedulerManager.java
@@ -23,10 +23,10 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.spy;
@@ -661,7 +661,7 @@
     tseh.handle(launchRequest1);
 
     verify(tseh.getTestTaskScheduler(0)).allocateTask(eq(mockTaskAttempt1), eq(resource),
-        any(String[].class), any(String[].class), any(Priority.class), any(Object.class),
+        any(String[].class), any(String[].class), any(), any(),
         eq(launchRequest1));
 
     AMSchedulerEventTALaunchRequest launchRequest2 =
@@ -670,7 +670,7 @@
             0);
     tseh.handle(launchRequest2);
     verify(tseh.getTestTaskScheduler(1)).allocateTask(eq(mockTaskAttempt2), eq(resource),
-        any(String[].class), any(String[].class), any(Priority.class), any(Object.class),
+        any(String[].class), any(String[].class), any(), any(),
         eq(launchRequest2));
   }
 
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/container/TestAMContainer.java b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/container/TestAMContainer.java
index d3614d9..3061cea 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/container/TestAMContainer.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/container/TestAMContainer.java
@@ -23,10 +23,10 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.reset;
@@ -1311,7 +1311,7 @@
      */
     @SuppressWarnings("unchecked")
     public void verifyNoOutgoingEvents() {
-      verify(eventHandler, never()).handle(any(Event.class));
+      verify(eventHandler, never()).handle(any());
     }
 
     /**
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/web/TestAMWebController.java b/tez-dag/src/test/java/org/apache/tez/dag/app/web/TestAMWebController.java
index 94c8df6..ced9ca0 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/web/TestAMWebController.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/web/TestAMWebController.java
@@ -18,11 +18,11 @@
 
 package org.apache.tez.dag.app.web;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.spy;
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/history/recovery/TestRecoveryService.java b/tez-dag/src/test/java/org/apache/tez/dag/history/recovery/TestRecoveryService.java
index 790e2d8..5d1fff9 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/history/recovery/TestRecoveryService.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/history/recovery/TestRecoveryService.java
@@ -20,8 +20,8 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
diff --git a/tez-ext-service-tests/pom.xml b/tez-ext-service-tests/pom.xml
index 8c2d84e..609b896 100644
--- a/tez-ext-service-tests/pom.xml
+++ b/tez-ext-service-tests/pom.xml
@@ -57,11 +57,15 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.tez</groupId>
+      <artifactId>hadoop-shim</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tez</groupId>
       <artifactId>tez-runtime-internals</artifactId>
     </dependency>
     <dependency>
diff --git a/tez-mapreduce/pom.xml b/tez-mapreduce/pom.xml
index ee7c318..a22870f 100644
--- a/tez-mapreduce/pom.xml
+++ b/tez-mapreduce/pom.xml
@@ -41,6 +41,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.tez</groupId>
+      <artifactId>hadoop-shim</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tez</groupId>
       <artifactId>tez-runtime-library</artifactId>
     </dependency>
     <dependency>
@@ -91,7 +95,7 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/tez-mapreduce/src/test/java/org/apache/hadoop/mapred/split/TestGroupedSplits.java b/tez-mapreduce/src/test/java/org/apache/hadoop/mapred/split/TestGroupedSplits.java
index 3dce417..9d70065 100644
--- a/tez-mapreduce/src/test/java/org/apache/hadoop/mapred/split/TestGroupedSplits.java
+++ b/tez-mapreduce/src/test/java/org/apache/hadoop/mapred/split/TestGroupedSplits.java
@@ -325,7 +325,7 @@
     for (int i=0; i<numSplits; i++) {
       mockSplits[i] = mockSplit1;
     }
-    when(mockWrappedFormat.getSplits((JobConf)anyObject(), anyInt())).thenReturn(mockSplits);
+    when(mockWrappedFormat.getSplits(any(), anyInt())).thenReturn(mockSplits);
     
     // desired splits not set. We end up choosing min/max split size based on 
     // total data and num original splits. In this case, min size will be hit
@@ -556,7 +556,7 @@
       when(mockSplit.getLocations()).thenReturn(locations);
       mockSplits[i] = mockSplit;
     }
-    when(mockWrappedFormat.getSplits((JobConf)anyObject(), anyInt())).thenReturn(mockSplits);
+    when(mockWrappedFormat.getSplits(any(), anyInt())).thenReturn(mockSplits);
     
     format.setDesiredNumberOfSplits(1);
     InputSplit[] splits = format.getSplits(job, 1);
@@ -594,7 +594,7 @@
     when(mockSplit3.getLocations()).thenReturn(new String[] {null, null});
     mockSplits[2] = mockSplit3;
 
-    when(mockWrappedFormat.getSplits((JobConf)anyObject(), anyInt())).thenReturn(mockSplits);
+    when(mockWrappedFormat.getSplits(any(), anyInt())).thenReturn(mockSplits);
     
     format.setDesiredNumberOfSplits(1);
     InputSplit[] splits = format.getSplits(job, 1);
@@ -643,7 +643,7 @@
     when(mockSplit5.getLocations()).thenReturn(new String[] {validLocation, null, validLocation2});
     mockSplits[4] = mockSplit4;
 
-    when(mockWrappedFormat.getSplits((JobConf)anyObject(), anyInt())).thenReturn(mockSplits);
+    when(mockWrappedFormat.getSplits(any(), anyInt())).thenReturn(mockSplits);
 
     format.setDesiredNumberOfSplits(numSplits);
     InputSplit[] splits = format.getSplits(job, 1);
@@ -712,7 +712,7 @@
     InputSplit[] mockSplits = new InputSplit[] { mockSplit1, mockSplit2,
         mockSplit3 };
 
-    when(mockWrappedFormat.getSplits((JobConf) anyObject(), anyInt()))
+    when(mockWrappedFormat.getSplits(any(), anyInt()))
         .thenReturn(mockSplits);
 
     format.setDesiredNumberOfSplits(1);
diff --git a/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/combine/TestMRCombiner.java b/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/combine/TestMRCombiner.java
index 7668d96..19bb8a0 100644
--- a/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/combine/TestMRCombiner.java
+++ b/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/combine/TestMRCombiner.java
@@ -43,9 +43,12 @@
 import org.apache.tez.runtime.library.common.sort.impl.IFile.Writer;
 import org.apache.tez.runtime.library.common.sort.impl.TezRawKeyValueIterator;
 import org.junit.Test;
-import org.mockito.Mockito;
 
 import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 public class TestMRCombiner {
 
@@ -56,7 +59,7 @@
     conf.setClass("mapred.combiner.class", OldReducer.class, Object.class);
     TaskContext taskContext = getTaskContext(conf);
     MRCombiner combiner = new MRCombiner(taskContext);
-    Writer writer = Mockito.mock(Writer.class);
+    Writer writer = mock(Writer.class);
     combiner.combine(new TezRawKeyValueIteratorTest(), writer);
     long inputRecords = taskContext.getCounters().findCounter(TaskCounter.COMBINE_INPUT_RECORDS).getValue();
     long outputRecords = taskContext.getCounters().findCounter(TaskCounter.COMBINE_OUTPUT_RECORDS).getValue();
@@ -75,7 +78,7 @@
         Object.class);
     TaskContext taskContext = getTaskContext(conf);
     MRCombiner combiner = new MRCombiner(taskContext);
-    Writer writer = Mockito.mock(Writer.class);
+    Writer writer = mock(Writer.class);
     combiner.combine(new TezRawKeyValueIteratorTest(), writer);
     long inputRecords = taskContext.getCounters().findCounter(TaskCounter.COMBINE_INPUT_RECORDS).getValue();
     long outputRecords = taskContext.getCounters().findCounter(TaskCounter.COMBINE_OUTPUT_RECORDS).getValue();
@@ -92,7 +95,7 @@
     conf.setClass("mapred.combiner.class", Top2OldReducer.class, Object.class);
     TaskContext taskContext = getTaskContext(conf);
     MRCombiner combiner = new MRCombiner(taskContext);
-    Writer writer = Mockito.mock(Writer.class);
+    Writer writer = mock(Writer.class);
     combiner.combine(new TezRawKeyValueIteratorTest(), writer);
     long inputRecords = taskContext.getCounters().findCounter(TaskCounter.COMBINE_INPUT_RECORDS).getValue();
     long outputRecords = taskContext.getCounters().findCounter(TaskCounter.COMBINE_OUTPUT_RECORDS).getValue();
@@ -109,7 +112,7 @@
         Object.class);
     TaskContext taskContext = getTaskContext(conf);
     MRCombiner combiner = new MRCombiner(taskContext);
-    Writer writer = Mockito.mock(Writer.class);
+    Writer writer = mock(Writer.class);
     combiner.combine(new TezRawKeyValueIteratorTest(), writer);
     long inputRecords = taskContext.getCounters().findCounter(TaskCounter.COMBINE_INPUT_RECORDS).getValue();
     long outputRecords = taskContext.getCounters().findCounter(TaskCounter.COMBINE_OUTPUT_RECORDS).getValue();
@@ -127,20 +130,20 @@
   private TaskContext getTaskContext(TezConfiguration conf)
       throws IOException {
     UserPayload payload = TezUtils.createUserPayloadFromConf(conf);
-    TaskContext taskContext = Mockito.mock(InputContext.class);
-    Mockito.when(taskContext.getUserPayload()).thenReturn(payload);
-    Mockito.when(taskContext.getCounters()).thenReturn(new TezCounters());
-    Mockito.when(taskContext.getApplicationId()).thenReturn(
+    TaskContext taskContext = mock(InputContext.class);
+    when(taskContext.getUserPayload()).thenReturn(payload);
+    when(taskContext.getCounters()).thenReturn(new TezCounters());
+    when(taskContext.getApplicationId()).thenReturn(
         ApplicationId.newInstance(123456, 1));
     return taskContext;
   }
 
   private void verifyKeyAndValues(Writer writer) throws IOException {
-    Mockito.verify(writer, Mockito.atLeastOnce()).append(new Text("tez"),
+    verify(writer, atLeastOnce()).append(new Text("tez"),
         new IntWritable(3));
-    Mockito.verify(writer, Mockito.atLeastOnce()).append(new Text("apache"),
+    verify(writer, atLeastOnce()).append(new Text("apache"),
         new IntWritable(1));
-    Mockito.verify(writer, Mockito.atLeastOnce()).append(new Text("hadoop"),
+    verify(writer, atLeastOnce()).append(new Text("hadoop"),
         new IntWritable(2));
   }
 
diff --git a/tez-plugins/tez-aux-services/pom.xml b/tez-plugins/tez-aux-services/pom.xml
index b9204d2..8b4ab74 100644
--- a/tez-plugins/tez-aux-services/pom.xml
+++ b/tez-plugins/tez-aux-services/pom.xml
@@ -124,7 +124,7 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
    <dependency>
diff --git a/tez-plugins/tez-aux-services/src/test/java/org/apache/tez/auxservices/TestShuffleHandler.java b/tez-plugins/tez-aux-services/src/test/java/org/apache/tez/auxservices/TestShuffleHandler.java
index b91e0eb..40b1685 100644
--- a/tez-plugins/tez-aux-services/src/test/java/org/apache/tez/auxservices/TestShuffleHandler.java
+++ b/tez-plugins/tez-aux-services/src/test/java/org/apache/tez/auxservices/TestShuffleHandler.java
@@ -26,6 +26,9 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeTrue;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -97,7 +100,6 @@
 import org.junit.Test;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
-import org.mockito.Mockito;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -1480,7 +1482,7 @@
     final ChannelHandlerContext mockCtx =
         mock(ChannelHandlerContext.class);
     final Channel mockCh = mock(AbstractChannel.class);
-    final ChannelPipeline mockPipeline = Mockito.mock(ChannelPipeline.class);
+    final ChannelPipeline mockPipeline = mock(ChannelPipeline.class);
 
     // Mock HttpRequest and ChannelFuture
     final FullHttpRequest httpRequest = createHttpRequest();
@@ -1490,11 +1492,11 @@
         new ShuffleHandler.TimeoutHandler();
 
     // Mock Netty Channel Context and Channel behavior
-    Mockito.doReturn(mockCh).when(mockCtx).channel();
-    Mockito.when(mockCh.pipeline()).thenReturn(mockPipeline);
-    Mockito.when(mockPipeline.get(Mockito.any(String.class))).thenReturn(timerHandler);
+    doReturn(mockCh).when(mockCtx).channel();
+    when(mockCh.pipeline()).thenReturn(mockPipeline);
+    when(mockPipeline.get(any(String.class))).thenReturn(timerHandler);
     when(mockCtx.channel()).thenReturn(mockCh);
-    Mockito.doReturn(mockFuture).when(mockCh).writeAndFlush(Mockito.any(Object.class));
+    doReturn(mockFuture).when(mockCh).writeAndFlush(any());
     when(mockCh.writeAndFlush(Object.class)).thenReturn(mockFuture);
 
     final ShuffleHandler sh = new MockShuffleHandler();
@@ -1570,8 +1572,8 @@
       final List<ShuffleHandler.ReduceMapFileCount> listenerList) {
     final ChannelFuture mockFuture = mock(ChannelFuture.class);
     when(mockFuture.channel()).thenReturn(mockCh);
-    Mockito.doReturn(true).when(mockFuture).isSuccess();
-    Mockito.doAnswer(new Answer<Object>() {
+    doReturn(true).when(mockFuture).isSuccess();
+    doAnswer(new Answer<Object>() {
       @Override
       public Object answer(InvocationOnMock invocation) throws Throwable {
         //Add ReduceMapFileCount listener to a list
@@ -1581,7 +1583,7 @@
               invocation.getArguments()[0]);
         return null;
       }
-    }).when(mockFuture).addListener(Mockito.any(
+    }).when(mockFuture).addListener(any(
         ShuffleHandler.ReduceMapFileCount.class));
     return mockFuture;
   }
diff --git a/tez-plugins/tez-history-parser/pom.xml b/tez-plugins/tez-history-parser/pom.xml
index 5240bba..f0758dc 100644
--- a/tez-plugins/tez-history-parser/pom.xml
+++ b/tez-plugins/tez-history-parser/pom.xml
@@ -132,7 +132,7 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/tez-plugins/tez-protobuf-history-plugin/pom.xml b/tez-plugins/tez-protobuf-history-plugin/pom.xml
index 9d82ed3..607a31f 100644
--- a/tez-plugins/tez-protobuf-history-plugin/pom.xml
+++ b/tez-plugins/tez-protobuf-history-plugin/pom.xml
@@ -47,7 +47,7 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
   </dependencies>
diff --git a/tez-plugins/tez-yarn-timeline-history-with-acls/pom.xml b/tez-plugins/tez-yarn-timeline-history-with-acls/pom.xml
index 50ed0bd..0b61b7d 100644
--- a/tez-plugins/tez-yarn-timeline-history-with-acls/pom.xml
+++ b/tez-plugins/tez-yarn-timeline-history-with-acls/pom.xml
@@ -126,7 +126,7 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/tez-plugins/tez-yarn-timeline-history-with-fs/pom.xml b/tez-plugins/tez-yarn-timeline-history-with-fs/pom.xml
index 4ba760f..75df73f 100644
--- a/tez-plugins/tez-yarn-timeline-history-with-fs/pom.xml
+++ b/tez-plugins/tez-yarn-timeline-history-with-fs/pom.xml
@@ -38,6 +38,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.tez</groupId>
+      <artifactId>hadoop-shim</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tez</groupId>
       <artifactId>tez-yarn-timeline-history</artifactId>
     </dependency>
     <dependency>
@@ -130,7 +134,7 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -155,4 +159,3 @@
   </build>
 
 </project>
-
diff --git a/tez-plugins/tez-yarn-timeline-history-with-fs/src/test/java/org/apache/tez/dag/history/logging/ats/TestATSV15HistoryLoggingService.java b/tez-plugins/tez-yarn-timeline-history-with-fs/src/test/java/org/apache/tez/dag/history/logging/ats/TestATSV15HistoryLoggingService.java
index 65ce91a..7ba14ff 100644
--- a/tez-plugins/tez-yarn-timeline-history-with-fs/src/test/java/org/apache/tez/dag/history/logging/ats/TestATSV15HistoryLoggingService.java
+++ b/tez-plugins/tez-yarn-timeline-history-with-fs/src/test/java/org/apache/tez/dag/history/logging/ats/TestATSV15HistoryLoggingService.java
@@ -24,10 +24,8 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.anyVararg;
 import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
@@ -42,7 +40,6 @@
 import java.util.Map;
 
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ContainerId;
@@ -53,7 +50,6 @@
 import org.apache.hadoop.yarn.api.records.timeline.TimelinePutResponse;
 import org.apache.hadoop.yarn.client.api.TimelineClient;
 import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.hadoop.yarn.security.client.TimelineDelegationTokenIdentifier;
 import org.apache.tez.common.security.DAGAccessControls;
 import org.apache.tez.common.security.HistoryACLPolicyManager;
 import org.apache.tez.dag.api.TezConfiguration;
@@ -71,7 +67,6 @@
 import org.apache.tez.dag.records.TezVertexID;
 import org.apache.tez.hadoop.shim.HadoopShim;
 import org.junit.Test;
-import org.mockito.Matchers;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 
@@ -448,17 +443,17 @@
     entityLog = new HashMap<>();
     //timelineClient.init(conf);
     when(timelineClient.getDelegationToken(anyString())).thenReturn(null);
-    when(timelineClient.renewDelegationToken(Matchers.<Token<TimelineDelegationTokenIdentifier>>any())).thenReturn(0L);
-    when(timelineClient.putEntities(Matchers.<TimelineEntity>anyVararg())).thenAnswer(new Answer() {
+    when(timelineClient.renewDelegationToken(any())).thenReturn(0L);
+    when(timelineClient.putEntities(any())).thenAnswer(new Answer() {
       @Override
       public TimelinePutResponse answer(InvocationOnMock invocation) throws Throwable {
         return putEntityHelper(DEFAULT_GROUP_ID, invocation.getArguments(), 0);
       }
     });
-    when(timelineClient.putEntities(any(ApplicationAttemptId.class), any(TimelineEntityGroupId.class), Matchers.<TimelineEntity>anyVararg())).thenAnswer(new Answer() {
+    when(timelineClient.putEntities(any(), any(), any())).thenAnswer(new Answer() {
       @Override
       public TimelinePutResponse answer(InvocationOnMock invocation) throws Throwable {
-        return putEntityHelper(invocation.getArgumentAt(1, TimelineEntityGroupId.class), invocation.getArguments(), 2);
+        return putEntityHelper(invocation.getArgument(1, TimelineEntityGroupId.class), invocation.getArguments(), 2);
       }
     });
     service.timelineClient = timelineClient;
diff --git a/tez-plugins/tez-yarn-timeline-history/pom.xml b/tez-plugins/tez-yarn-timeline-history/pom.xml
index 78b83dd..3f17e97 100644
--- a/tez-plugins/tez-yarn-timeline-history/pom.xml
+++ b/tez-plugins/tez-yarn-timeline-history/pom.xml
@@ -120,7 +120,7 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/tez-plugins/tez-yarn-timeline-history/src/test/java/org/apache/tez/dag/history/logging/ats/TestATSHistoryLoggingService.java b/tez-plugins/tez-yarn-timeline-history/src/test/java/org/apache/tez/dag/history/logging/ats/TestATSHistoryLoggingService.java
index 6603f4f..0536568 100644
--- a/tez-plugins/tez-yarn-timeline-history/src/test/java/org/apache/tez/dag/history/logging/ats/TestATSHistoryLoggingService.java
+++ b/tez-plugins/tez-yarn-timeline-history/src/test/java/org/apache/tez/dag/history/logging/ats/TestATSHistoryLoggingService.java
@@ -18,6 +18,8 @@
 
 package org.apache.tez.dag.history.logging.ats;
 
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -25,11 +27,9 @@
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.NodeId;
-import org.apache.hadoop.yarn.api.records.timeline.TimelineEntity;
 import org.apache.hadoop.yarn.client.api.TimelineClient;
 import org.apache.hadoop.yarn.util.SystemClock;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.tez.common.security.DAGAccessControls;
 import org.apache.tez.common.security.HistoryACLPolicyManager;
 import org.apache.tez.dag.api.TezConfiguration;
 import org.apache.tez.dag.api.records.DAGProtos.DAGPlan;
@@ -49,13 +49,9 @@
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
-import org.mockito.Matchers;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -102,7 +98,7 @@
     when(appContext.getCurrentDAGID()).thenReturn(null);
     when(appContext.getApplicationID()).thenReturn(appId);
     when(atsHistoryLoggingService.timelineClient.putEntities(
-        Matchers.<TimelineEntity[]>anyVararg())).thenAnswer(
+        any())).thenAnswer(
         new Answer<Object>() {
           @Override
           public Object answer(InvocationOnMock invocation) throws Throwable {
@@ -184,8 +180,7 @@
 
     atsHistoryLoggingService1.setAppContext(appContext);
     atsHistoryLoggingService1.timelineClient = mock(TimelineClient.class);
-    when(atsHistoryLoggingService1.timelineClient.putEntities(
-      Matchers.<TimelineEntity[]>anyVararg())).thenAnswer(
+    when(atsHistoryLoggingService1.timelineClient.putEntities(any())).thenAnswer(
       new Answer<Object>() {
       @Override
       public Object answer(InvocationOnMock invocation) throws Throwable {
@@ -227,12 +222,11 @@
 
   @Test(timeout=10000)
   public void testNonSessionDomains() throws Exception {
-    when(historyACLPolicyManager.setupSessionACLs((Configuration)any(), (ApplicationId)any()))
-    .thenReturn(
-        Collections.singletonMap(TezConfiguration.YARN_ATS_ACL_SESSION_DOMAIN_ID, "session-id"));
+    when(historyACLPolicyManager.setupSessionACLs(any(), any()))
+        .thenReturn(
+            Collections.singletonMap(TezConfiguration.YARN_ATS_ACL_SESSION_DOMAIN_ID, "session-id"));
     atsHistoryLoggingService.start();
-    verify(historyACLPolicyManager, times(1)).setupSessionACLs(
-        (Configuration)any(), (ApplicationId)any());
+    verify(historyACLPolicyManager, times(1)).setupSessionACLs(any(), any());
 
     // Send the event and wait for completion.
     TezDAGID dagId1 = TezDAGID.getInstance(appId, 0);
@@ -245,7 +239,7 @@
     }
     // No dag domain were created.
     verify(historyACLPolicyManager, times(0))
-      .setupSessionDAGACLs((Configuration)any(), eq(appId), eq("0"), (DAGAccessControls)any());
+            .setupSessionDAGACLs(any(), eq(appId), eq("0"), any());
 
     // All calls made with session domain id.
     verify(historyACLPolicyManager, times(6)).updateTimelineEntityDomain(any(), eq("session-id"));
@@ -253,11 +247,10 @@
 
   @Test(timeout=10000)
   public void testNonSessionDomainsFailed() throws Exception {
-    when(historyACLPolicyManager.setupSessionACLs((Configuration)any(), (ApplicationId)any()))
-    .thenThrow(new IOException());
+    when(historyACLPolicyManager.setupSessionACLs(any(), any()))
+        .thenThrow(new IOException());
     atsHistoryLoggingService.start();
-    verify(historyACLPolicyManager, times(1)).setupSessionACLs(
-        (Configuration)any(), (ApplicationId)any());
+    verify(historyACLPolicyManager, times(1)).setupSessionACLs(any(), any());
 
     // Send the event and wait for completion.
     TezDAGID dagId1 = TezDAGID.getInstance(appId, 0);
@@ -269,7 +262,7 @@
     }
     // No dag domain were created.
     verify(historyACLPolicyManager, times(0))
-      .setupSessionDAGACLs((Configuration)any(), eq(appId), eq("0"), (DAGAccessControls)any());
+        .setupSessionDAGACLs(any(), eq(appId), eq("0"), any());
 
     // All calls made with session domain id.
     verify(historyACLPolicyManager, times(0)).updateTimelineEntityDomain(any(), eq("session-id"));
@@ -278,11 +271,10 @@
 
   @Test(timeout=10000)
   public void testNonSessionDomainsAclNull() throws Exception {
-    when(historyACLPolicyManager.setupSessionACLs((Configuration)any(), (ApplicationId)any()))
-    .thenReturn(null);
+    when(historyACLPolicyManager.setupSessionACLs(any(), any()))
+        .thenReturn(null);
     atsHistoryLoggingService.start();
-    verify(historyACLPolicyManager, times(1)).setupSessionACLs(
-        (Configuration)any(), (ApplicationId)any());
+    verify(historyACLPolicyManager, times(1)).setupSessionACLs(any(), any());
 
     // Send the event and wait for completion.
     TezDAGID dagId1 = TezDAGID.getInstance(appId, 0);
@@ -295,7 +287,7 @@
     }
     // No dag domain were created.
     verify(historyACLPolicyManager, times(0))
-      .setupSessionDAGACLs((Configuration)any(), eq(appId), eq("0"), (DAGAccessControls)any());
+        .setupSessionDAGACLs(any(), eq(appId), eq("0"), any());
 
     // All calls made with session domain id.
     verify(historyACLPolicyManager, times(0)).updateTimelineEntityDomain(any(), eq("session-id"));
@@ -304,19 +296,15 @@
 
   @Test(timeout=10000)
   public void testSessionDomains() throws Exception {
-    when(historyACLPolicyManager.setupSessionACLs((Configuration)any(), (ApplicationId)any()))
-    .thenReturn(
-        Collections.singletonMap(TezConfiguration.YARN_ATS_ACL_SESSION_DOMAIN_ID, "test-domain"));
+    when(historyACLPolicyManager.setupSessionACLs(any(), any()))
+        .thenReturn(Collections.singletonMap(TezConfiguration.YARN_ATS_ACL_SESSION_DOMAIN_ID, "test-domain"));
 
-    when(historyACLPolicyManager.setupSessionDAGACLs(
-        (Configuration)any(), (ApplicationId)any(), eq("0"), (DAGAccessControls)any()))
-    .thenReturn(
-        Collections.singletonMap(TezConfiguration.YARN_ATS_ACL_DAG_DOMAIN_ID, "dag-domain"));
+    when(historyACLPolicyManager.setupSessionDAGACLs(any(), any(), eq("0"), any()))
+        .thenReturn(Collections.singletonMap(TezConfiguration.YARN_ATS_ACL_DAG_DOMAIN_ID, "dag-domain"));
 
     when(appContext.isSession()).thenReturn(true);
     atsHistoryLoggingService.start();
-    verify(historyACLPolicyManager, times(1)).setupSessionACLs((Configuration)any(),
-        (ApplicationId)any());
+    verify(historyACLPolicyManager, times(1)).setupSessionACLs(any(), any());
 
     // Send the event and wait for completion.
     TezDAGID dagId1 = TezDAGID.getInstance(appId, 0);
@@ -329,7 +317,7 @@
     }
     // No dag domain were created.
     verify(historyACLPolicyManager, times(1))
-      .setupSessionDAGACLs((Configuration)any(), eq(appId), eq("0"), (DAGAccessControls)any());
+        .setupSessionDAGACLs(any(), eq(appId), eq("0"), any());
 
     // All calls made with session domain id.
     verify(historyACLPolicyManager, times(1)).updateTimelineEntityDomain(any(), eq("test-domain"));
@@ -338,18 +326,15 @@
 
   @Test(timeout=10000)
   public void testSessionDomainsFailed() throws Exception {
-    when(historyACLPolicyManager.setupSessionACLs((Configuration)any(), (ApplicationId)any()))
-    .thenThrow(new IOException());
+    when(historyACLPolicyManager.setupSessionACLs(any(), any()))
+        .thenThrow(new IOException());
 
-    when(historyACLPolicyManager.setupSessionDAGACLs(
-        (Configuration)any(), (ApplicationId)any(), eq("0"), (DAGAccessControls)any()))
-    .thenReturn(
-        Collections.singletonMap(TezConfiguration.YARN_ATS_ACL_DAG_DOMAIN_ID, "dag-domain"));
+    when(historyACLPolicyManager.setupSessionDAGACLs(any(), any(), eq("0"), any()))
+        .thenReturn(Collections.singletonMap(TezConfiguration.YARN_ATS_ACL_DAG_DOMAIN_ID, "dag-domain"));
 
     when(appContext.isSession()).thenReturn(true);
     atsHistoryLoggingService.start();
-    verify(historyACLPolicyManager, times(1)).setupSessionACLs((Configuration)any(),
-        (ApplicationId)any());
+    verify(historyACLPolicyManager, times(1)).setupSessionACLs(any(), any());
 
     // Send the event and wait for completion.
     TezDAGID dagId1 = TezDAGID.getInstance(appId, 0);
@@ -361,27 +346,24 @@
     }
     // No dag domain were created.
     verify(historyACLPolicyManager, times(0))
-      .setupSessionDAGACLs((Configuration)any(), eq(appId), eq("0"), (DAGAccessControls)any());
+        .setupSessionDAGACLs(any(), eq(appId), eq("0"), any());
 
     // No calls were made for domains.
-    verify(historyACLPolicyManager, times(0)).updateTimelineEntityDomain(any(), (String)any());
+    verify(historyACLPolicyManager, times(0)).updateTimelineEntityDomain(any(), any());
     Assert.assertEquals(0, atsEntitiesCounter);
   }
 
   @Test(timeout=10000)
   public void testSessionDomainsDagFailed() throws Exception {
-    when(historyACLPolicyManager.setupSessionACLs((Configuration)any(), (ApplicationId)any()))
-    .thenReturn(Collections.singletonMap(
-        TezConfiguration.YARN_ATS_ACL_SESSION_DOMAIN_ID, "session-domain"));
+    when(historyACLPolicyManager.setupSessionACLs(any(), any()))
+        .thenReturn(Collections.singletonMap(TezConfiguration.YARN_ATS_ACL_SESSION_DOMAIN_ID, "session-domain"));
 
-    when(historyACLPolicyManager.setupSessionDAGACLs(
-        (Configuration)any(), (ApplicationId)any(), eq("0"), (DAGAccessControls)any()))
-    .thenThrow(new IOException());
+    when(historyACLPolicyManager.setupSessionDAGACLs(any(), any(), eq("0"), any()))
+        .thenThrow(new IOException());
 
     when(appContext.isSession()).thenReturn(true);
     atsHistoryLoggingService.start();
-    verify(historyACLPolicyManager, times(1)).setupSessionACLs((Configuration)any(),
-        (ApplicationId)any());
+    verify(historyACLPolicyManager, times(1)).setupSessionACLs(any(), any());
 
     // Send the event and wait for completion.
     TezDAGID dagId1 = TezDAGID.getInstance(appId, 0);
@@ -394,29 +376,27 @@
     }
     // DAG domain was called once.
     verify(historyACLPolicyManager, times(1))
-      .setupSessionDAGACLs((Configuration)any(), eq(appId), eq("0"), (DAGAccessControls)any());
+        .setupSessionDAGACLs(any(), eq(appId), eq("0"), any());
 
     // All calls made with session domain id.
     verify(historyACLPolicyManager, times(1))
         .updateTimelineEntityDomain(any(), eq("session-domain"));
     verify(historyACLPolicyManager, times(1))
-        .updateTimelineEntityDomain(any(), (String)any());
+        .updateTimelineEntityDomain(any(), any());
     Assert.assertEquals(1, atsEntitiesCounter);
   }
 
   @Test(timeout=10000)
   public void testSessionDomainsAclNull() throws Exception {
-    when(historyACLPolicyManager.setupSessionACLs((Configuration)any(), (ApplicationId)any()))
-    .thenReturn(null);
+    when(historyACLPolicyManager.setupSessionACLs(any(), any()))
+        .thenReturn(null);
 
-    when(historyACLPolicyManager.setupSessionDAGACLs(
-        (Configuration)any(), (ApplicationId)any(), eq("0"), (DAGAccessControls)any()))
-    .thenReturn(null);
+    when(historyACLPolicyManager.setupSessionDAGACLs(any(), any(), eq("0"), any()))
+        .thenReturn(null);
 
     when(appContext.isSession()).thenReturn(true);
     atsHistoryLoggingService.start();
-    verify(historyACLPolicyManager, times(1)).setupSessionACLs((Configuration)any(),
-        (ApplicationId)any());
+    verify(historyACLPolicyManager, times(1)).setupSessionACLs(any(), any());
 
     // Send the event and wait for completion.
     TezDAGID dagId1 = TezDAGID.getInstance(appId, 0);
@@ -429,10 +409,10 @@
     }
     // No dag domain were created.
     verify(historyACLPolicyManager, times(1))
-      .setupSessionDAGACLs((Configuration)any(), eq(appId), eq("0"), (DAGAccessControls)any());
+        .setupSessionDAGACLs(any(), eq(appId), eq("0"), any());
 
     // All calls made with session domain id.
-    verify(historyACLPolicyManager, times(0)).updateTimelineEntityDomain(any(), (String)any());
+    verify(historyACLPolicyManager, times(0)).updateTimelineEntityDomain(any(), any());
     Assert.assertEquals(6, atsEntitiesCounter);
   }
 
diff --git a/tez-runtime-internals/pom.xml b/tez-runtime-internals/pom.xml
index 65841cf..0619ca1 100644
--- a/tez-runtime-internals/pom.xml
+++ b/tez-runtime-internals/pom.xml
@@ -26,6 +26,10 @@
 
   <dependencies>
     <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.tez</groupId>
       <artifactId>tez-api</artifactId>
     </dependency>
@@ -71,7 +75,7 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/tez-runtime-internals/src/test/java/org/apache/tez/runtime/TestLogicalIOProcessorRuntimeTask.java b/tez-runtime-internals/src/test/java/org/apache/tez/runtime/TestLogicalIOProcessorRuntimeTask.java
index ba9a66d..1524cac 100644
--- a/tez-runtime-internals/src/test/java/org/apache/tez/runtime/TestLogicalIOProcessorRuntimeTask.java
+++ b/tez-runtime-internals/src/test/java/org/apache/tez/runtime/TestLogicalIOProcessorRuntimeTask.java
@@ -22,7 +22,11 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.mockito.Mockito.anyList;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.only;
+import static org.mockito.Mockito.verify;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
@@ -75,7 +79,6 @@
 import com.google.common.collect.Lists;
 import com.google.common.collect.Multimap;
 
-import org.mockito.Mockito;
 
 public class TestLogicalIOProcessorRuntimeTask {
 
@@ -190,7 +193,7 @@
     runner.call();
 
     // We verify that no events were sent
-    Mockito.verify(umbilical, Mockito.only()).addEvents(Collections.<TezEvent> emptyList());
+    verify(umbilical, only()).addEvents(Collections.<TezEvent> emptyList());
   }
 
   /**
@@ -229,7 +232,7 @@
         fail("RuntimeException should have been thrown");
       } catch (RuntimeException e) {
         // No events should be sent thorught the umbilical protocol
-        Mockito.verify(umbilical, Mockito.never()).addEvents(Mockito.anyList());
+        verify(umbilical, never()).addEvents(anyList());
       }
     } finally {
       sharedExecutor.shutdownNow();
diff --git a/tez-runtime-internals/src/test/java/org/apache/tez/runtime/task/TestTaskReporter.java b/tez-runtime-internals/src/test/java/org/apache/tez/runtime/task/TestTaskReporter.java
index 9f514f4..147d176 100644
--- a/tez-runtime-internals/src/test/java/org/apache/tez/runtime/task/TestTaskReporter.java
+++ b/tez-runtime-internals/src/test/java/org/apache/tez/runtime/task/TestTaskReporter.java
@@ -18,7 +18,7 @@
 
 package org.apache.tez.runtime.task;
 
-import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.isA;
@@ -84,7 +84,7 @@
           throw new TezUncheckedException("Invalid request id for test: " + request.getRequestId());
         }
       }
-    }).when(mockUmbilical).heartbeat(any(TezHeartbeatRequest.class));
+    }).when(mockUmbilical).heartbeat(any());
 
     TezTaskAttemptID mockTaskAttemptId = mock(TezTaskAttemptID.class);
     LogicalIOProcessorRuntimeTask mockTask = mock(LogicalIOProcessorRuntimeTask.class);
@@ -105,10 +105,10 @@
           lock.wait();
         }
       }
-      verify(mockUmbilical, times(3)).heartbeat(any(TezHeartbeatRequest.class));
+      verify(mockUmbilical, times(3)).heartbeat(any());
       Thread.sleep(200l);
       // Sleep for less than the callable sleep time. No more invocations.
-      verify(mockUmbilical, times(3)).heartbeat(any(TezHeartbeatRequest.class));
+      verify(mockUmbilical, times(3)).heartbeat(any());
     } finally {
       executor.shutdownNow();
     }
diff --git a/tez-runtime-library/pom.xml b/tez-runtime-library/pom.xml
index e43f90f..c913e87 100644
--- a/tez-runtime-library/pom.xml
+++ b/tez-runtime-library/pom.xml
@@ -102,7 +102,7 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
   </dependencies>
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestFairShuffleVertexManager.java b/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestFairShuffleVertexManager.java
index de857bc..5108b8f 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestFairShuffleVertexManager.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestFairShuffleVertexManager.java
@@ -28,7 +28,6 @@
 import org.apache.tez.dag.api.InputDescriptor;
 import org.apache.tez.dag.api.OutputDescriptor;
 import org.apache.tez.dag.api.TezUncheckedException;
-import org.apache.tez.dag.api.VertexLocationHint;
 import org.apache.tez.dag.api.VertexManagerPluginContext;
 import org.apache.tez.dag.api.event.VertexState;
 import org.apache.tez.dag.api.event.VertexStateUpdate;
@@ -311,7 +310,7 @@
 
     doAnswer(new reconfigVertexAnswer(mockContext, mockManagedVertexId,
         newEdgeManagers)).when(mockContext).reconfigureVertex(
-        anyInt(), any(VertexLocationHint.class), anyMap());
+        anyInt(), any(), anyMap());
 
     // check initialization
     manager = createFairShuffleVertexManager(conf, mockContext,
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestInputReadyVertexManager.java b/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestInputReadyVertexManager.java
index d59439e..2eaaba4 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestInputReadyVertexManager.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestInputReadyVertexManager.java
@@ -30,7 +30,6 @@
 import org.apache.tez.dag.api.InputDescriptor;
 import org.apache.tez.dag.api.OutputDescriptor;
 import org.apache.tez.dag.api.TezUncheckedException;
-import org.apache.tez.dag.api.VertexLocationHint;
 import org.apache.tez.dag.api.VertexManagerPluginContext;
 import org.apache.tez.dag.api.EdgeProperty.SchedulingType;
 import org.apache.tez.dag.api.VertexManagerPluginContext.ScheduleTaskRequest;
@@ -275,8 +274,7 @@
     } catch (TezUncheckedException e) {
       e.getMessage().contains("1-1 source vertices must have identical concurrency");
     }
-    verify(mockContext, times(1)).reconfigureVertex(anyInt(), (VertexLocationHint) any(),
-        anyMap()); // not invoked
+    verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(), any()); // not invoked
     
     when(mockContext.getVertexNumTasks(mockSrcVertexId3)).thenReturn(3);
     
@@ -288,8 +286,7 @@
     manager.onVertexStateUpdated(new VertexStateUpdate(mockSrcVertexId1, VertexState.CONFIGURED));
     manager.onVertexStateUpdated(new VertexStateUpdate(mockSrcVertexId2, VertexState.CONFIGURED));
     manager.onVertexStateUpdated(new VertexStateUpdate(mockSrcVertexId3, VertexState.CONFIGURED));
-    verify(mockContext, times(1)).reconfigureVertex(anyInt(), (VertexLocationHint) any(),
-        anyMap()); // not invoked
+    verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(), any()); // not invoked
     verify(mockContext, times(2)).doneReconfiguringVertex();
     manager.onVertexStarted(initialCompletions);
     // all 1-1 0's done but not scheduled because v1 is not done
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManager.java b/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManager.java
index b824d0b..fcbcb42 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManager.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManager.java
@@ -36,12 +36,12 @@
 import java.util.List;
 import java.util.Map;
 
-import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.anyInt;
 import static org.mockito.Mockito.anyList;
 import static org.mockito.Mockito.anyMap;
 import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -142,8 +142,8 @@
     manager.onVertexManagerEventReceived(vmEvent);
     manager.onSourceTaskCompleted(createTaskAttemptIdentifier(mockSrcVertexId2, 1));
     // Auto-reduce is triggered
-    verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(VertexLocationHint.class), anyMap());
-    verify(mockContext, times(1)).reconfigureVertex(eq(2), any(VertexLocationHint.class), anyMap());
+    verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(), anyMap());
+    verify(mockContext, times(1)).reconfigureVertex(eq(2), any(), anyMap());
     Assert.assertEquals(2, newEdgeManagers.size());
     Assert.assertEquals(0, manager.pendingTasks.size()); // all tasks scheduled
     Assert.assertEquals(2, scheduledTasks.size());
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManagerBase.java b/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManagerBase.java
index 9c3a5b3..7586624 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManagerBase.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManagerBase.java
@@ -27,7 +27,6 @@
 import org.apache.tez.dag.api.InputDescriptor;
 import org.apache.tez.dag.api.OutputDescriptor;
 import org.apache.tez.dag.api.TezUncheckedException;
-import org.apache.tez.dag.api.VertexLocationHint;
 import org.apache.tez.dag.api.VertexManagerPluginContext;
 import org.apache.tez.dag.api.event.VertexState;
 import org.apache.tez.dag.api.event.VertexStateUpdate;
@@ -114,8 +113,7 @@
     manager.onVertexStateUpdated(new VertexStateUpdate(mockSrcVertexId2, VertexState.CONFIGURED));
     manager.onVertexStateUpdated(new VertexStateUpdate(mockSrcVertexId3, VertexState.CONFIGURED));
     Assert.assertTrue(manager.pendingTasks.isEmpty());
-    verify(mockContext, times(1)).reconfigureVertex(eq(1), any
-        (VertexLocationHint.class), anyMap());
+    verify(mockContext, times(1)).reconfigureVertex(eq(1), any(), anyMap());
     verify(mockContext, times(1)).doneReconfiguringVertex(); // reconfig done
     Assert.assertTrue(scheduledTasks.size() == 1); // all tasks scheduled and parallelism changed
     scheduledTasks.clear();
@@ -153,8 +151,7 @@
     // trigger start and processing of pending notification events
     manager.onVertexStarted(emptyCompletions);
     Assert.assertTrue(manager.bipartiteSources == 2);
-    verify(mockContext, times(1)).reconfigureVertex(eq(1), any
-        (VertexLocationHint.class), anyMap());
+    verify(mockContext, times(1)).reconfigureVertex(eq(1), any(), anyMap());
     verify(mockContext, times(1)).doneReconfiguringVertex(); // reconfig done
     Assert.assertTrue(manager.pendingTasks.isEmpty());
     Assert.assertTrue(scheduledTasks.size() == 1); // all tasks scheduled and parallelism changed
@@ -322,8 +319,8 @@
     vmEvent = getVertexManagerEvent(null, 160 * MB, mockSrcVertexId2);
     manager.onVertexManagerEventReceived(vmEvent);
     Assert.assertTrue(manager.determineParallelismAndApply(0.25f)); //ensure parallelism is determined
-    verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(VertexLocationHint.class), anyMap());
-    verify(mockContext, times(1)).reconfigureVertex(eq(2), any(VertexLocationHint.class), anyMap());
+    verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(), anyMap());
+    verify(mockContext, times(1)).reconfigureVertex(eq(2), any(), anyMap());
     manager.onSourceTaskCompleted(createTaskAttemptIdentifier(mockSrcVertexId2, 0));
     Assert.assertEquals(0, manager.pendingTasks.size());
     Assert.assertEquals(2, scheduledTasks.size());
@@ -340,7 +337,7 @@
     //min/max fraction of 0.0/0.2
     manager = createManager(conf, mockContext, 0.0f, 0.2f);
     // initial invocation count == 3
-    verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(VertexLocationHint.class), anyMap());
+    verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(), anyMap());
     manager.onVertexStarted(emptyCompletions);
     manager.onVertexStateUpdated(new VertexStateUpdate(mockSrcVertexId1, VertexState.CONFIGURED));
     manager.onVertexStateUpdated(new VertexStateUpdate(mockSrcVertexId2, VertexState.CONFIGURED));
@@ -354,18 +351,18 @@
       manager.onVertexManagerEventReceived(getVertexManagerEvent(null, 10 * MB, mockSrcVertexId1));
       manager.onSourceTaskCompleted(createTaskAttemptIdentifier(mockSrcVertexId1, i));
       //should not change parallelism
-      verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(VertexLocationHint.class), anyMap());
+      verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(), anyMap());
     }
     for(int i=0;i<3;i++) {
       manager.onSourceTaskCompleted(createTaskAttemptIdentifier(mockSrcVertexId2, i));
-      verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(VertexLocationHint.class), anyMap());
+      verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(), anyMap());
     }
     //Since max threshold (40 * 0.2 = 8) is met, vertex manager should determine parallelism
     manager.onSourceTaskCompleted(createTaskAttemptIdentifier(mockSrcVertexId2, 8));
     // parallelism updated
-    verify(mockContext, times(2)).reconfigureVertex(anyInt(), any(VertexLocationHint.class), anyMap());
+    verify(mockContext, times(2)).reconfigureVertex(anyInt(), any(), anyMap());
     // check exact update value - 8 events with 100 each => 20 -> 2000 => 2 tasks (with 1000 per task)
-    verify(mockContext, times(2)).reconfigureVertex(eq(2), any(VertexLocationHint.class), anyMap());
+    verify(mockContext, times(2)).reconfigureVertex(eq(2), any(), anyMap());
   }
 
   @Test(timeout = 5000)
@@ -418,8 +415,8 @@
 
     manager.onSourceTaskCompleted(createTaskAttemptIdentifier(mockSrcVertexId2, 1));
     // managedVertex tasks reduced
-    verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(VertexLocationHint.class), anyMap());
-    verify(mockContext, times(1)).reconfigureVertex(eq(2), any(VertexLocationHint.class), anyMap());
+    verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(), anyMap());
+    verify(mockContext, times(1)).reconfigureVertex(eq(2), any(), anyMap());
     Assert.assertEquals(2, newEdgeManagers.size());
     // TODO improve tests for parallelism
     Assert.assertEquals(0, manager.pendingTasks.size()); // all tasks scheduled
@@ -432,7 +429,7 @@
 
     // more completions dont cause recalculation of parallelism
     manager.onSourceTaskCompleted(createTaskAttemptIdentifier(mockSrcVertexId2, 0));
-    verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(VertexLocationHint.class), anyMap());
+    verify(mockContext, times(1)).reconfigureVertex(anyInt(), any(), anyMap());
     Assert.assertEquals(2, newEdgeManagers.size());
 
     EdgeManagerPluginOnDemand edgeManager =
@@ -493,7 +490,7 @@
     String mockManagedVertexId = "Vertex4";
 
     VertexManagerPluginContext mockContext = mock(VertexManagerPluginContext.class);
-    when(mockContext.getVertexStatistics(any(String.class))).thenReturn(mock(VertexStatistics.class));
+    when(mockContext.getVertexStatistics(any())).thenReturn(mock(VertexStatistics.class));
     when(mockContext.getInputVertexEdgeProperties()).thenReturn(mockInputVertices);
     when(mockContext.getVertexName()).thenReturn(mockManagedVertexId);
     when(mockContext.getVertexNumTasks(mockManagedVertexId)).thenReturn(3);
@@ -877,8 +874,7 @@
     Assert.assertTrue(manager.totalNumBipartiteSourceTasks == 6);
 
     //Ensure that setVertexParallelism is not called for R2.
-    verify(mockContext_R2, times(0)).reconfigureVertex(anyInt(), any(VertexLocationHint.class),
-        anyMap());
+    verify(mockContext_R2, times(0)).reconfigureVertex(anyInt(), any(), anyMap());
 
     //ShuffleVertexManager's updatePendingTasks relies on getVertexNumTasks. Setting this for test
     when(mockContext_R2.getVertexNumTasks(mockManagedVertexId_R2)).thenReturn(1);
@@ -886,9 +882,8 @@
     // complete configuration of r1 triggers the scheduling
     manager.onVertexStateUpdated(new VertexStateUpdate(r1, VertexState.CONFIGURED));
     Assert.assertTrue(manager.totalNumBipartiteSourceTasks == 9);
-    verify(mockContext_R2, times(1)).reconfigureVertex(eq(1), any(VertexLocationHint.class),
-        anyMap());
-  
+    verify(mockContext_R2, times(1)).reconfigureVertex(eq(1), any(), anyMap());
+
     Assert.assertTrue(manager.pendingTasks.size() == 0); // all tasks scheduled
     Assert.assertTrue(scheduledTasks.size() == 1);
 
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManagerUtils.java b/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManagerUtils.java
index 9281222..44adc46 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManagerUtils.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/dag/library/vertexmanager/TestShuffleVertexManagerUtils.java
@@ -32,7 +32,6 @@
 import org.apache.tez.dag.api.InputDescriptor;
 import org.apache.tez.dag.api.OutputDescriptor;
 import org.apache.tez.dag.api.UserPayload;
-import org.apache.tez.dag.api.VertexLocationHint;
 import org.apache.tez.dag.api.VertexManagerPluginContext;
 import org.apache.tez.dag.library.vertexmanager.FairShuffleVertexManager.FairRoutingType;
 import org.apache.tez.dag.library.vertexmanager.FairShuffleVertexManager.FairShuffleVertexManagerConfigBuilder;
@@ -56,10 +55,10 @@
 import java.util.List;
 import java.util.Map;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyList;
-import static org.mockito.Matchers.anyMap;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyList;
+import static org.mockito.Mockito.anyMap;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -113,7 +112,7 @@
         mockContext).scheduleTasks(anyList());
     doAnswer(new reconfigVertexAnswer(mockContext, mockManagedVertexId,
         newEdgeManagers)).when(mockContext).reconfigureVertex(
-        anyInt(), any(VertexLocationHint.class), anyMap());
+        anyInt(), any(), anyMap());
     return mockContext;
   }
 
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/cartesianproduct/TestCartesianProductVertexManagerPartitioned.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/cartesianproduct/TestCartesianProductVertexManagerPartitioned.java
index 1012a36..a77e2c7 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/cartesianproduct/TestCartesianProductVertexManagerPartitioned.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/cartesianproduct/TestCartesianProductVertexManagerPartitioned.java
@@ -21,7 +21,6 @@
 import org.apache.tez.dag.api.EdgeProperty;
 import org.apache.tez.dag.api.TezReflectionException;
 import org.apache.tez.dag.api.UserPayload;
-import org.apache.tez.dag.api.VertexLocationHint;
 import org.apache.tez.dag.api.VertexManagerPluginContext;
 import org.apache.tez.dag.api.VertexManagerPluginContext.ScheduleTaskRequest;
 import org.apache.tez.dag.api.event.VertexState;
@@ -37,7 +36,6 @@
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Captor;
-import org.mockito.Matchers;
 import org.mockito.MockitoAnnotations;
 
 import java.util.ArrayList;
@@ -48,8 +46,9 @@
 import static org.apache.tez.dag.api.EdgeProperty.DataMovementType.BROADCAST;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.isNull;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.isNull;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.times;
@@ -75,7 +74,7 @@
 
   private void setupWithConfig(CartesianProductConfigProto config)
     throws TezReflectionException {
-    MockitoAnnotations.initMocks(this);
+    MockitoAnnotations.openMocks(this);
     context = mock(VertexManagerPluginContext.class);
     when(context.getVertexName()).thenReturn("cp");
     when(context.getVertexNumTasks("cp")).thenReturn(-1);
@@ -110,7 +109,7 @@
 
     vertexManager.onVertexStateUpdated(new VertexStateUpdate("v0", VertexState.CONFIGURED));
     verify(context, times(1)).reconfigureVertex(parallelismCaptor.capture(),
-      isNull(VertexLocationHint.class), edgePropertiesCaptor.capture());
+        isNull(), edgePropertiesCaptor.capture());
     assertEquals((int)parallelismCaptor.getValue(), parallelism);
     assertNull(edgePropertiesCaptor.getValue());
   }
@@ -134,12 +133,12 @@
 
     vertexManager.onSourceTaskCompleted(allCompletions.get(0));
     vertexManager.onSourceTaskCompleted(allCompletions.get(1));
-    verify(context, never()).scheduleTasks(Matchers.<List<ScheduleTaskRequest>>any());
+    verify(context, never()).scheduleTasks(any());
 
     List<ScheduleTaskRequest> scheduleTaskRequests;
     vertexManager.onSourceTaskCompleted(allCompletions.get(2));
     // shouldn't start schedule because broadcast src is not in RUNNING state
-    verify(context, never()).scheduleTasks(Matchers.<List<ScheduleTaskRequest>>any());
+    verify(context, never()).scheduleTasks(any());
 
     vertexManager.onVertexStateUpdated(new VertexStateUpdate("v2", VertexState.RUNNING));
     verify(context, times(1)).scheduleTasks(scheduleTaskRequestCaptor.capture());
@@ -161,7 +160,7 @@
 
     for (int i = 6; i < 8; i++) {
       vertexManager.onSourceTaskCompleted(allCompletions.get(i));
-      verify(context, times(4)).scheduleTasks(Matchers.<List<ScheduleTaskRequest>>any());
+      verify(context, times(4)).scheduleTasks(any());
     }
   }
 
@@ -191,7 +190,7 @@
     vertexManager.onVertexStarted(completions);
 
     if (!broadcastRunning) {
-      verify(context, never()).scheduleTasks(Matchers.<List<ScheduleTaskRequest>>any());
+      verify(context, never()).scheduleTasks(any());
       vertexManager.onVertexStateUpdated(new VertexStateUpdate("v2", VertexState.RUNNING));
     }
 
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/cartesianproduct/TestFairCartesianProductVertexManager.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/cartesianproduct/TestFairCartesianProductVertexManager.java
index 6219a15..54d771a 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/cartesianproduct/TestFairCartesianProductVertexManager.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/cartesianproduct/TestFairCartesianProductVertexManager.java
@@ -22,7 +22,6 @@
 import com.google.protobuf.InvalidProtocolBufferException;
 import org.apache.tez.dag.api.EdgeManagerPluginDescriptor;
 import org.apache.tez.dag.api.EdgeProperty;
-import org.apache.tez.dag.api.VertexLocationHint;
 import org.apache.tez.dag.api.VertexManagerPluginContext;
 import org.apache.tez.dag.api.VertexManagerPluginContext.ScheduleTaskRequest;
 import org.apache.tez.dag.api.event.VertexState;
@@ -52,10 +51,10 @@
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyMapOf;
-import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyMap;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.times;
@@ -72,7 +71,7 @@
 
   @Before
   public void setup() {
-    MockitoAnnotations.initMocks(this);
+    MockitoAnnotations.openMocks(this);
     ctx = mock(VertexManagerPluginContext.class);
     vertexManager = new FairCartesianProductVertexManager(ctx);
   }
@@ -224,11 +223,11 @@
 
     vertexManager.onVertexManagerEventReceived(getVMEvent(250, "v0", 0));
     verify(ctx, never()).reconfigureVertex(
-      anyInt(), any(VertexLocationHint.class), anyMapOf(String.class, EdgeProperty.class));
+            anyInt(), any(), anyMap());
 
     vertexManager.onVertexManagerEventReceived(getVMEvent(200, "v1", 0));
     verify(ctx, times(1)).reconfigureVertex(
-      eq(30), any(VertexLocationHint.class), edgePropertiesCaptor.capture());
+        eq(30), any(), edgePropertiesCaptor.capture());
     Map<String, EdgeProperty> edgeProperties = edgePropertiesCaptor.getValue();
     verifyEdgeProperties(edgeProperties.get("v0"), new String[]{"v0", "v1"}, new int[]{5, 6}, 30);
     verifyVertexGroupInfo(edgeProperties.get("v0"), 0);
@@ -259,7 +258,7 @@
     }
 
     verify(ctx, times(1)).reconfigureVertex(
-      eq(12), any(VertexLocationHint.class), edgePropertiesCaptor.capture());
+        eq(12), any(), edgePropertiesCaptor.capture());
     Map<String, EdgeProperty> edgeProperties = edgePropertiesCaptor.getValue();
     verifyEdgeProperties(edgeProperties.get("v0"), new String[]{"v0", "v1"}, new int[]{4, 3}, 100);
     verifyEdgeProperties(edgeProperties.get("v1"), new String[]{"v0", "v1"}, new int[]{4, 3}, 100);
@@ -289,7 +288,7 @@
     vertexManager.onVertexManagerEventReceived(getVMEvent(5, "v2", 0));
     vertexManager.onVertexManagerEventReceived(getVMEvent(5, "v2", 1));
     verify(ctx, times(1)).reconfigureVertex(
-      eq(100), any(VertexLocationHint.class), edgePropertiesCaptor.capture());
+        eq(100), any(), edgePropertiesCaptor.capture());
     Map<String, EdgeProperty> edgeProperties = edgePropertiesCaptor.getValue();
     for (int i = 0; i < 3; i++) {
       verifyEdgeProperties(edgeProperties.get("v" + i), new String[]{"v0", "g0"},
@@ -323,7 +322,7 @@
     vertexManager.onVertexManagerEventReceived(getVMEvent(16, "v3", 0));
 
     verify(ctx, times(1)).reconfigureVertex(
-      eq(100), any(VertexLocationHint.class), edgePropertiesCaptor.capture());
+        eq(100), any(), edgePropertiesCaptor.capture());
     Map<String, EdgeProperty> edgeProperties = edgePropertiesCaptor.getValue();
     for (int i = 0; i < 4; i++) {
       verifyEdgeProperties(edgeProperties.get("v" + i), new String[]{"g0", "g1"},
@@ -352,7 +351,7 @@
     vertexManager.onVertexManagerEventReceived(getVMEvent(250, "v0", 0));
     vertexManager.onVertexManagerEventReceived(getVMEvent(200, "v1", 0));
     verify(ctx, times(1)).reconfigureVertex(
-      eq(30), any(VertexLocationHint.class), edgePropertiesCaptor.capture());
+        eq(30), any(), edgePropertiesCaptor.capture());
     assertFalse(edgePropertiesCaptor.getValue().containsKey("v2"));
 
     vertexManager.onVertexStarted(null);
@@ -400,7 +399,7 @@
     vertexManager.initialize(config);
     vertexManager.onVertexStateUpdated(new VertexStateUpdate("v0", VertexState.CONFIGURED));
     vertexManager.onVertexStateUpdated(new VertexStateUpdate("v1", VertexState.CONFIGURED));
-    vertexManager.onVertexStarted(new ArrayList<TaskAttemptIdentifier>());
+    vertexManager.onVertexStarted(new ArrayList<>());
     vertexManager.onSourceTaskCompleted(getTaId("v0", 0));
     vertexManager.onSourceTaskCompleted(getTaId("v0", 1));
   }
@@ -430,11 +429,11 @@
       vertexManager.onSourceTaskCompleted(getTaId("v1", i));
     }
     verify(ctx, never()).reconfigureVertex(
-      anyInt(), any(VertexLocationHint.class), anyMapOf(String.class, EdgeProperty.class));
+        anyInt(), any(), anyMap());
 
     vertexManager.onSourceTaskCompleted(getTaId("v1", 14));
     verify(ctx, times(1)).reconfigureVertex(
-      eq(24), any(VertexLocationHint.class), edgePropertiesCaptor.capture());
+        eq(24), any(), edgePropertiesCaptor.capture());
   }
 
   @Test(timeout = 5000)
@@ -448,7 +447,7 @@
       vertexManager.onSourceTaskCompleted(getTaId("v1", i));
     }
     verify(ctx, never()).reconfigureVertex(
-      anyInt(), any(VertexLocationHint.class), anyMapOf(String.class, EdgeProperty.class));
+        anyInt(), any(), anyMap());
   }
 
   @Test(timeout = 5000)
@@ -462,7 +461,7 @@
       vertexManager.onSourceTaskCompleted(getTaId("v1", i));
     }
     verify(ctx, times(1)).reconfigureVertex(
-      eq(0), any(VertexLocationHint.class), edgePropertiesCaptor.capture());
+        eq(0), any(), edgePropertiesCaptor.capture());
   }
 
   @Test(timeout = 5000)
@@ -476,7 +475,7 @@
     vertexManager.onVertexManagerEventReceived(getVMEvent(0, "v1", 1));
     vertexManager.onVertexManagerEventReceived(getVMEvent(0, "v1", 2));
     verify(ctx, times(1)).reconfigureVertex(
-      eq(0), any(VertexLocationHint.class), edgePropertiesCaptor.capture());
+        eq(0), any(), edgePropertiesCaptor.capture());
   }
 
   @Test(timeout = 5000)
@@ -495,7 +494,7 @@
     vertexManager.onVertexManagerEventReceived(getVMEvent(250, "v0", 0));
     vertexManager.onVertexManagerEventReceived(getVMEvent(200, "v1", 0));
     verify(ctx, times(1)).reconfigureVertex(
-      eq(6), any(VertexLocationHint.class), edgePropertiesCaptor.capture());
+        eq(6), any(), edgePropertiesCaptor.capture());
   }
 
   @Test(timeout = 5000)
@@ -511,7 +510,7 @@
     }
 
     verify(ctx, times(1)).reconfigureVertex(
-      eq(99), any(VertexLocationHint.class), edgePropertiesCaptor.capture());
+        eq(99), any(), edgePropertiesCaptor.capture());
     Map<String, EdgeProperty> edgeProperties = edgePropertiesCaptor.getValue();
     verifyEdgeProperties(edgeProperties.get("v0"), new String[]{"v0", "v1"},
       new int[]{99, 1}, 100);
@@ -539,9 +538,9 @@
     }
 
     verify(ctx, times(1)).reconfigureVertex(
-      eq(93), any(VertexLocationHint.class), edgePropertiesCaptor.capture());
+        eq(93), any(), edgePropertiesCaptor.capture());
     Map<String, EdgeProperty> edgeProperties = edgePropertiesCaptor.getValue();
     verifyEdgeProperties(edgeProperties.get("v0"), new String[]{"v0", "v1", "v2"},
       new int[]{31, 3, 1}, 100);
   }
-}
\ No newline at end of file
+}
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/TestFetcher.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/TestFetcher.java
index 338f640..efba8ea 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/TestFetcher.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/TestFetcher.java
@@ -20,14 +20,15 @@
 
 import org.apache.hadoop.fs.RawLocalFileSystem;
 import org.apache.tez.runtime.library.common.CompositeInputAttemptIdentifier;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
+
 import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyLong;
+import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
@@ -193,7 +194,7 @@
         Object[] args = invocation.getArguments();
         return new Path(SHUFFLE_INPUT_FILE_PREFIX + args[0]);
       }
-    }).when(fetcher).getShuffleInputFileName(anyString(), anyString());
+    }).when(fetcher).getShuffleInputFileName(anyString(), any());
 
     doAnswer(new Answer<TezIndexRecord>() {
       @Override
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/TestShuffleUtils.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/TestShuffleUtils.java
index 446801a..3363cb6 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/TestShuffleUtils.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/TestShuffleUtils.java
@@ -36,7 +36,7 @@
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
 import org.slf4j.Logger;
 
 import java.io.ByteArrayInputStream;
@@ -257,28 +257,28 @@
         outputContext, spillId, new TezSpillRecord(indexFile, conf),
             physicalOutputs, true, pathComponent, null, false, auxiliaryService, TezCommonUtils.newBestCompressionDeflater());
 
-    Assert.assertTrue(events.size() == 2); //one for VM
+    Assert.assertEquals(2, events.size()); //one for VM
     Assert.assertTrue(events.get(0) instanceof VertexManagerEvent);
     Assert.assertTrue(events.get(1) instanceof CompositeDataMovementEvent);
 
     CompositeDataMovementEvent cdme = (CompositeDataMovementEvent) events.get(1);
-    Assert.assertTrue(cdme.getCount() == physicalOutputs);
-    Assert.assertTrue(cdme.getSourceIndexStart() == 0);
+    Assert.assertEquals(cdme.getCount(), physicalOutputs);
+    Assert.assertEquals(0, cdme.getSourceIndexStart());
 
     ShuffleUserPayloads.DataMovementEventPayloadProto dmeProto =
         ShuffleUserPayloads.DataMovementEventPayloadProto.parseFrom(ByteString.copyFrom( cdme.getUserPayload()));
 
     //spill details should be present
-    Assert.assertTrue(dmeProto.getSpillId() == 0);
+    Assert.assertEquals(0, dmeProto.getSpillId());
     Assert.assertTrue(dmeProto.hasLastEvent() && dmeProto.getLastEvent());
 
-    Assert.assertTrue(dmeProto.getPathComponent().equals(""));
+    Assert.assertEquals("", dmeProto.getPathComponent());
 
     byte[]  emptyPartitions = TezCommonUtils.decompressByteStringToByteArray(dmeProto
         .getEmptyPartitions());
     BitSet  emptyPartitionsBitSet = TezUtilsInternal.fromByteArray(emptyPartitions);
-    Assert.assertTrue("emptyPartitionBitSet cardinality (expecting 10) = " + emptyPartitionsBitSet
-        .cardinality(), emptyPartitionsBitSet.cardinality() == 10);
+    Assert.assertEquals("emptyPartitionBitSet cardinality (expecting 10) = " + emptyPartitionsBitSet
+            .cardinality(), 10, emptyPartitionsBitSet.cardinality());
 
   }
 
@@ -289,10 +289,10 @@
     when(mockCodecStream.read(any(byte[].class), anyInt(), anyInt()))
         .thenThrow(new InternalError(codecErrorMsg));
     Decompressor mockDecoder = mock(Decompressor.class);
-    CompressionCodec mockCodec = mock(ConfigurableCodecForTest.class);
-    when(((ConfigurableCodecForTest) mockCodec).getConf()).thenReturn(mock(Configuration.class));
+    ConfigurableCodecForTest mockCodec = mock(ConfigurableCodecForTest.class);
+    when(mockCodec.getConf()).thenReturn(mock(Configuration.class));
     when(mockCodec.createDecompressor()).thenReturn(mockDecoder);
-    when(mockCodec.createInputStream(any(InputStream.class), any(Decompressor.class)))
+    when(mockCodec.createInputStream(any(), any()))
         .thenReturn(mockCodecStream);
     byte[] header = new byte[] { (byte) 'T', (byte) 'I', (byte) 'F', (byte) 1};
     try {
@@ -312,10 +312,10 @@
     when(mockCodecStream.read(any(byte[].class), anyInt(), anyInt()))
         .thenThrow(new IllegalArgumentException(codecErrorMsg));
     Decompressor mockDecoder = mock(Decompressor.class);
-    CompressionCodec mockCodec = mock(ConfigurableCodecForTest.class);
-    when(((ConfigurableCodecForTest) mockCodec).getConf()).thenReturn(mock(Configuration.class));
+    ConfigurableCodecForTest mockCodec = mock(ConfigurableCodecForTest.class);
+    when(mockCodec.getConf()).thenReturn(mock(Configuration.class));
     when(mockCodec.createDecompressor()).thenReturn(mockDecoder);
-    when(mockCodec.createInputStream(any(InputStream.class), any(Decompressor.class)))
+    when(mockCodec.createInputStream(any(), any()))
         .thenReturn(mockCodecStream);
     byte[] header = new byte[] { (byte) 'T', (byte) 'I', (byte) 'F', (byte) 1};
     try {
@@ -329,10 +329,10 @@
     CompressionInputStream mockCodecStream1 = mock(CompressionInputStream.class);
     when(mockCodecStream1.read(any(byte[].class), anyInt(), anyInt()))
         .thenThrow(new SocketTimeoutException(codecErrorMsg));
-    CompressionCodec mockCodec1 = mock(ConfigurableCodecForTest.class);
-    when(((ConfigurableCodecForTest) mockCodec1).getConf()).thenReturn(mock(Configuration.class));
+    ConfigurableCodecForTest mockCodec1 = mock(ConfigurableCodecForTest.class);
+    when(mockCodec1.getConf()).thenReturn(mock(Configuration.class));
     when(mockCodec1.createDecompressor()).thenReturn(mockDecoder);
-    when(mockCodec1.createInputStream(any(InputStream.class), any(Decompressor.class)))
+    when(mockCodec1.createInputStream(any(), any()))
         .thenReturn(mockCodecStream1);
     try {
       ShuffleUtils.shuffleToMemory(new byte[1024], new ByteArrayInputStream(header),
@@ -345,10 +345,10 @@
     CompressionInputStream mockCodecStream2 = mock(CompressionInputStream.class);
     when(mockCodecStream2.read(any(byte[].class), anyInt(), anyInt()))
         .thenThrow(new InternalError(codecErrorMsg));
-    CompressionCodec mockCodec2 = mock(ConfigurableCodecForTest.class);
-    when(((ConfigurableCodecForTest) mockCodec2).getConf()).thenReturn(mock(Configuration.class));
+    ConfigurableCodecForTest mockCodec2 = mock(ConfigurableCodecForTest.class);
+    when(mockCodec2.getConf()).thenReturn(mock(Configuration.class));
     when(mockCodec2.createDecompressor()).thenReturn(mockDecoder);
-    when(mockCodec2.createInputStream(any(InputStream.class), any(Decompressor.class)))
+    when(mockCodec2.createInputStream(any(), any()))
         .thenReturn(mockCodecStream2);
     try {
       ShuffleUtils.shuffleToMemory(new byte[1024], new ByteArrayInputStream(header),
@@ -394,14 +394,14 @@
       logger.logIndividualFetchComplete(10, 100, 1000, "testType", ident);
     }
     verify(activeLogger, times(0)).info(anyString());
-    verify(aggregateLogger, times(1)).info(anyString(), Matchers.<Object[]>anyVararg());
+    verify(aggregateLogger, times(1)).info(anyString(), ArgumentMatchers.<Object[]>any());
 
     when(activeLogger.isInfoEnabled()).thenReturn(true);
     for (int i = 0; i < 1000; i++) {
       logger.logIndividualFetchComplete(10, 100, 1000, "testType", ident);
     }
     verify(activeLogger, times(1000)).info(anyString());
-    verify(aggregateLogger, times(1)).info(anyString(), Matchers.<Object[]>anyVararg());
+    verify(aggregateLogger, times(1)).info(anyString(), ArgumentMatchers.<Object[]>any());
   }
 
   /**
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/impl/TestShuffleInputEventHandlerImpl.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/impl/TestShuffleInputEventHandlerImpl.java
index 8a774dc..9f6b4a3 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/impl/TestShuffleInputEventHandlerImpl.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/impl/TestShuffleInputEventHandlerImpl.java
@@ -18,11 +18,11 @@
 
 package org.apache.tez.runtime.library.common.shuffle.impl;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
@@ -199,8 +199,8 @@
           @Override
           public ExecutorService answer(InvocationOnMock invocation) throws Throwable {
             return sharedExecutor.createExecutorService(
-                invocation.getArgumentAt(0, Integer.class),
-                invocation.getArgumentAt(1, String.class));
+                invocation.getArgument(0, Integer.class),
+                invocation.getArgument(1, String.class));
           }
         });
     return inputContext;
@@ -265,7 +265,7 @@
     //0--> 1 with spill id 1 (attemptNum 1).  This should report exception
     dme = createDataMovementEvent(true, 0, 1, 1, false, new BitSet(), 4, 1);
     handler.handleEvents(Collections.singletonList(dme));
-    verify(inputContext).killSelf(any(Throwable.class), anyString());
+    verify(inputContext).killSelf(any(), anyString());
   }
 
   /**
@@ -297,7 +297,7 @@
     //Now send attemptNum 0.  This should throw exception, because attempt #1 is already added
     dme = createDataMovementEvent(true, 0, 1, 0, false, new BitSet(), 4, 0);
     handler.handleEvents(Collections.singletonList(dme));
-    verify(inputContext).killSelf(any(Throwable.class), anyString());
+    verify(inputContext).killSelf(any(), anyString());
   }
 
   /**
@@ -338,7 +338,7 @@
     //Now send attemptNum 1.  This should throw exception, because attempt #1 is already added
     dme = createDataMovementEvent(true, 0, 1, 0, false, new BitSet(), 4, 1);
     handler.handleEvents(Collections.singletonList(dme));
-    verify(inputContext).killSelf(any(Throwable.class), anyString());
+    verify(inputContext).killSelf(any(), anyString());
   }
 
   private Event createDataMovementEvent(boolean addSpillDetails, int srcIdx, int targetIdx,
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/impl/TestShuffleManager.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/impl/TestShuffleManager.java
index fda2c89..ba854b9 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/impl/TestShuffleManager.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/impl/TestShuffleManager.java
@@ -20,9 +20,9 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.atLeast;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
@@ -179,8 +179,8 @@
           @Override
           public ExecutorService answer(InvocationOnMock invocation) throws Throwable {
             return sharedExecutor.createExecutorService(
-                invocation.getArgumentAt(0, Integer.class),
-                invocation.getArgumentAt(1, String.class));
+                invocation.getArgument(0, Integer.class),
+                invocation.getArgument(1, String.class));
           }
         });
     return inputContext;
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestFetcher.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestFetcher.java
index f283780..068c8f7 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestFetcher.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestFetcher.java
@@ -19,15 +19,15 @@
 package org.apache.tez.runtime.library.common.shuffle.orderedgrouped;
 
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyBoolean;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyBoolean;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyLong;
+import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
@@ -163,7 +163,7 @@
     spyFetcher.fetchNext();
 
     verify(spyFetcher, times(1)).setupLocalDiskFetch(mapHost);
-    verify(spyFetcher, never()).copyFromHost(any(MapHost.class));
+    verify(spyFetcher, never()).copyFromHost(any());
 
     // if hostname does not match use http
     mapHost = new MapHost(HOST + "_OTHER", PORT, 0, 1);
@@ -177,7 +177,7 @@
 
     spyFetcher.fetchNext();
 
-    verify(spyFetcher, never()).setupLocalDiskFetch(any(MapHost.class));
+    verify(spyFetcher, never()).setupLocalDiskFetch(any());
     verify(spyFetcher, times(1)).copyFromHost(mapHost);
 
     // if port does not match use http
@@ -192,7 +192,7 @@
 
     spyFetcher.fetchNext();
 
-    verify(spyFetcher, never()).setupLocalDiskFetch(any(MapHost.class));
+    verify(spyFetcher, never()).setupLocalDiskFetch(any());
     verify(spyFetcher, times(1)).copyFromHost(mapHost);
 
     //if local fetch is not enabled
@@ -266,8 +266,8 @@
         return mapOutput;
       }
     }).when(spyFetcher)
-        .getMapOutputForDirectDiskFetch(any(InputAttemptIdentifier.class), any(Path.class),
-            any(TezIndexRecord.class));
+        .getMapOutputForDirectDiskFetch(any(), any(),
+            any());
 
     doAnswer(new Answer<Path>() {
       @Override
@@ -275,7 +275,7 @@
         Object[] args = invocation.getArguments();
         return new Path(SHUFFLE_INPUT_FILE_PREFIX + args[0]);
       }
-    }).when(spyFetcher).getShuffleInputFileName(anyString(), anyString());
+    }).when(spyFetcher).getShuffleInputFileName(any(), any());
 
     for (int i = 0; i < host.getPartitionCount(); i++) {
       doAnswer(new Answer<TezIndexRecord>() {
@@ -291,7 +291,7 @@
           // match with params for copySucceeded below.
           return new TezIndexRecord(p * 10, (p+1) * 1000, (p+2) * 100);
         }
-      }).when(spyFetcher).getIndexRecord(anyString(), eq(host.getPartitionId() + i));
+      }).when(spyFetcher).getIndexRecord(any(), eq(host.getPartitionId() + i));
     }
 
     doNothing().when(scheduler).copySucceeded(any(InputAttemptIdentifier.class), any(MapHost.class),
@@ -369,7 +369,7 @@
         Object[] args = invocation.getArguments();
         return new Path(SHUFFLE_INPUT_FILE_PREFIX + args[0]);
       }
-    }).when(spyFetcher).getShuffleInputFileName(anyString(), anyString());
+    }).when(spyFetcher).getShuffleInputFileName(any(), anyString());
 
     for (int i = 0; i < host.getPartitionCount(); i++) {
       doAnswer(new Answer<TezIndexRecord>() {
@@ -459,7 +459,7 @@
         Object[] args = invocation.getArguments();
         return new Path(SHUFFLE_INPUT_FILE_PREFIX + args[0]);
       }
-    }).when(spyFetcher).getShuffleInputFileName(anyString(), anyString());
+    }).when(spyFetcher).getShuffleInputFileName(any(), any());
 
     for (int i = 0; i < host.getPartitionCount(); i++) {
       doAnswer(new Answer<TezIndexRecord>() {
@@ -477,7 +477,7 @@
           // match with params for copySucceeded below.
           return new TezIndexRecord(p * 10, (p + 1) * 1000, (p + 2) * 100);
         }
-      }).when(spyFetcher).getIndexRecord(anyString(), eq(host.getPartitionId() + i));
+      }).when(spyFetcher).getIndexRecord(any(), eq(host.getPartitionId() + i));
     }
 
     doNothing().when(scheduler).copySucceeded(any(InputAttemptIdentifier.class), any(MapHost.class),
@@ -591,7 +591,7 @@
         new InputAttemptIdentifier(3, 4, InputAttemptIdentifier.PATH_PREFIX + "pathComponent_3")
     );
     doReturn(srcAttempts).when(scheduler).getMapsForHost(host);
-    doReturn(true).when(fetcher).setupConnection(any(MapHost.class), any(Collection.class));
+    doReturn(true).when(fetcher).setupConnection(any(), any());
 
     URL url = ShuffleUtils.constructInputURL("http://" + HOST + ":" + PORT + "/mapOutput?job=job_123&&reduce=1&map=", srcAttempts, false);
     fetcher.httpConnection = new FakeHttpConnection(url, null, "", null);
@@ -605,7 +605,7 @@
         doReturn(args[0]).when(mapOutput).getAttemptIdentifier();
         return mapOutput;
       }
-    }).when(merger).reserve(any(InputAttemptIdentifier.class), anyInt(), anyInt(), anyInt());
+    }).when(merger).reserve(any(), anyInt(), anyInt(), anyInt());
 
     //Create read timeout when reading data
     doAnswer(new Answer<Void>() {
@@ -614,7 +614,7 @@
         // Simulate read timeout by throwing proper exception
         throw new FetcherReadTimeoutException("creating fetcher socket read timeout exception");
       }
-    }).when(fetcher).copyMapOutput(any(MapHost.class), any(DataInputStream.class), any(InputAttemptIdentifier.class));
+    }).when(fetcher).copyMapOutput(any(), any(), any());
 
     try {
       fetcher.copyFromHost(host);
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestShuffle.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestShuffle.java
index 0a9c37e..590affc 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestShuffle.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestShuffle.java
@@ -16,10 +16,10 @@
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -160,8 +160,8 @@
           @Override
           public ExecutorService answer(InvocationOnMock invocation) throws Throwable {
             return sharedExecutor.createExecutorService(
-                invocation.getArgumentAt(0, Integer.class),
-                invocation.getArgumentAt(1, String.class));
+                invocation.getArgument(0, Integer.class),
+                invocation.getArgument(1, String.class));
           }
         });
     return inputContext;
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestShuffleInputEventHandlerOrderedGrouped.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestShuffleInputEventHandlerOrderedGrouped.java
index cf4ff6a..8da4adc 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestShuffleInputEventHandlerOrderedGrouped.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestShuffleInputEventHandlerOrderedGrouped.java
@@ -37,11 +37,11 @@
 import java.util.concurrent.ExecutorService;
 
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
@@ -95,8 +95,8 @@
           @Override
           public ExecutorService answer(InvocationOnMock invocation) throws Throwable {
             return sharedExecutor.createExecutorService(
-                invocation.getArgumentAt(0, Integer.class),
-                invocation.getArgumentAt(1, String.class));
+                invocation.getArgument(0, Integer.class),
+                invocation.getArgument(1, String.class));
           }
         });
     return inputContext;
@@ -272,7 +272,7 @@
     handler.handleEvents(Collections.singletonList(dme2));
 
     // task should issue kill request
-    verify(scheduler, times(1)).killSelf(any(IOException.class), any(String.class));
+    verify(scheduler, times(1)).killSelf(any(), any());
   }
 
   @Test (timeout = 5000)
@@ -307,7 +307,7 @@
     handler.handleEvents(events);
 
     // task should issue kill request, as inputs are scheduled for download already.
-    verify(scheduler, times(1)).killSelf(any(IOException.class), any(String.class));
+    verify(scheduler, times(1)).killSelf(any(), any());
   }
 
   @Test(timeout = 5000)
@@ -348,8 +348,8 @@
     events.add(dme);
     handler.handleEvents(events);
     InputAttemptIdentifier expectedIdentifier = new InputAttemptIdentifier(targetIdx, 0);
-    verify(scheduler).copySucceeded(eq(expectedIdentifier), any(MapHost.class), eq(0l),
-        eq(0l), eq(0l), any(MapOutput.class), eq(true));
+    verify(scheduler).copySucceeded(eq(expectedIdentifier), any(), eq(0L),
+            eq(0L), eq(0L), any(), eq(true));
   }
 
   @Test(timeout = 5000)
@@ -362,8 +362,8 @@
     events.add(dme);
     handler.handleEvents(events);
     InputAttemptIdentifier expectedIdentifier = new InputAttemptIdentifier(targetIdx, 0);
-    verify(scheduler).copySucceeded(eq(expectedIdentifier), any(MapHost.class), eq(0l),
-        eq(0l), eq(0l), any(MapOutput.class), eq(true));
+    verify(scheduler).copySucceeded(eq(expectedIdentifier), any(), eq(0L),
+        eq(0L), eq(0L), any(), eq(true));
   }
 
   @Test(timeout = 5000)
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestShuffleScheduler.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestShuffleScheduler.java
index b89ffb0..9df9aaf 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestShuffleScheduler.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/TestShuffleScheduler.java
@@ -16,9 +16,9 @@
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.atLeast;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
@@ -267,10 +267,10 @@
 
     if (minFailurePerHost <= 4) {
       //As per test threshold. Should fail & retrigger shuffle
-      verify(shuffle, atLeast(0)).reportException(any(Throwable.class));
+      verify(shuffle, atLeast(0)).reportException(any());
     } else if (minFailurePerHost > 100) {
       //host failure is so high that this would not retrigger shuffle re-execution
-      verify(shuffle, atLeast(1)).reportException(any(Throwable.class));
+      verify(shuffle, atLeast(1)).reportException(any());
     }
   }
 
@@ -335,7 +335,7 @@
     }
 
     //Shuffle has not stalled. so no issues.
-    verify(scheduler.reporter, times(0)).reportException(any(Throwable.class));
+    verify(scheduler.reporter, times(0)).reportException(any());
 
     //stall shuffle
     scheduler.lastProgressTime = System.currentTimeMillis() - 250000;
@@ -346,7 +346,7 @@
         new MapHost("host" + (190 % totalProducerNodes), 10000, 190, 1), false, true);
 
     //Even when it is stalled, need (320 - 300 = 20) * 3 = 60 failures
-    verify(scheduler.reporter, times(0)).reportException(any(Throwable.class));
+    verify(scheduler.reporter, times(0)).reportException(any());
 
     assertEquals(11, scheduler.failedShufflesSinceLastCompletion);
 
@@ -370,7 +370,7 @@
     assertEquals(61, scheduler.failedShufflesSinceLastCompletion);
     assertEquals(10, scheduler.remainingMaps.get());
 
-    verify(shuffle, atLeast(0)).reportException(any(Throwable.class));
+    verify(shuffle, atLeast(0)).reportException(any());
 
     //fail another 30
     for (int i = 110; i < 120; i++) {
@@ -388,7 +388,7 @@
 
     // Should fail now due to fetcherHealthy. (stall has already happened and
     // these are the only pending tasks)
-    verify(shuffle, atLeast(1)).reportException(any(Throwable.class));
+    verify(shuffle, atLeast(1)).reportException(any());
   }
 
 
@@ -452,7 +452,7 @@
         false, true);
 
     // failedShufflesSinceLastCompletion has crossed the limits. Throw error
-    verify(shuffle, times(0)).reportException(any(Throwable.class));
+    verify(shuffle, times(0)).reportException(any());
   }
 
   @Test(timeout = 60000)
@@ -538,13 +538,13 @@
     // failedShufflesSinceLastCompletion has crossed the limits. 20% of other nodes had failures as
     // well. However, it has failed only in one host. So this should proceed
     // until AM decides to restart the producer.
-    verify(shuffle, times(0)).reportException(any(Throwable.class));
+    verify(shuffle, times(0)).reportException(any());
 
     //stall the shuffle (but within limits)
     scheduler.lastProgressTime = System.currentTimeMillis() - 300000;
     scheduler.copyFailed(InputAttemptFetchFailure.fromAttempt(inputAttemptIdentifier),
         new MapHost("host" + (319 % totalProducerNodes), 10000, 319, 1), false, true);
-    verify(shuffle, times(1)).reportException(any(Throwable.class));
+    verify(shuffle, times(1)).reportException(any());
 
   }
 
@@ -607,7 +607,7 @@
         false, true);
 
     //Shuffle has not received the events completely. So do not bail out yet.
-    verify(shuffle, times(0)).reportException(any(Throwable.class));
+    verify(shuffle, times(0)).reportException(any());
   }
 
 
@@ -675,7 +675,7 @@
     assertEquals(scheduler.remainingMaps.get(), 310);
 
     //Do not bail out (number of failures is just 5)
-    verify(scheduler.reporter, times(0)).reportException(any(Throwable.class));
+    verify(scheduler.reporter, times(0)).reportException(any());
 
     //5 fetches fail repeatedly
     for (int i = 10; i < 15; i++) {
@@ -696,10 +696,10 @@
       // Now bail out, as Shuffle has crossed the
       // failedShufflesSinceLastCompletion limits. (even
       // though reducerHeathly is
-      verify(shuffle, atLeast(1)).reportException(any(Throwable.class));
+      verify(shuffle, atLeast(1)).reportException(any());
     } else {
       //Do not bail out yet.
-      verify(shuffle, atLeast(0)).reportException(any(Throwable.class));
+      verify(shuffle, atLeast(0)).reportException(any());
     }
 
   }
@@ -755,7 +755,7 @@
           false, true);
     }
 
-    verify(shuffle, atLeast(1)).reportException(any(Throwable.class));
+    verify(shuffle, atLeast(1)).reportException(any());
   }
 
   private ShuffleSchedulerForTest createScheduler(long startTime, int
@@ -1016,8 +1016,8 @@
           @Override
           public ExecutorService answer(InvocationOnMock invocation) throws Throwable {
             return sharedExecutor.createExecutorService(
-                invocation.getArgumentAt(0, Integer.class),
-                invocation.getArgumentAt(1, String.class));
+                invocation.getArgument(0, Integer.class),
+                invocation.getArgument(1, String.class));
           }
         });
     return inputContext;
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/sort/impl/TestPipelinedSorter.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/sort/impl/TestPipelinedSorter.java
index bb0f22f..84ec143 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/sort/impl/TestPipelinedSorter.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/sort/impl/TestPipelinedSorter.java
@@ -66,7 +66,7 @@
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/sort/impl/dflt/TestDefaultSorter.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/sort/impl/dflt/TestDefaultSorter.java
index 754fbfa..a56536d 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/sort/impl/dflt/TestDefaultSorter.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/sort/impl/dflt/TestDefaultSorter.java
@@ -26,8 +26,8 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyLong;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyLong;
 import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
@@ -63,7 +63,6 @@
 import org.apache.tez.dag.api.UserPayload;
 import org.apache.tez.runtime.api.Event;
 import org.apache.tez.runtime.api.ExecutionContext;
-import org.apache.tez.runtime.api.MemoryUpdateCallback;
 import org.apache.tez.runtime.api.OutputContext;
 import org.apache.tez.runtime.api.OutputStatisticsReporter;
 import org.apache.tez.runtime.api.events.CompositeDataMovementEvent;
@@ -703,7 +702,7 @@
         callback.memoryAssigned(requestedSize);
         return null;
       }
-    }).when(context).requestInitialMemory(anyLong(), any(MemoryUpdateCallback.class));
+    }).when(context).requestInitialMemory(anyLong(), any());
     return context;
   }
-}
\ No newline at end of file
+}
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/writers/TestUnorderedPartitionedKVWriter.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/writers/TestUnorderedPartitionedKVWriter.java
index c39bf3f..dc7357c 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/writers/TestUnorderedPartitionedKVWriter.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/common/writers/TestUnorderedPartitionedKVWriter.java
@@ -21,13 +21,13 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyListOf;
-import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyList;
 import static org.mockito.Mockito.atLeast;
 import static org.mockito.Mockito.atMost;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.times;
@@ -55,13 +55,13 @@
 import org.apache.hadoop.fs.CommonConfigurationKeys;
 import org.apache.hadoop.fs.permission.FsAction;
 import org.apache.tez.dag.api.TezConfiguration;
-import org.apache.tez.runtime.api.TaskFailureType;
 import org.apache.tez.runtime.api.events.VertexManagerEvent;
 import org.apache.tez.runtime.library.common.Constants;
 import org.apache.tez.runtime.library.common.writers.UnorderedPartitionedKVWriter.SpillInfo;
 import org.apache.tez.runtime.library.shuffle.impl.ShuffleUserPayloads;
 import org.apache.tez.runtime.library.shuffle.impl.ShuffleUserPayloads.VertexManagerEventPayloadProto;
 import org.apache.tez.runtime.library.utils.DATA_RANGE_IN_MB;
+import org.mockito.invocation.InvocationOnMock;
 import org.roaringbitmap.RoaringBitmap;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -107,7 +107,6 @@
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Sets;
 import org.mockito.ArgumentCaptor;
-import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 
 @RunWith(value = Parameterized.class)
@@ -418,7 +417,7 @@
       numRecordsWritten++;
     }
     if (pipeliningEnabled) {
-      verify(outputContext, times(numLargeKeys)).sendEvents(anyListOf(Event.class));
+      verify(outputContext, times(numLargeKeys)).sendEvents(anyList());
     }
 
     // Write Large val records
@@ -434,7 +433,7 @@
       numRecordsWritten++;
     }
     if (pipeliningEnabled) {
-      verify(outputContext, times(numLargevalues + numLargeKeys)).sendEvents(anyListOf(Event.class));
+      verify(outputContext, times(numLargevalues + numLargeKeys)).sendEvents(anyList());
     }
 
     // Write records where key + val are large (but both can fit in the buffer individually)
@@ -451,11 +450,11 @@
     }
     if (pipeliningEnabled) {
       verify(outputContext, times(numLargevalues + numLargeKeys + numLargeKvPairs))
-          .sendEvents(anyListOf(Event.class));
+          .sendEvents(anyList());
     }
 
     List<Event> events = kvWriter.close();
-    verify(outputContext, never()).reportFailure(any(TaskFailureType.class), any(Throwable.class), any(String.class));
+    verify(outputContext, never()).reportFailure(any(), any(), any());
 
     if (!pipeliningEnabled) {
       VertexManagerEvent vmEvent = null;
@@ -732,8 +731,8 @@
     }
     verifyPartitionStats(VMEvent, partitionsWithData);
 
-    verify(outputContext, never()).reportFailure(any(TaskFailureType.class),
-        any(Throwable.class), any(String.class));
+    verify(outputContext, never()).reportFailure(any(),
+        any(), any());
 
     assertNull(kvWriter.currentBuffer);
     assertEquals(0, kvWriter.availableBuffers.size());
@@ -976,8 +975,8 @@
       }
     }
 
-    verify(outputContext, never()).reportFailure(any(TaskFailureType.class),
-        any(Throwable.class), any(String.class));
+    verify(outputContext, never()).reportFailure(any(),
+        any(), any());
 
     assertNull(kvWriter.currentBuffer);
     assertEquals(0, kvWriter.availableBuffers.size());
@@ -1187,7 +1186,7 @@
     int recordsPerBuffer = sizePerBuffer / sizePerRecordWithOverhead;
     int numExpectedSpills = numRecordsWritten / recordsPerBuffer / kvWriter.spillLimit;
 
-    verify(outputContext, never()).reportFailure(any(TaskFailureType.class), any(Throwable.class), any(String.class));
+    verify(outputContext, never()).reportFailure(any(), any(), any());
 
     assertNull(kvWriter.currentBuffer);
     assertEquals(0, kvWriter.availableBuffers.size());
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/input/TestOrderedGroupedKVInput.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/input/TestOrderedGroupedKVInput.java
index 56b6805..c1cdf7c 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/input/TestOrderedGroupedKVInput.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/input/TestOrderedGroupedKVInput.java
@@ -15,7 +15,7 @@
 package org.apache.tez.runtime.library.input;
 
 import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.doThrow;
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/OutputTestHelpers.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/OutputTestHelpers.java
index a7c7ca2..573b3e9 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/OutputTestHelpers.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/OutputTestHelpers.java
@@ -14,8 +14,8 @@
 
 package org.apache.tez.runtime.library.output;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyLong;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyLong;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
@@ -28,7 +28,6 @@
 import org.apache.tez.common.counters.TezCounters;
 import org.apache.tez.dag.api.TezConfiguration;
 import org.apache.tez.dag.api.UserPayload;
-import org.apache.tez.runtime.api.MemoryUpdateCallback;
 import org.apache.tez.runtime.api.OutputContext;
 import org.apache.tez.runtime.api.OutputStatisticsReporter;
 import org.apache.tez.runtime.api.impl.ExecutionContextImpl;
@@ -66,7 +65,7 @@
         callback.memoryAssigned(requestedSize);
         return null;
       }
-    }).when(ctx).requestInitialMemory(anyLong(), any(MemoryUpdateCallback.class));
+    }).when(ctx).requestInitialMemory(anyLong(), any());
     doReturn(conf).when(ctx).getContainerConfiguration();
     doReturn(TezUtils.createUserPayloadFromConf(userPayloadConf)).when(ctx).getUserPayload();
     doReturn("taskVertex").when(ctx).getTaskVertexName();
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileSortedOutput.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileSortedOutput.java
index 7999d45..47f841c 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileSortedOutput.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileSortedOutput.java
@@ -32,7 +32,6 @@
 import org.apache.tez.dag.api.UserPayload;
 import org.apache.tez.runtime.api.ExecutionContext;
 import org.apache.tez.runtime.api.Event;
-import org.apache.tez.runtime.api.MemoryUpdateCallback;
 import org.apache.tez.runtime.api.OutputContext;
 import org.apache.tez.runtime.api.OutputStatisticsReporter;
 import org.apache.tez.runtime.api.events.CompositeDataMovementEvent;
@@ -68,8 +67,8 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyLong;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyLong;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
@@ -420,7 +419,7 @@
         callback.memoryAssigned(requestedSize);
         return null;
       }
-    }).when(context).requestInitialMemory(anyLong(), any(MemoryUpdateCallback.class));
+    }).when(context).requestInitialMemory(anyLong(), any());
     ExecutionContext ExecutionContext = mock(ExecutionContext.class);
     doReturn(HOST).when(ExecutionContext).getHostName();
     doReturn(reporter).when(context).getStatisticsReporter();
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileUnorderedKVOutput.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileUnorderedKVOutput.java
index 963300c..cdb246d 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileUnorderedKVOutput.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileUnorderedKVOutput.java
@@ -18,8 +18,8 @@
 
 package org.apache.tez.runtime.library.output;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyLong;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyLong;
 import static org.mockito.Mockito.atLeast;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.mock;
@@ -61,7 +61,6 @@
 import org.apache.tez.dag.records.TezVertexID;
 import org.apache.tez.runtime.LogicalIOProcessorRuntimeTask;
 import org.apache.tez.runtime.api.Event;
-import org.apache.tez.runtime.api.MemoryUpdateCallback;
 import org.apache.tez.runtime.api.OutputContext;
 import org.apache.tez.runtime.api.events.CompositeDataMovementEvent;
 import org.apache.tez.runtime.api.impl.ExecutionContextImpl;
@@ -282,7 +281,7 @@
         callback.memoryAssigned(requestedSize);
         return null;
       }
-    }).when(outputContext).requestInitialMemory(anyLong(), any(MemoryUpdateCallback.class));
+    }).when(outputContext).requestInitialMemory(anyLong(), any());
 
     return outputContext;
   }
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/utils/TestCodecUtils.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/utils/TestCodecUtils.java
index afa6459..5141598 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/utils/TestCodecUtils.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/utils/TestCodecUtils.java
@@ -49,7 +49,8 @@
 import org.apache.tez.runtime.library.common.sort.impl.IFileInputStream;
 import org.junit.Assert;
 import org.junit.Test;
-import org.mockito.Mockito;
+
+import static org.mockito.Mockito.mock;
 
 public class TestCodecUtils {
 
@@ -80,7 +81,7 @@
           Decompressor decompressor = CodecUtils.getDecompressor(codec);
           DecompressorStream stream =
               (DecompressorStream) CodecUtils.getDecompressedInputStreamWithBufferSize(codec,
-                  Mockito.mock(IFileInputStream.class), decompressor, modifiedBufferSize);
+                  mock(IFileInputStream.class), decompressor, modifiedBufferSize);
 
           Assert.assertEquals("stream buffer size is incorrect", modifiedBufferSize,
               getBufferSize(stream));
@@ -128,7 +129,7 @@
             Decompressor decompressor = CodecUtils.getDecompressor(codec);
             CompressionInputStream stream =
                 (CompressionInputStream) CodecUtils.getDecompressedInputStreamWithBufferSize(codec,
-                    Mockito.mock(IFileInputStream.class), decompressor, modifiedBufferSize);
+                    mock(IFileInputStream.class), decompressor, modifiedBufferSize);
 
             Assert.assertEquals("stream buffer size is incorrect", modifiedBufferSize,
                 getBufferSize(stream));
@@ -146,7 +147,7 @@
 
             Compressor compressor = CodecUtils.getCompressor(codec);
             CompressionOutputStream stream =
-                CodecUtils.createOutputStream(codec, Mockito.mock(OutputStream.class), compressor);
+                CodecUtils.createOutputStream(codec, mock(OutputStream.class), compressor);
 
             Assert.assertEquals("stream buffer size is incorrect",
                 CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_DEFAULT, getBufferSize(stream));
@@ -164,7 +165,7 @@
 
             Decompressor decompressor = CodecUtils.getDecompressor(codec);
             CompressionInputStream stream =
-                CodecUtils.createInputStream(codec, Mockito.mock(InputStream.class), decompressor);
+                CodecUtils.createInputStream(codec, mock(InputStream.class), decompressor);
 
             Assert.assertEquals("stream buffer size is incorrect",
                 CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_DEFAULT, getBufferSize(stream));
diff --git a/tez-tools/analyzers/job-analyzer/pom.xml b/tez-tools/analyzers/job-analyzer/pom.xml
index 89ae908..0cc8583 100644
--- a/tez-tools/analyzers/job-analyzer/pom.xml
+++ b/tez-tools/analyzers/job-analyzer/pom.xml
@@ -48,6 +48,14 @@
     </dependency>
     <dependency>
       <groupId>org.apache.tez</groupId>
+      <artifactId>hadoop-shim</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tez</groupId>
+      <artifactId>tez-runtime-library</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tez</groupId>
       <artifactId>tez-tests</artifactId>
       <scope>test</scope>
     </dependency>
@@ -136,7 +144,7 @@
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
-      <artifactId>mockito-all</artifactId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>