}
public void testClaimAlreadyClaimedTaskByOtherUser() {
Task task = taskService.newTask();
taskService.saveTask(task);
User user = identityService.newUser("user");
identityService.saveUser(user);
User secondUser = identityService.newUser("seconduser");
identityService.saveUser(secondUser);
// Claim task the first time
taskService.claim(task.getId(), user.getId());
try {
taskService.claim(task.getId(), secondUser.getId());
fail("ProcessEngineException expected");
} catch (TaskAlreadyClaimedException ae) {
assertTextPresent("Task '" + task.getId() + "' is already claimed by someone else.", ae.getMessage());
}
taskService.deleteTask(task.getId(), true);
identityService.deleteUser(user.getId());
identityService.deleteUser(secondUser.getId());
}