Source:
public void testTaskNotCompletedReassign() throws Exception { Reader reader = new InputStreamReader(getClass().getResourceAsStream(MvelFilePath.DeadlineWithMultipleReassignment)); Map<String, Object> vars = new HashMap<String, Object>(); vars.put("now", new Date()); InternalTask task = (InternalTask) TaskFactory.evalTask(reader, vars); Environment environment = EnvironmentFactory.newEnvironment(); Map<String, Object> inputVars = new HashMap<String, Object>(); inputVars.put("NotCompletedReassign", "[users:Tony Stark,Bobba Fet,Jabba Hutt|groups:]@[500ms]"); ((InternalTask) task).setDeadlines(HumanTaskHandlerHelper.setDeadlines(inputVars, Collections.emptyList(), environment)); taskService.addTask(task, inputVars); long taskId = task.getId(); task = (InternalTask) taskService.getTaskById(taskId); String []owners = new String[] { "Tony Stark", "Bobba Fet", "Jabba Hutt" }; for(String owner : owners) { CountDownTaskEventListener countDownListener = new CountDownTaskEventListener(1, true, false); addCountDownListner(countDownListener); taskService.claim(taskId, owner); task = (InternalTask) taskService.getTaskById(taskId); Assert.assertEquals(task.getTaskData().getActualOwner().getId(), owner); taskService.start(taskId, owner); task = (InternalTask) taskService.getTaskById(taskId); countDownListener.waitTillCompleted(); task = (InternalTask) taskService.getTaskById(taskId); Assert.assertNull("it was not reclaimed", task.getTaskData().getActualOwner()); removeCountDownListner(countDownListener); } taskService.claim(taskId, "Bobba Fet"); taskService.start(taskId, "Bobba Fet"); taskService.complete(taskId, "Bobba Fet", Collections.<String, Object>emptyMap()); }

Target:
public void testTaskNotCompletedReassign() throws Exception { Reader reader = new InputStreamReader(getClass().getResourceAsStream(MvelFilePath.DeadlineWithMultipleReassignment)); Map<String, Object> vars = new HashMap<String, Object>(); vars.put("now", new Date()); InternalTask task = (InternalTask) TaskFactory.evalTask(reader, vars); Environment environment = EnvironmentFactory.newEnvironment(); Map<String, Object> inputVars = new HashMap<String, Object>(); inputVars.put("NotCompletedReassign", "[users:Tony Stark,Bobba Fet,Jabba Hutt|groups:]@[500ms]"); ((InternalTask) task).setDeadlines(HumanTaskHandlerHelper.setDeadlines(inputVars, Collections.emptyList(), environment)); taskService.addTask(task, inputVars); long taskId = task.getId(); String []owners = new String[] { "Tony Stark", "Bobba Fet", "Jabba Hutt" }; for(String owner : owners) { CountDownTaskEventListener countDownListener = new CountDownTaskEventListener(1, true, false); addCountDownListner(countDownListener); taskService.claim(taskId, owner); task = (InternalTask) taskService.getTaskById(taskId); Assert.assertEquals(task.getTaskData().getActualOwner().getId(), owner); taskService.start(taskId, owner); countDownListener.waitTillCompleted(); task = (InternalTask) taskService.getTaskById(taskId); Assert.assertNull("it was not reclaimed", task.getTaskData().getActualOwner()); removeCountDownListner(countDownListener); } taskService.claim(taskId, "Bobba Fet"); taskService.start(taskId, "Bobba Fet"); taskService.complete(taskId, "Bobba Fet", Collections.<String, Object>emptyMap()); }