@Test
public void test_updateRole_successfully() {

    Response response = new Response();
    response.setHttpstatus(HttpStatus.OK);
    String roleName = "mytestawsrole";
    String responseBody = "{ \"bound_account_id\": [ \"1234567890123\"],\"bound_ami_id\": [\"ami-fce3c696\" ], \"bound_iam_instance_profile_arn\": [\n" +
            "  \"arn:aws:iam::877677878:instance-profile/exampleinstanceprofile\" ], \"bound_iam_role_arn\": [\"arn:aws:iam::8987887:role/test-role\" ], " +
            "\"bound_vpc_id\": [    \"vpc-2f09a348\"], \"bound_subnet_id\": [ \"subnet-1122aabb\"],\"bound_region\": [\"us-east-2\"],\"policies\": [ \"\\\"[prod\",\"dev\\\"]\" ]}";
    Response readResponse = getMockResponse(HttpStatus.OK, true, responseBody);
    Response responseNoContent = getMockResponse(HttpStatus.NO_CONTENT, true, "");
    String token = "5PDrOhsy4ig8L3EpsJZSLAMg";
    AWSLoginRole awsLoginRole = new AWSLoginRole("ec2", "mytestawsrole", "ami-fce3c696",
            "1234567890123", "us-east-2", "vpc-2f09a348", "subnet-1122aabb",
            "arn:aws:iam::8987887:role/test-role", "arn:aws:iam::877677878:instance-profile/exampleinstanceprofile",
            "\"[prod, dev\"]");
    String jsonStr = "{\"auth_type\": \"ec2\", \"role\": \"mytestawsrole\", \"bound_ami_id\": \"ami-fce3c696\", " +
            "\"bound_account_id\": 1234567890123, \"bound_region\": \"us-east-2\",\"bound_vpc_id\": " +
            "\"vpc-2f09a348\", \"bound_subnet_id\": \"subnet-1122aabb\", \"bound_iam_role_arn\": " +
            "\"arn:aws:iam::8987887:role/test-role\",  \"bound_iam_instance_profile_arn\":" +
            "\"arn:aws:iam::877677878:instance-profile/exampleinstanceprofile\",  " +
            "\"policies\": \"\\\"[prod, dev\\\"]\"}";
    ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body("{\"messages\":[\"AWS Role updated \"]}");
    when(reqProcessor.process("/auth/aws/roles", "{\"role\":\"" + roleName + "\"}", token)).thenReturn(readResponse);
    when(reqProcessor.process("/auth/aws/roles/delete", jsonStr, token)).thenReturn(responseNoContent);
    when(reqProcessor.process("/auth/aws/roles/update", jsonStr, token)).thenReturn(responseNoContent);
    when(ControllerUtil.updateMetaDataOnConfigChanges(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString())).thenReturn(response);
    when(JSONUtil.getJSON(awsLoginRole)).thenReturn(jsonStr);
    ResponseEntity<String> responseEntity = null;
    try {
        when(ControllerUtil.areAWSEC2RoleInputsValid(awsLoginRole)).thenReturn(true);
        responseEntity = awsAuthService.updateRole(token, awsLoginRole);
    } catch (TVaultValidationException e) {
        e.printStackTrace();
    }
    assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
    assertEquals(responseEntityExpected, responseEntity);
}