X-Git-Url: https://gerrit.onap.org/r/gitweb?p=holmes%2Fcommon.git;a=blobdiff_plain;f=holmes-actions%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fholmes%2Fcommon%2Faai%2FAaiQueryTest.java;h=44e39b1f04c3847f44642c69df30cb7f25e06ac6;hp=e0d5bf7d4bad03d24cae824c3db1bbcb928a3c79;hb=bf20ddf00200c5468da7a0090caf28beebb93e9c;hpb=e37f1a4ce3da909a945e2faf7d3166a3b1a96a93 diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryTest.java index e0d5bf7..44e39b1 100644 --- a/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryTest.java +++ b/holmes-actions/src/test/java/org/onap/holmes/common/aai/AaiQueryTest.java @@ -22,6 +22,7 @@ import static org.powermock.api.mockito.PowerMockito.when; import java.util.HashMap; import java.util.Map; +import org.apache.http.HttpResponse; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -94,7 +95,9 @@ public class AaiQueryTest { headers.put("Authorization", AaiConfig.getAuthenticationCredentials()); headers.put("Accept", "application/json"); String url = "http://10.96.33.33/api/aai-cloudInfrastructure/v11"; - when(HttpsUtils.get(url, headers)).thenReturn("{}"); + HttpResponse httpResponse = PowerMock.createMock(HttpResponse.class); + when(HttpsUtils.get(url, headers)).thenReturn(httpResponse); + when(HttpsUtils.extractResponseEntity(httpResponse)).thenReturn("{}"); PowerMockito.mockStatic(MicroServiceConfig.class); when(MicroServiceConfig.getMsbServerAddrWithHttpPrefix()).thenReturn("http://10.96.33.33:80"); @@ -108,10 +111,6 @@ public class AaiQueryTest { assertThat(vmEntity == null, equalTo(true)); } - - - - @Test public void testAaiQuery_getAaiVmData_httpsutils_exception() throws Exception { PowerMock.resetAll(); @@ -212,7 +211,9 @@ public class AaiQueryTest { headers.put("Accept", "application/json"); String url = "host_url"; - when(HttpsUtils.get(url, headers)).thenReturn(""); + HttpResponse httpResponse = PowerMock.createMock(HttpResponse.class); + when(HttpsUtils.get(url, headers)).thenReturn(httpResponse); + when(HttpsUtils.extractResponseEntity(httpResponse)).thenReturn(""); PowerMock.replayAll(); String resource = Whitebox.invokeMethod(aaiQuery, "getResponse", "host_url");