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;
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");
assertThat(vmEntity == null, equalTo(true));
}
-
-
-
-
@Test
public void testAaiQuery_getAaiVmData_httpsutils_exception() throws Exception {
PowerMock.resetAll();
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");