@Test
public void test_associateApproletoSDB_successfully() {

    String token = "5PDrOhsy4ig8L3EpsJZSLAMg";
    UserDetails userDetails = getMockUser(false);
    String jsonStr = "{\"role_name\":\"approle1\",\"path\":\"shared/mysafe01\",\"access\":\"write\"}";
    ResponseEntity<String> response = ResponseEntity.status(HttpStatus.OK).body("{\"messages\":[\"Approle :approle1 is successfully associated with SDB\"]}");
    ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body("{\"messages\":[\"Approle :approle1 is successfully associated with SDB\"]}");
    when(safesService.associateApproletoSDB(eq(token), Mockito.any())).thenReturn(response);
    mockIsAuthorized(userDetails, true);
    Map<String,Object> requestMap = new HashMap<>();
    requestMap.put("path", "shared/mysafe01");
    requestMap.put("role_name", "aprole1");
    requestMap.put("access", "write");
    when(ControllerUtil.parseJson(jsonStr)).thenReturn(requestMap);
    when(ControllerUtil.areSafeAppRoleInputsValid(requestMap)).thenReturn(true);
    SafeAppRoleAccess safeAppRoleAccess = new SafeAppRoleAccess("aprole1", "shared/mysafe01", "write");
    when(JSONUtil.getJSON(Mockito.any(SafeAppRoleAccess.class))).thenReturn(jsonStr);
    ResponseEntity<String> responseEntity = selfSupportService.associateApproletoSDB(userDetails, token, safeAppRoleAccess);
    assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
    assertEquals(responseEntityExpected, responseEntity);
}