@Test
public void test_getWorkloadDetails_failed_token() throws Exception {

    String workloadResponse = "[{\"appName\":\"Other\",\"appTag\":\"Other\",\"appID\":\"oth\"}]";
    ReflectionTestUtils.setField(workloadDetailsService, "workloadEndpoint", "http://appdetails.com");
    when(ControllerUtil.getCwmToken()).thenReturn("");
    when(HttpClientBuilder.create()).thenReturn(httpClientBuilder);
    when(httpClientBuilder.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)).thenReturn(httpClientBuilder);
    when(httpClientBuilder.setSSLContext(any())).thenReturn(httpClientBuilder);
    when(httpClientBuilder.setRedirectStrategy(any())).thenReturn(httpClientBuilder);
    when(httpClientBuilder.build()).thenReturn(httpClient1);
    when(httpClient1.execute(any())).thenReturn(httpResponse);
    when(httpResponse.getStatusLine()).thenReturn(statusLine);
    when(statusLine.getStatusCode()).thenReturn(400);
    when(JSONUtil.getJSON(anyList())).thenReturn(workloadResponse);
    ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body("[{\"appName\":\"Other\",\"appTag\":\"Other\",\"appID\":\"oth\"}]");
    ResponseEntity<String> responseEntityActual = workloadDetailsService.getWorkloadDetails(token, userDetails);
    assertEquals(responseEntityExpected.getStatusCode(), responseEntityActual.getStatusCode());
    assertEquals(responseEntityExpected, responseEntityActual);
}