Source:
public void testSetDeadlinesNotStartedReassignTwoTimesWithISOExpirationTimePeriodFormatWithRepeatCount() { WorkItem workItem = new WorkItemImpl(); workItem.setParameter("NotStartedReassign", "[users:john]@[R3/PT4H,R/PT6H]"); @SuppressWarnings("unchecked") Deadlines deadlines = HumanTaskHandlerHelper.setDeadlines(workItem.getParameters(), Collections.EMPTY_LIST, null); assertNotNull(deadlines); assertEquals(2, deadlines.getStartDeadlines().size()); assertEquals(0, deadlines.getEndDeadlines().size()); assertEquals(1, deadlines.getStartDeadlines().get(0).getEscalations().size()); assertEquals(1, deadlines.getStartDeadlines().get(0).getEscalations().get(0).getReassignments().size()); assertEquals(0, deadlines.getStartDeadlines().get(0).getEscalations().get(0).getNotifications().size()); assertEquals(1, deadlines.getStartDeadlines().get(1).getEscalations().size()); assertEquals(1, deadlines.getStartDeadlines().get(1).getEscalations().get(0).getReassignments().size()); assertEquals(0, deadlines.getStartDeadlines().get(1).getEscalations().get(0).getNotifications().size()); Reassignment reassignment = deadlines.getStartDeadlines().get(0).getEscalations().get(0).getReassignments().get(0); assertEquals(1, reassignment.getPotentialOwners().size()); assertEquals("john", reassignment.getPotentialOwners().get(0).getId()); assertNotNull(deadlines.getStartDeadlines().get(0).getDate()); long expirationTime = deadlines.getStartDeadlines().get(0).getDate().getTime() - System.currentTimeMillis(); assertEquals(4, roundExpirationTime(expirationTime)); assertEquals(3, deadlines.getStartDeadlines().get(0).getRepeatCount()); reassignment = deadlines.getStartDeadlines().get(1).getEscalations().get(0).getReassignments().get(0); assertEquals(1, reassignment.getPotentialOwners().size()); assertEquals("john", reassignment.getPotentialOwners().get(0).getId()); assertNotNull(deadlines.getStartDeadlines().get(1).getDate()); expirationTime = deadlines.getStartDeadlines().get(1).getDate().getTime() - System.currentTimeMillis(); assertEquals(6, roundExpirationTime(expirationTime)); assertEquals(-1, deadlines.getStartDeadlines().get(1).getRepeatCount()); }

Target:
public void testSetDeadlinesNotStartedReassignTwoTimesWithISOExpirationTimePeriodFormatWithRepeatCount() { WorkItem workItem = new WorkItemImpl(); workItem.setParameter("NotStartedReassign", "[users:john]@[R3/PT4H,R3/PT6H]"); @SuppressWarnings("unchecked") Deadlines deadlines = HumanTaskHandlerHelper.setDeadlines(workItem.getParameters(), Collections.EMPTY_LIST, null); assertNotNull(deadlines); assertEquals(6, deadlines.getStartDeadlines().size()); assertEquals(0, deadlines.getEndDeadlines().size()); assertEquals(1, deadlines.getStartDeadlines().get(0).getEscalations().size()); assertEquals(1, deadlines.getStartDeadlines().get(0).getEscalations().get(0).getReassignments().size()); assertEquals(0, deadlines.getStartDeadlines().get(0).getEscalations().get(0).getNotifications().size()); assertEquals(1, deadlines.getStartDeadlines().get(1).getEscalations().size()); assertEquals(1, deadlines.getStartDeadlines().get(1).getEscalations().get(0).getReassignments().size()); assertEquals(0, deadlines.getStartDeadlines().get(1).getEscalations().get(0).getNotifications().size()); Reassignment reassignment = deadlines.getStartDeadlines().get(0).getEscalations().get(0).getReassignments().get(0); assertEquals(1, reassignment.getPotentialOwners().size()); assertEquals("john", reassignment.getPotentialOwners().get(0).getId()); for (int i = 0; i < 3; i++) { assertNotNull(deadlines.getStartDeadlines().get(i).getDate()); long expirationTime = deadlines.getStartDeadlines().get(i).getDate().getTime() - System.currentTimeMillis(); assertEquals((i + 1) * 4, roundExpirationTime(expirationTime)); } reassignment = deadlines.getStartDeadlines().get(1).getEscalations().get(0).getReassignments().get(0); assertEquals(1, reassignment.getPotentialOwners().size()); assertEquals("john", reassignment.getPotentialOwners().get(0).getId()); for (int i = 3; i < 6; i++) { assertNotNull(deadlines.getStartDeadlines().get(i).getDate()); long expirationTime = deadlines.getStartDeadlines().get(i).getDate().getTime() - System.currentTimeMillis(); assertEquals((i - 3 + 1) * 6, roundExpirationTime(expirationTime)); } }