- PowerMock.mockStatic(HttpsUtils.class);
- Map<String, String> headers = new HashMap<>();
- headers.put("X-TransactionId", AaiConfig.X_TRANSACTION_ID);
- headers.put("X-FromAppId", AaiConfig.X_FROMAPP_ID);
- headers.put("Authorization", AaiConfig.getAuthenticationCredentials());
- headers.put("Accept", "application/json");
- String url = "https://aai.onap:8443/aai/v11/cloud-infrastructure";
- CloseableHttpClient httpClient = PowerMock.createMock(CloseableHttpClient.class);
- EasyMock.expect(HttpsUtils.getHttpsClient(30000)).andReturn(httpClient);
- HttpGet httpGet = new HttpGet(url);
- PowerMock.expectNew(HttpGet.class, url).andReturn(httpGet);
- EasyMock.expect(HttpsUtils.get(anyObject(HttpGet.class), anyObject(Map.class),
- anyObject(CloseableHttpClient.class))).andThrow(new CorrelationException(""));
- PowerMock.mockStatic(MicroServiceConfig.class);
- PowerMock.expectPrivate(aaiQuery, "getVmResourceLinks", "test1", "test2")
- .andReturn("/aai/v11/cloud-infrastructure");
- PowerMock.expectPrivate(httpClient, "close");
- EasyMock.expectLastCall();
- PowerMock.replayAll();
- Whitebox.invokeMethod(aaiQuery, "getAaiVmData", "test1", "test2");