@Test
public void test_authenticateIAM_failure_500() {

    String jsonStr = "{\n" +
            "  \"iam_http_request_method\": \"POST\",\n" +
            "  \"iam_request_body\": \"{}\",\n" +
            "  \"iam_request_headers\": \"{\"token\":\"4qJC0tWjMDIKjRDDmtcUAZBt\"}\",\n" +
            "  \"iam_request_url\": \"http://testurl.com\",\n" +
            "  \"role\": \"testawsrole\",\n" +
            "  \"pkcs7\": \"MIIBjwYJKoZIhvcNAQcDoIIBgDCCAXwCAQAxggE4MIIBNAIBADCBnDCBlDELMAkGA1UEBhMCWkEx====\"\n" +
            "}";
    AWSIAMLogin awsiamLogin = new AWSIAMLogin();
    awsiamLogin.setIam_http_request_method("POST");
    awsiamLogin.setIam_request_body("{}");
    awsiamLogin.setIam_request_headers("{\"token\":\"4qJC0tWjMDIKjRDDmtcUAZBt\"}");
    awsiamLogin.setIam_request_url("http://testurl.com");
    awsiamLogin.setRole("testawsrole");
    awsiamLogin.setPkcs7("MIIBjwYJKoZIhvcNAQcDoIIBgDCCAXwCAQAxggE4MIIBNAIBADCBnDCBlDELMAkGA1UEBhMCWkEx");
    String responseBody = "{  \"errors\": [ \"failed to base64 decode iam_request_url\" ]}";
    Response response = getMockResponse(HttpStatus.BAD_REQUEST, false, responseBody);
    ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.BAD_REQUEST).body(responseBody);
    when(JSONUtil.getJSON(awsiamLogin)).thenReturn(jsonStr);
    when(reqProcessor.process("/auth/aws/iam/login",jsonStr,"")).thenReturn(response);
    ResponseEntity<String> responseEntity = awsAuthService.authenticateIAM(awsiamLogin);
    assertEquals(HttpStatus.BAD_REQUEST, responseEntity.getStatusCode());
    assertEquals(responseEntityExpected, responseEntity);
}