@Test
public void testAddPotentialOwnersWrongDeploymentId() {

    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");
    
    assertThatExceptionOfType(TaskNotFoundException.class).isThrownBy(() -> { 
        userTaskAdminService.addPotentialOwners("wrong-one", task.getId(), false, factory.newUser("john")); })
    .withMessageContaining("Task with id " + task.getId() + " is not associated with wrong-one");
    
    tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("john", new QueryFilter());
    Assertions.assertThat(tasks).hasSize(0);
}