Revert "HADOOP-18860. Upgrade mockito version to 4.11.0 (#5977)"

This reverts commit 1046f9cf98.
This commit is contained in:
Steve Loughran 2023-08-31 14:54:53 +01:00
parent 1046f9cf98
commit 28c533a582
17 changed files with 53 additions and 75 deletions

View File

@ -151,7 +151,7 @@ public Writable call(
// Nothing should be logged for a suppressed exception. // Nothing should be logged for a suppressed exception.
server.logException(logger, new TestException1(), dummyCall); server.logException(logger, new TestException1(), dummyCall);
verifyNoInteractions(logger); verifyZeroInteractions(logger);
// No stack trace should be logged for a terse exception. // No stack trace should be logged for a terse exception.
server.logException(logger, new TestException2(), dummyCall); server.logException(logger, new TestException2(), dummyCall);

View File

@ -58,7 +58,8 @@ public void testSameOrigin() throws ServletException, IOException {
CrossOriginFilter filter = new CrossOriginFilter(); CrossOriginFilter filter = new CrossOriginFilter();
filter.init(filterConfig); filter.init(filterConfig);
filter.doFilter(mockReq, mockRes, mockChain); filter.doFilter(mockReq, mockRes, mockChain);
Mockito.verifyNoInteractions(mockRes);
Mockito.verifyZeroInteractions(mockRes);
Mockito.verify(mockChain).doFilter(mockReq, mockRes); Mockito.verify(mockChain).doFilter(mockReq, mockRes);
} }
@ -223,7 +224,7 @@ public void testDisallowedOrigin() throws ServletException, IOException {
filter.init(filterConfig); filter.init(filterConfig);
filter.doFilter(mockReq, mockRes, mockChain); filter.doFilter(mockReq, mockRes, mockChain);
Mockito.verifyNoInteractions(mockRes); Mockito.verifyZeroInteractions(mockRes);
Mockito.verify(mockChain).doFilter(mockReq, mockRes); Mockito.verify(mockChain).doFilter(mockReq, mockRes);
} }
@ -251,7 +252,7 @@ public void testDisallowedMethod() throws ServletException, IOException {
filter.init(filterConfig); filter.init(filterConfig);
filter.doFilter(mockReq, mockRes, mockChain); filter.doFilter(mockReq, mockRes, mockChain);
Mockito.verifyNoInteractions(mockRes); Mockito.verifyZeroInteractions(mockRes);
Mockito.verify(mockChain).doFilter(mockReq, mockRes); Mockito.verify(mockChain).doFilter(mockReq, mockRes);
} }
@ -282,7 +283,7 @@ public void testDisallowedHeader() throws ServletException, IOException {
filter.init(filterConfig); filter.init(filterConfig);
filter.doFilter(mockReq, mockRes, mockChain); filter.doFilter(mockReq, mockRes, mockChain);
Mockito.verifyNoInteractions(mockRes); Mockito.verifyZeroInteractions(mockRes);
Mockito.verify(mockChain).doFilter(mockReq, mockRes); Mockito.verify(mockChain).doFilter(mockReq, mockRes);
} }

View File

@ -75,7 +75,7 @@ public void testNoHeaderDefaultConfigBadRequest()
verify(mockRes, atLeastOnce()).sendError( verify(mockRes, atLeastOnce()).sendError(
HttpServletResponse.SC_BAD_REQUEST, EXPECTED_MESSAGE); HttpServletResponse.SC_BAD_REQUEST, EXPECTED_MESSAGE);
Mockito.verifyNoInteractions(mockChain); Mockito.verifyZeroInteractions(mockChain);
} }
@Test @Test
@ -110,7 +110,7 @@ public void testNoHeaderCustomAgentConfigBadRequest()
verify(mockRes, atLeastOnce()).sendError( verify(mockRes, atLeastOnce()).sendError(
HttpServletResponse.SC_BAD_REQUEST, EXPECTED_MESSAGE); HttpServletResponse.SC_BAD_REQUEST, EXPECTED_MESSAGE);
Mockito.verifyNoInteractions(mockChain); Mockito.verifyZeroInteractions(mockChain);
} }
@Test @Test
@ -228,7 +228,7 @@ public void testMissingHeaderWithCustomHeaderConfigBadRequest()
filter.init(filterConfig); filter.init(filterConfig);
filter.doFilter(mockReq, mockRes, mockChain); filter.doFilter(mockReq, mockRes, mockChain);
Mockito.verifyNoInteractions(mockChain); Mockito.verifyZeroInteractions(mockChain);
} }
@Test @Test
@ -260,7 +260,7 @@ public void testMissingHeaderNoMethodsToIgnoreConfigBadRequest()
filter.init(filterConfig); filter.init(filterConfig);
filter.doFilter(mockReq, mockRes, mockChain); filter.doFilter(mockReq, mockRes, mockChain);
Mockito.verifyNoInteractions(mockChain); Mockito.verifyZeroInteractions(mockChain);
} }
@Test @Test
@ -356,6 +356,6 @@ public void testMissingHeaderMultipleIgnoreMethodsConfigBadRequest()
filter.init(filterConfig); filter.init(filterConfig);
filter.doFilter(mockReq, mockRes, mockChain); filter.doFilter(mockReq, mockRes, mockChain);
Mockito.verifyNoInteractions(mockChain); Mockito.verifyZeroInteractions(mockChain);
} }
} }

View File

@ -25,7 +25,6 @@
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field;
import java.security.PrivilegedExceptionAction; import java.security.PrivilegedExceptionAction;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -69,6 +68,7 @@
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.internal.util.reflection.FieldSetter;
/** /**
* The administrator interface of the {@link Router} implemented by * The administrator interface of the {@link Router} implemented by
@ -118,20 +118,18 @@ public static void globalSetUp() throws Exception {
* @throws IOException * @throws IOException
* @throws NoSuchFieldException * @throws NoSuchFieldException
*/ */
private static void setUpMocks() throws IOException, NoSuchFieldException, private static void setUpMocks() throws IOException, NoSuchFieldException {
IllegalAccessException {
RouterRpcServer spyRpcServer = RouterRpcServer spyRpcServer =
Mockito.spy(routerContext.getRouter().createRpcServer()); Mockito.spy(routerContext.getRouter().createRpcServer());
Field rpcServerField = Router.class.getDeclaredField("rpcServer"); FieldSetter.setField(routerContext.getRouter(),
rpcServerField.setAccessible(true); Router.class.getDeclaredField("rpcServer"), spyRpcServer);
rpcServerField.set(routerContext.getRouter(), spyRpcServer);
Mockito.doReturn(null).when(spyRpcServer).getFileInfo(Mockito.anyString()); Mockito.doReturn(null).when(spyRpcServer).getFileInfo(Mockito.anyString());
// mock rpc client for destination check when editing mount tables. // mock rpc client for destination check when editing mount tables.
mockRpcClient = Mockito.spy(spyRpcServer.getRPCClient()); mockRpcClient = Mockito.spy(spyRpcServer.getRPCClient());
Field rpcClientField = RouterRpcServer.class.getDeclaredField("rpcClient"); FieldSetter.setField(spyRpcServer,
rpcClientField.setAccessible(true); RouterRpcServer.class.getDeclaredField("rpcClient"),
rpcClientField.set(spyRpcServer, mockRpcClient); mockRpcClient);
RemoteLocation remoteLocation0 = RemoteLocation remoteLocation0 =
new RemoteLocation("ns0", "/testdir", null); new RemoteLocation("ns0", "/testdir", null);
RemoteLocation remoteLocation1 = RemoteLocation remoteLocation1 =

View File

@ -24,7 +24,7 @@
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.apache.hadoop.test.Whitebox.getInternalState; import static org.apache.hadoop.test.Whitebox.getInternalState;

View File

@ -1575,7 +1575,7 @@ public void testNoLookupsWhenNotUsed() throws Exception {
CacheManager cm = cluster.getNamesystem().getCacheManager(); CacheManager cm = cluster.getNamesystem().getCacheManager();
LocatedBlocks locations = Mockito.mock(LocatedBlocks.class); LocatedBlocks locations = Mockito.mock(LocatedBlocks.class);
cm.setCachedLocations(locations); cm.setCachedLocations(locations);
Mockito.verifyNoInteractions(locations); Mockito.verifyZeroInteractions(locations);
} }
@Test(timeout=120000) @Test(timeout=120000)

View File

@ -447,6 +447,6 @@ public void testShortCircuitSnapshotSearch() throws SnapshotException {
INodesInPath iip = Mockito.mock(INodesInPath.class); INodesInPath iip = Mockito.mock(INodesInPath.class);
List<INodeDirectory> snapDirs = new ArrayList<>(); List<INodeDirectory> snapDirs = new ArrayList<>();
FSDirSnapshotOp.checkSnapshot(fsn.getFSDirectory(), iip, snapDirs); FSDirSnapshotOp.checkSnapshot(fsn.getFSDirectory(), iip, snapDirs);
Mockito.verifyNoInteractions(iip); Mockito.verifyZeroInteractions(iip);
} }
} }

View File

@ -84,9 +84,6 @@
<!-- com.google.re2j version --> <!-- com.google.re2j version -->
<re2j.version>1.1</re2j.version> <re2j.version>1.1</re2j.version>
<!-- org.mockito.mockito-core version -->
<mockito.version>4.11.0</mockito.version>
<!--Protobuf version for backward compatibility--> <!--Protobuf version for backward compatibility-->
<protobuf.version>2.5.0</protobuf.version> <protobuf.version>2.5.0</protobuf.version>
<!-- ProtocolBuffer version, actually used in Hadoop --> <!-- ProtocolBuffer version, actually used in Hadoop -->
@ -1306,20 +1303,7 @@
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId> <artifactId>mockito-core</artifactId>
<version>${mockito.version}</version> <version>2.28.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>

View File

@ -43,7 +43,7 @@
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset; import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
/** /**
@ -90,7 +90,7 @@ public void testContainerRetries() throws Exception {
providerService.buildContainerRetry(mockLauncher, getConfig(), providerService.buildContainerRetry(mockLauncher, getConfig(),
componentLaunchContext, componentInstance); componentLaunchContext, componentInstance);
verifyNoInteractions(mockLauncher); verifyZeroInteractions(mockLauncher);
//OnFailure restart policy //OnFailure restart policy

View File

@ -51,8 +51,8 @@
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
/** /**
* Tests for the CGroups handler implementation. * Tests for the CGroups handler implementation.
@ -192,7 +192,7 @@ public void testMountController() throws IOException {
assertTrue("cgroup dir should be cerated", cgroup.mkdirs()); assertTrue("cgroup dir should be cerated", cgroup.mkdirs());
//Since we enabled (deferred) cgroup controller mounting, no interactions //Since we enabled (deferred) cgroup controller mounting, no interactions
//should have occurred, with this mock //should have occurred, with this mock
verifyNoInteractions(privilegedOperationExecutorMock); verifyZeroInteractions(privilegedOperationExecutorMock);
File emptyMtab = createEmptyCgroups(); File emptyMtab = createEmptyCgroups();
try { try {
@ -238,7 +238,7 @@ public void testMountController() throws IOException {
public void testCGroupPaths() throws IOException { public void testCGroupPaths() throws IOException {
//As per junit behavior, we expect a new mock object to be available //As per junit behavior, we expect a new mock object to be available
//in this test. //in this test.
verifyNoInteractions(privilegedOperationExecutorMock); verifyZeroInteractions(privilegedOperationExecutorMock);
CGroupsHandler cGroupsHandler = null; CGroupsHandler cGroupsHandler = null;
File mtab = createEmptyCgroups(); File mtab = createEmptyCgroups();
@ -281,7 +281,7 @@ public void testCGroupPaths() throws IOException {
public void testCGroupOperations() throws IOException { public void testCGroupOperations() throws IOException {
//As per junit behavior, we expect a new mock object to be available //As per junit behavior, we expect a new mock object to be available
//in this test. //in this test.
verifyNoInteractions(privilegedOperationExecutorMock); verifyZeroInteractions(privilegedOperationExecutorMock);
CGroupsHandler cGroupsHandler = null; CGroupsHandler cGroupsHandler = null;
File mtab = createEmptyCgroups(); File mtab = createEmptyCgroups();

View File

@ -27,7 +27,7 @@
import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import java.io.IOException; import java.io.IOException;
@ -210,7 +210,7 @@ private void assertAllocatedGpus(int gpus, int deniedGpus,
private void assertNoAllocation(GpuAllocation allocation) { private void assertNoAllocation(GpuAllocation allocation) {
assertEquals(1, allocation.getDeniedGPUs().size()); assertEquals(1, allocation.getDeniedGPUs().size());
assertEquals(0, allocation.getAllowedGPUs().size()); assertEquals(0, allocation.getAllowedGPUs().size());
verifyNoInteractions(nmStateStore); verifyZeroInteractions(nmStateStore);
} }
private void assertAssignmentInStateStore(GpuDevice expectedGpu, private void assertAssignmentInStateStore(GpuDevice expectedGpu,

View File

@ -1272,7 +1272,7 @@ public void testCGroupParent() throws ContainerExecutionException {
command); command);
//no --cgroup-parent should be added here //no --cgroup-parent should be added here
Mockito.verifyNoMoreInteractions(command); Mockito.verifyZeroInteractions(command);
String resourceOptionsCpu = "/sys/fs/cgroup/cpu/" + hierarchy + String resourceOptionsCpu = "/sys/fs/cgroup/cpu/" + hierarchy +
containerIdStr; containerIdStr;
@ -1296,7 +1296,7 @@ public void testCGroupParent() throws ContainerExecutionException {
command); command);
//no --cgroup-parent should be added in either case //no --cgroup-parent should be added in either case
Mockito.verifyNoMoreInteractions(command); Mockito.verifyZeroInteractions(command);
} }
@Test @Test

View File

@ -25,7 +25,7 @@
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.anyString;
@ -394,7 +394,7 @@ public void testFindDevicesWithUdev()
assertEquals("No. of devices", 1, devices.size()); assertEquals("No. of devices", 1, devices.size());
Device device = devices.iterator().next(); Device device = devices.iterator().next();
assertSame("Device", device, testDevice); assertSame("Device", device, testDevice);
verifyNoInteractions(mockCommandExecutor); verifyZeroInteractions(mockCommandExecutor);
verify(mockEnvProvider).apply(eq("NEC_USE_UDEV")); verify(mockEnvProvider).apply(eq("NEC_USE_UDEV"));
verifyNoMoreInteractions(mockEnvProvider); verifyNoMoreInteractions(mockEnvProvider);
} }
@ -442,6 +442,6 @@ private Device getTestDevice(int id) {
private void verifyBinaryPathSet(Path expectedPath) { private void verifyBinaryPathSet(Path expectedPath) {
assertEquals("Binary path", expectedPath.toString(), assertEquals("Binary path", expectedPath.toString(),
plugin.getBinaryPath()); plugin.getBinaryPath());
verifyNoInteractions(udevUtil); verifyZeroInteractions(udevUtil);
} }
} }

View File

@ -23,7 +23,7 @@
import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyZeroInteractions;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -666,7 +666,7 @@ public void testValidationSkippedWhenCmdLineSwitchIsDefined()
FSConfigConverterTestCommons.FS_ALLOC_FILE, "-s"); FSConfigConverterTestCommons.FS_ALLOC_FILE, "-s");
argumentHandler.parseAndConvert(args); argumentHandler.parseAndConvert(args);
verifyNoInteractions(mockValidator); verifyZeroInteractions(mockValidator);
} }
@Test @Test
@ -681,7 +681,7 @@ public void testValidationSkippedWhenOutputIsConsole() throws Exception {
FSConfigConverterTestCommons.FS_ALLOC_FILE, "-s", "-p"); FSConfigConverterTestCommons.FS_ALLOC_FILE, "-s", "-p");
argumentHandler.parseAndConvert(args); argumentHandler.parseAndConvert(args);
verifyNoInteractions(mockValidator); verifyZeroInteractions(mockValidator);
} }
@Test @Test

View File

@ -36,7 +36,7 @@
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyZeroInteractions;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
@ -673,7 +673,7 @@ public void testPlacementRulesConversionDisabled() throws Exception {
converter.setPlacementConverter(placementConverter); converter.setPlacementConverter(placementConverter);
converter.convert(params); converter.convert(params);
verifyNoInteractions(placementConverter); verifyZeroInteractions(placementConverter);
} }
@Test @Test

View File

@ -21,7 +21,7 @@
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import java.util.List; import java.util.List;
@ -85,7 +85,7 @@ public void testConvertUserRule() {
MappingRulesDescription description = convert(); MappingRulesDescription description = convert();
assertEquals("Number of rules", 1, description.getRules().size()); assertEquals("Number of rules", 1, description.getRules().size());
verifyRule(description.getRules().get(0), Policy.USER); verifyRule(description.getRules().get(0), Policy.USER);
verifyNoInteractions(ruleHandler); verifyZeroInteractions(ruleHandler);
} }
@Test @Test
@ -96,7 +96,7 @@ public void testConvertSpecifiedRule() {
MappingRulesDescription description = convert(); MappingRulesDescription description = convert();
assertEquals("Number of rules", 1, description.getRules().size()); assertEquals("Number of rules", 1, description.getRules().size());
verifyRule(description.getRules().get(0), Policy.SPECIFIED); verifyRule(description.getRules().get(0), Policy.SPECIFIED);
verifyNoInteractions(ruleHandler); verifyZeroInteractions(ruleHandler);
} }
@Test @Test
@ -108,7 +108,7 @@ public void testConvertPrimaryGroupRule() {
assertEquals("Number of rules", 1, description.getRules().size()); assertEquals("Number of rules", 1, description.getRules().size());
verifyRule(description.getRules().get(0), Policy.PRIMARY_GROUP); verifyRule(description.getRules().get(0), Policy.PRIMARY_GROUP);
verifyNoInteractions(ruleHandler); verifyZeroInteractions(ruleHandler);
} }
@Test @Test
@ -120,7 +120,7 @@ public void testConvertSecondaryGroupRule() {
assertEquals("Number of rules", 1, description.getRules().size()); assertEquals("Number of rules", 1, description.getRules().size());
verifyRule(description.getRules().get(0), Policy.SECONDARY_GROUP); verifyRule(description.getRules().get(0), Policy.SECONDARY_GROUP);
verifyNoInteractions(ruleHandler); verifyZeroInteractions(ruleHandler);
} }
@Test @Test
@ -134,7 +134,7 @@ public void testConvertDefaultRuleWithQueueName() {
assertEquals("Number of rules", 1, description.getRules().size()); assertEquals("Number of rules", 1, description.getRules().size());
verifyRule(description.getRules().get(0), Policy.CUSTOM); verifyRule(description.getRules().get(0), Policy.CUSTOM);
verifyNoInteractions(ruleHandler); verifyZeroInteractions(ruleHandler);
} }
@Test @Test
@ -147,7 +147,7 @@ public void testConvertDefaultRule() {
assertEquals("Number of rules", 1, description.getRules().size()); assertEquals("Number of rules", 1, description.getRules().size());
verifyRule(description.getRules().get(0), Policy.DEFAULT_QUEUE); verifyRule(description.getRules().get(0), Policy.DEFAULT_QUEUE);
verifyNoInteractions(ruleHandler); verifyZeroInteractions(ruleHandler);
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@ -168,7 +168,7 @@ public void testConvertRejectRule() {
assertEquals("Number of rules", 1, description.getRules().size()); assertEquals("Number of rules", 1, description.getRules().size());
verifyRule(description.getRules().get(0), Policy.REJECT); verifyRule(description.getRules().get(0), Policy.REJECT);
verifyNoInteractions(ruleHandler); verifyZeroInteractions(ruleHandler);
} }
@Test @Test
@ -182,7 +182,7 @@ public void testConvertNestedPrimaryGroupRule() {
assertEquals("Number of rules", 1, description.getRules().size()); assertEquals("Number of rules", 1, description.getRules().size());
verifyRule(description.getRules().get(0), Policy.PRIMARY_GROUP_USER); verifyRule(description.getRules().get(0), Policy.PRIMARY_GROUP_USER);
verifyNoInteractions(ruleHandler); verifyZeroInteractions(ruleHandler);
} }
@Test @Test
@ -197,7 +197,7 @@ public void testConvertNestedSecondaryGroupRule() {
assertEquals("Number of rules", 1, description.getRules().size()); assertEquals("Number of rules", 1, description.getRules().size());
verifyRule(description.getRules().get(0), Policy.SECONDARY_GROUP_USER); verifyRule(description.getRules().get(0), Policy.SECONDARY_GROUP_USER);
verifyNoInteractions(ruleHandler); verifyZeroInteractions(ruleHandler);
} }
@Test @Test
@ -215,7 +215,7 @@ public void testConvertNestedDefaultRule() {
Rule rule = description.getRules().get(0); Rule rule = description.getRules().get(0);
verifyRule(description.getRules().get(0), Policy.USER); verifyRule(description.getRules().get(0), Policy.USER);
assertEquals("Parent path", "root.abc", rule.getParentQueue()); assertEquals("Parent path", "root.abc", rule.getParentQueue());
verifyNoInteractions(ruleHandler); verifyZeroInteractions(ruleHandler);
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@ -245,7 +245,7 @@ public void testConvertMultiplePlacementRules() {
verifyRule(description.getRules().get(0), Policy.USER); verifyRule(description.getRules().get(0), Policy.USER);
verifyRule(description.getRules().get(1), Policy.PRIMARY_GROUP); verifyRule(description.getRules().get(1), Policy.PRIMARY_GROUP);
verifyRule(description.getRules().get(2), Policy.SECONDARY_GROUP); verifyRule(description.getRules().get(2), Policy.SECONDARY_GROUP);
verifyNoInteractions(ruleHandler); verifyZeroInteractions(ruleHandler);
} }
@Test @Test
@ -363,7 +363,7 @@ private void testConvertNestedRuleCreateFlagInWeightMode(
any(Policy.class)); any(Policy.class));
verifyNoMoreInteractions(ruleHandler); verifyNoMoreInteractions(ruleHandler);
} else { } else {
verifyNoInteractions(ruleHandler); verifyZeroInteractions(ruleHandler);
} }
} }

View File

@ -90,11 +90,6 @@
<artifactId>hadoop-yarn-applications-catalog-webapp</artifactId> <artifactId>hadoop-yarn-applications-catalog-webapp</artifactId>
<type>war</type> <type>war</type>
</dependency> </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>