@Test
public void testRemovePotentialOwners() {

    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    Assertions.assertThat(processInstanceId).isNotNull();
    
    List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
    Assertions.assertThat(tasks).hasSize(1);
    TaskSummary task = tasks.get(0);
    
    userTaskService.release(task.getId(), "salaboy");
    
    userTaskAdminService.removePotentialOwners(task.getId(), factory.newUser("salaboy"));
    List<TaskEvent> events = runtimeDataService.getTaskEvents(task.getId(), new QueryFilter());
    Assertions.assertThat(events).hasSize(4);
    TaskEvent updatedEvent = events.get(3);
    Assertions.assertThat(updatedEvent.getMessage()).isEqualTo("Potential owners [salaboy] have been removed");
    
    tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
    Assertions.assertThat(tasks).hasSize(0);
}