diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index dbe78d7fbcc..69f1422794e 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -1311,6 +1311,12 @@
3.5.10
test
+
+ org.mockito
+ mockito-inline
+ 3.5.10
+ test
+
org.eclipse.jetty
jetty-security
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
index 9c30ccf114e..ad4d0832127 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProviderTest.java
@@ -26,6 +26,8 @@
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.junit.Assert.assertFalse;
+import static org.mockito.Mockito.mockStatic;
+import static org.powermock.api.mockito.PowerMockito.whenNew;
import java.io.ByteArrayInputStream;
import java.io.File;
@@ -81,6 +83,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.MockedStatic;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@@ -599,6 +602,7 @@ private void testGetResourcesFromCommonServices(Authentication authentication) t
expect(managementController.getHostComponents(EasyMock.anyObject())).andReturn(responses).anyTimes();
PowerMock.mockStaticPartial(StageUtils.class, "getClusterHostInfo");
+ try (MockedStatic mockedStageUtils = mockStatic(StageUtils.class)) {
Map> clusterHostInfo = new HashMap<>();
@@ -615,7 +619,7 @@ private void testGetResourcesFromCommonServices(Authentication authentication) t
}
}
clusterHostInfo.put("all_hosts", all_hosts);
- expect(StageUtils.getClusterHostInfo(cluster)).andReturn(clusterHostInfo);
+ mockedStageUtils.when(() -> StageUtils.getClusterHostInfo(cluster)).thenReturn(clusterHostInfo);
expect(stackId.getStackName()).andReturn(stackName).anyTimes();
expect(stackId.getStackVersion()).andReturn(stackVersion).anyTimes();
@@ -680,6 +684,7 @@ private void testGetResourcesFromCommonServices(Authentication authentication) t
clusterConfig, host, service, serviceComponent, serviceComponentHost, serviceInfo, configHelper,
runtime, process);
PowerMock.verifyAll();
+ }
}