@Test
public void testReTriggerNodeInstance() {

    processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    assertNotNull(processInstanceId);
    
    Collection<NodeInstanceDesc> activeNodes = processAdminService.getActiveNodeInstances(processInstanceId);
    assertNotNull(activeNodes);
    assertEquals(1, activeNodes.size());
    
    NodeInstanceDesc active = activeNodes.iterator().next();       
    assertEquals("Write a Document", active.getName());
    
    List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
    assertEquals(1, tasks.size());
    TaskSummary task = tasks.get(0);
    // aborts the current node
    processAdminService.retriggerNodeInstance(processInstanceId, active.getId());
            
    activeNodes = processAdminService.getActiveNodeInstances(processInstanceId);
    assertNotNull(activeNodes);
    assertEquals(1, activeNodes.size());
    // this does not return aborted node instances
    Collection<NodeInstanceDesc> completedNodes = runtimeDataService.getProcessInstanceHistoryCompleted(processInstanceId, new QueryFilter());
    assertNotNull(completedNodes);
    assertEquals(1, completedNodes.size());
    final List<NodeInstanceDesc> nodeInstances = completedNodes.stream().filter(node -> node.getId().equals(active.getId())).collect(Collectors.toList());
    assertEquals(0, nodeInstances.size());
    NodeInstanceDesc activeRetriggered = activeNodes.iterator().next();        
    assertFalse(active.getId().longValue() == activeRetriggered.getId().longValue());
    
    tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
    assertEquals(1, tasks.size());
    TaskSummary taskRetriggered = tasks.get(0);
    
    assertFalse(task.getId().longValue() == taskRetriggered.getId().longValue());
}