diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestServer.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestServer.java index 748d99e2a0..b6e696fdde 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestServer.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestServer.java @@ -151,7 +151,7 @@ public Writable call( // Nothing should be logged for a suppressed exception. server.logException(logger, new TestException1(), dummyCall); - verifyZeroInteractions(logger); + verifyNoInteractions(logger); // No stack trace should be logged for a terse exception. server.logException(logger, new TestException2(), dummyCall); diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/http/TestCrossOriginFilter.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/http/TestCrossOriginFilter.java index 0b396be48f..9f7a6114b0 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/http/TestCrossOriginFilter.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/http/TestCrossOriginFilter.java @@ -58,8 +58,7 @@ public void testSameOrigin() throws ServletException, IOException { CrossOriginFilter filter = new CrossOriginFilter(); filter.init(filterConfig); filter.doFilter(mockReq, mockRes, mockChain); - - Mockito.verifyZeroInteractions(mockRes); + Mockito.verifyNoInteractions(mockRes); Mockito.verify(mockChain).doFilter(mockReq, mockRes); } @@ -224,7 +223,7 @@ public void testDisallowedOrigin() throws ServletException, IOException { filter.init(filterConfig); filter.doFilter(mockReq, mockRes, mockChain); - Mockito.verifyZeroInteractions(mockRes); + Mockito.verifyNoInteractions(mockRes); Mockito.verify(mockChain).doFilter(mockReq, mockRes); } @@ -252,7 +251,7 @@ public void testDisallowedMethod() throws ServletException, IOException { filter.init(filterConfig); filter.doFilter(mockReq, mockRes, mockChain); - Mockito.verifyZeroInteractions(mockRes); + Mockito.verifyNoInteractions(mockRes); Mockito.verify(mockChain).doFilter(mockReq, mockRes); } @@ -283,7 +282,7 @@ public void testDisallowedHeader() throws ServletException, IOException { filter.init(filterConfig); filter.doFilter(mockReq, mockRes, mockChain); - Mockito.verifyZeroInteractions(mockRes); + Mockito.verifyNoInteractions(mockRes); Mockito.verify(mockChain).doFilter(mockReq, mockRes); } diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/http/TestRestCsrfPreventionFilter.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/http/TestRestCsrfPreventionFilter.java index 6052ef059a..f125ffac1e 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/http/TestRestCsrfPreventionFilter.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/http/TestRestCsrfPreventionFilter.java @@ -75,7 +75,7 @@ public void testNoHeaderDefaultConfigBadRequest() verify(mockRes, atLeastOnce()).sendError( HttpServletResponse.SC_BAD_REQUEST, EXPECTED_MESSAGE); - Mockito.verifyZeroInteractions(mockChain); + Mockito.verifyNoInteractions(mockChain); } @Test @@ -110,7 +110,7 @@ public void testNoHeaderCustomAgentConfigBadRequest() verify(mockRes, atLeastOnce()).sendError( HttpServletResponse.SC_BAD_REQUEST, EXPECTED_MESSAGE); - Mockito.verifyZeroInteractions(mockChain); + Mockito.verifyNoInteractions(mockChain); } @Test @@ -228,7 +228,7 @@ public void testMissingHeaderWithCustomHeaderConfigBadRequest() filter.init(filterConfig); filter.doFilter(mockReq, mockRes, mockChain); - Mockito.verifyZeroInteractions(mockChain); + Mockito.verifyNoInteractions(mockChain); } @Test @@ -260,7 +260,7 @@ public void testMissingHeaderNoMethodsToIgnoreConfigBadRequest() filter.init(filterConfig); filter.doFilter(mockReq, mockRes, mockChain); - Mockito.verifyZeroInteractions(mockChain); + Mockito.verifyNoInteractions(mockChain); } @Test @@ -356,6 +356,6 @@ public void testMissingHeaderMultipleIgnoreMethodsConfigBadRequest() filter.init(filterConfig); filter.doFilter(mockReq, mockRes, mockChain); - Mockito.verifyZeroInteractions(mockChain); + Mockito.verifyNoInteractions(mockChain); } } diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterAdmin.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterAdmin.java index c2eaddc17a..dac5be209a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterAdmin.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterAdmin.java @@ -25,6 +25,7 @@ import static org.junit.Assert.assertTrue; import java.io.IOException; +import java.lang.reflect.Field; import java.security.PrivilegedExceptionAction; import java.util.Collections; import java.util.HashMap; @@ -68,7 +69,6 @@ import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mockito; -import org.mockito.internal.util.reflection.FieldSetter; /** * The administrator interface of the {@link Router} implemented by @@ -118,18 +118,20 @@ public static void globalSetUp() throws Exception { * @throws IOException * @throws NoSuchFieldException */ - private static void setUpMocks() throws IOException, NoSuchFieldException { + private static void setUpMocks() throws IOException, NoSuchFieldException, + IllegalAccessException { RouterRpcServer spyRpcServer = Mockito.spy(routerContext.getRouter().createRpcServer()); - FieldSetter.setField(routerContext.getRouter(), - Router.class.getDeclaredField("rpcServer"), spyRpcServer); + Field rpcServerField = Router.class.getDeclaredField("rpcServer"); + rpcServerField.setAccessible(true); + rpcServerField.set(routerContext.getRouter(), spyRpcServer); Mockito.doReturn(null).when(spyRpcServer).getFileInfo(Mockito.anyString()); // mock rpc client for destination check when editing mount tables. mockRpcClient = Mockito.spy(spyRpcServer.getRPCClient()); - FieldSetter.setField(spyRpcServer, - RouterRpcServer.class.getDeclaredField("rpcClient"), - mockRpcClient); + Field rpcClientField = RouterRpcServer.class.getDeclaredField("rpcClient"); + rpcClientField.setAccessible(true); + rpcClientField.set(spyRpcServer, mockRpcClient); RemoteLocation remoteLocation0 = new RemoteLocation("ns0", "/testdir", null); RemoteLocation remoteLocation1 = diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpcMultiDestination.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpcMultiDestination.java index 336ea39138..ab51a82242 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpcMultiDestination.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpcMultiDestination.java @@ -24,7 +24,7 @@ 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.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.apache.hadoop.test.Whitebox.getInternalState; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestCacheDirectives.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestCacheDirectives.java index 1331c50e80..48c1527de1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestCacheDirectives.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestCacheDirectives.java @@ -1575,7 +1575,7 @@ public void testNoLookupsWhenNotUsed() throws Exception { CacheManager cm = cluster.getNamesystem().getCacheManager(); LocatedBlocks locations = Mockito.mock(LocatedBlocks.class); cm.setCachedLocations(locations); - Mockito.verifyZeroInteractions(locations); + Mockito.verifyNoInteractions(locations); } @Test(timeout=120000) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestSnapshotPathINodes.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestSnapshotPathINodes.java index b62a4180d4..cda5b39f1d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestSnapshotPathINodes.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestSnapshotPathINodes.java @@ -447,6 +447,6 @@ public void testShortCircuitSnapshotSearch() throws SnapshotException { INodesInPath iip = Mockito.mock(INodesInPath.class); List snapDirs = new ArrayList<>(); FSDirSnapshotOp.checkSnapshot(fsn.getFSDirectory(), iip, snapDirs); - Mockito.verifyZeroInteractions(iip); + Mockito.verifyNoInteractions(iip); } } diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index 9fca0fa159..b2176ccaa9 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -84,6 +84,9 @@ 1.1 + + 4.11.0 + 2.5.0 @@ -1303,7 +1306,20 @@ org.mockito mockito-core - 2.28.2 + ${mockito.version} + test + + + org.mockito + mockito-inline + ${mockito.version} + test + + + org.mockito + mockito-core + + org.mockito diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/containerlaunch/TestAbstractLauncher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/containerlaunch/TestAbstractLauncher.java index 31ca38297c..6b3da71396 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/containerlaunch/TestAbstractLauncher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/containerlaunch/TestAbstractLauncher.java @@ -43,7 +43,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; /** @@ -90,7 +90,7 @@ public void testContainerRetries() throws Exception { providerService.buildContainerRetry(mockLauncher, getConfig(), componentLaunchContext, componentInstance); - verifyZeroInteractions(mockLauncher); + verifyNoInteractions(mockLauncher); //OnFailure restart policy diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/resources/TestCGroupsHandlerImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/resources/TestCGroupsHandlerImpl.java index b1e8989213..ff5b9be6dd 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/resources/TestCGroupsHandlerImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/resources/TestCGroupsHandlerImpl.java @@ -51,8 +51,8 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; /** * Tests for the CGroups handler implementation. @@ -192,7 +192,7 @@ public void testMountController() throws IOException { assertTrue("cgroup dir should be cerated", cgroup.mkdirs()); //Since we enabled (deferred) cgroup controller mounting, no interactions //should have occurred, with this mock - verifyZeroInteractions(privilegedOperationExecutorMock); + verifyNoInteractions(privilegedOperationExecutorMock); File emptyMtab = createEmptyCgroups(); try { @@ -238,7 +238,7 @@ public void testMountController() throws IOException { public void testCGroupPaths() throws IOException { //As per junit behavior, we expect a new mock object to be available //in this test. - verifyZeroInteractions(privilegedOperationExecutorMock); + verifyNoInteractions(privilegedOperationExecutorMock); CGroupsHandler cGroupsHandler = null; File mtab = createEmptyCgroups(); @@ -281,7 +281,7 @@ public void testCGroupPaths() throws IOException { public void testCGroupOperations() throws IOException { //As per junit behavior, we expect a new mock object to be available //in this test. - verifyZeroInteractions(privilegedOperationExecutorMock); + verifyNoInteractions(privilegedOperationExecutorMock); CGroupsHandler cGroupsHandler = null; File mtab = createEmptyCgroups(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/resources/gpu/TestGpuResourceAllocator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/resources/gpu/TestGpuResourceAllocator.java index ba8a9309d0..07ce7b256d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/resources/gpu/TestGpuResourceAllocator.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/resources/gpu/TestGpuResourceAllocator.java @@ -27,7 +27,7 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import java.io.IOException; @@ -210,7 +210,7 @@ private void assertAllocatedGpus(int gpus, int deniedGpus, private void assertNoAllocation(GpuAllocation allocation) { assertEquals(1, allocation.getDeniedGPUs().size()); assertEquals(0, allocation.getAllowedGPUs().size()); - verifyZeroInteractions(nmStateStore); + verifyNoInteractions(nmStateStore); } private void assertAssignmentInStateStore(GpuDevice expectedGpu, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/TestDockerContainerRuntime.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/TestDockerContainerRuntime.java index ea7c213809..f13d8388f9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/TestDockerContainerRuntime.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/runtime/TestDockerContainerRuntime.java @@ -1272,7 +1272,7 @@ public void testCGroupParent() throws ContainerExecutionException { command); //no --cgroup-parent should be added here - Mockito.verifyZeroInteractions(command); + Mockito.verifyNoMoreInteractions(command); String resourceOptionsCpu = "/sys/fs/cgroup/cpu/" + hierarchy + containerIdStr; @@ -1296,7 +1296,7 @@ public void testCGroupParent() throws ContainerExecutionException { command); //no --cgroup-parent should be added in either case - Mockito.verifyZeroInteractions(command); + Mockito.verifyNoMoreInteractions(command); } @Test diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/com/nec/TestNECVEPlugin.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/com/nec/TestNECVEPlugin.java index 86ef9058f2..a9b01bca6f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/com/nec/TestNECVEPlugin.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/com/nec/TestNECVEPlugin.java @@ -25,7 +25,7 @@ import static org.mockito.Mockito.when; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.anyString; @@ -394,7 +394,7 @@ public void testFindDevicesWithUdev() assertEquals("No. of devices", 1, devices.size()); Device device = devices.iterator().next(); assertSame("Device", device, testDevice); - verifyZeroInteractions(mockCommandExecutor); + verifyNoInteractions(mockCommandExecutor); verify(mockEnvProvider).apply(eq("NEC_USE_UDEV")); verifyNoMoreInteractions(mockEnvProvider); } @@ -442,6 +442,6 @@ private Device getTestDevice(int id) { private void verifyBinaryPathSet(Path expectedPath) { assertEquals("Binary path", expectedPath.toString(), plugin.getBinaryPath()); - verifyZeroInteractions(udevUtil); + verifyNoInteractions(udevUtil); } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSConfigToCSConfigArgumentHandler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSConfigToCSConfigArgumentHandler.java index cb8cc587f6..33cc3f0dba 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSConfigToCSConfigArgumentHandler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSConfigToCSConfigArgumentHandler.java @@ -23,7 +23,7 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import java.io.File; import java.io.IOException; @@ -666,7 +666,7 @@ public void testValidationSkippedWhenCmdLineSwitchIsDefined() FSConfigConverterTestCommons.FS_ALLOC_FILE, "-s"); argumentHandler.parseAndConvert(args); - verifyZeroInteractions(mockValidator); + verifyNoInteractions(mockValidator); } @Test @@ -681,7 +681,7 @@ public void testValidationSkippedWhenOutputIsConsole() throws Exception { FSConfigConverterTestCommons.FS_ALLOC_FILE, "-s", "-p"); argumentHandler.parseAndConvert(args); - verifyZeroInteractions(mockValidator); + verifyNoInteractions(mockValidator); } @Test diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSConfigToCSConfigConverter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSConfigToCSConfigConverter.java index 55c43666cd..530c6ddc55 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSConfigToCSConfigConverter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSConfigToCSConfigConverter.java @@ -36,7 +36,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import java.io.ByteArrayInputStream; import java.io.File; @@ -673,7 +673,7 @@ public void testPlacementRulesConversionDisabled() throws Exception { converter.setPlacementConverter(placementConverter); converter.convert(params); - verifyZeroInteractions(placementConverter); + verifyNoInteractions(placementConverter); } @Test diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestQueuePlacementConverter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestQueuePlacementConverter.java index 6599080aab..6871444baa 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestQueuePlacementConverter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestQueuePlacementConverter.java @@ -21,7 +21,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import java.util.List; @@ -85,7 +85,7 @@ public void testConvertUserRule() { MappingRulesDescription description = convert(); assertEquals("Number of rules", 1, description.getRules().size()); verifyRule(description.getRules().get(0), Policy.USER); - verifyZeroInteractions(ruleHandler); + verifyNoInteractions(ruleHandler); } @Test @@ -96,7 +96,7 @@ public void testConvertSpecifiedRule() { MappingRulesDescription description = convert(); assertEquals("Number of rules", 1, description.getRules().size()); verifyRule(description.getRules().get(0), Policy.SPECIFIED); - verifyZeroInteractions(ruleHandler); + verifyNoInteractions(ruleHandler); } @Test @@ -108,7 +108,7 @@ public void testConvertPrimaryGroupRule() { assertEquals("Number of rules", 1, description.getRules().size()); verifyRule(description.getRules().get(0), Policy.PRIMARY_GROUP); - verifyZeroInteractions(ruleHandler); + verifyNoInteractions(ruleHandler); } @Test @@ -120,7 +120,7 @@ public void testConvertSecondaryGroupRule() { assertEquals("Number of rules", 1, description.getRules().size()); verifyRule(description.getRules().get(0), Policy.SECONDARY_GROUP); - verifyZeroInteractions(ruleHandler); + verifyNoInteractions(ruleHandler); } @Test @@ -134,7 +134,7 @@ public void testConvertDefaultRuleWithQueueName() { assertEquals("Number of rules", 1, description.getRules().size()); verifyRule(description.getRules().get(0), Policy.CUSTOM); - verifyZeroInteractions(ruleHandler); + verifyNoInteractions(ruleHandler); } @Test @@ -147,7 +147,7 @@ public void testConvertDefaultRule() { assertEquals("Number of rules", 1, description.getRules().size()); verifyRule(description.getRules().get(0), Policy.DEFAULT_QUEUE); - verifyZeroInteractions(ruleHandler); + verifyNoInteractions(ruleHandler); } @Test(expected = IllegalArgumentException.class) @@ -168,7 +168,7 @@ public void testConvertRejectRule() { assertEquals("Number of rules", 1, description.getRules().size()); verifyRule(description.getRules().get(0), Policy.REJECT); - verifyZeroInteractions(ruleHandler); + verifyNoInteractions(ruleHandler); } @Test @@ -182,7 +182,7 @@ public void testConvertNestedPrimaryGroupRule() { assertEquals("Number of rules", 1, description.getRules().size()); verifyRule(description.getRules().get(0), Policy.PRIMARY_GROUP_USER); - verifyZeroInteractions(ruleHandler); + verifyNoInteractions(ruleHandler); } @Test @@ -197,7 +197,7 @@ public void testConvertNestedSecondaryGroupRule() { assertEquals("Number of rules", 1, description.getRules().size()); verifyRule(description.getRules().get(0), Policy.SECONDARY_GROUP_USER); - verifyZeroInteractions(ruleHandler); + verifyNoInteractions(ruleHandler); } @Test @@ -215,7 +215,7 @@ public void testConvertNestedDefaultRule() { Rule rule = description.getRules().get(0); verifyRule(description.getRules().get(0), Policy.USER); assertEquals("Parent path", "root.abc", rule.getParentQueue()); - verifyZeroInteractions(ruleHandler); + verifyNoInteractions(ruleHandler); } @Test(expected = IllegalArgumentException.class) @@ -245,7 +245,7 @@ public void testConvertMultiplePlacementRules() { verifyRule(description.getRules().get(0), Policy.USER); verifyRule(description.getRules().get(1), Policy.PRIMARY_GROUP); verifyRule(description.getRules().get(2), Policy.SECONDARY_GROUP); - verifyZeroInteractions(ruleHandler); + verifyNoInteractions(ruleHandler); } @Test @@ -363,7 +363,7 @@ private void testConvertNestedRuleCreateFlagInWeightMode( any(Policy.class)); verifyNoMoreInteractions(ruleHandler); } else { - verifyZeroInteractions(ruleHandler); + verifyNoInteractions(ruleHandler); } } diff --git a/hadoop-yarn-project/pom.xml b/hadoop-yarn-project/pom.xml index 241e3bc237..78f09a3971 100644 --- a/hadoop-yarn-project/pom.xml +++ b/hadoop-yarn-project/pom.xml @@ -90,6 +90,11 @@ hadoop-yarn-applications-catalog-webapp war + + org.mockito + mockito-core + test +