@Test
public void test_readSecretIdAccessors_WithUserDetails_failure() throws Exception {

    String token = "5PDrOhsy4ig8L3EpsJZSLAMg";
    String responseJson = "{\"errors\":[\"Unable to read AppRole. AppRole does not exist.\"]}";
    Response response =getMockResponse(HttpStatus.OK, true, responseJson);
    UserDetails userDetails = getMockUser("testuser1", false);
    String role_name = "approle1";
    String username = userDetails.getUsername();
    String path = TVaultConstants.APPROLE_METADATA_MOUNT_PATH + "/" + role_name;
    ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body(responseJson);
    
    when(reqProcessor.process("/auth/approle/role/accessors/list","{\"role_name\":\""+role_name+"\"}",userDetails.getSelfSupportToken())).thenReturn(response);
    when(reqProcessor.process("/auth/approle/role/readRoleID","{\"role_name\":\""+role_name+"\"}",userDetails.getSelfSupportToken())).thenReturn
    (getMockResponse(HttpStatus.NOT_FOUND, true, responseJson));
    Response approleMetadataResponse = getMockResponse(HttpStatus.OK, true, getAppRoleMetadataJSON(path, username, role_name));
    when(reqProcessor.process("/read","{\"path\":\""+path+"\"}",userDetails.getSelfSupportToken())).thenReturn(approleMetadataResponse);
    Map<String, Object> responseMap = new HashMap<>();
    Map<String,Object> roleIdDataMap = new HashMap<>();
    roleIdDataMap.put("role_id", "generated-id");
    roleIdDataMap.put("createdBy", username);
    responseMap.put("data", roleIdDataMap);
    when(ControllerUtil.parseJson("{\"path\":\""+path+"\",\"data\":{\"name\":\""+role_name+"\",\"createdBy\":\""+username+"\"}}")).thenReturn(responseMap);
    ResponseEntity<String> responseEntityActual = appRoleService.readSecretIdAccessors(token, role_name, userDetails);
    assertEquals(HttpStatus.OK, responseEntityActual.getStatusCode());
    assertEquals(responseEntityExpected, responseEntityActual);
}