@Test
public void testMigrateMultipleProcessInstancesWithNodeMapping() {

    
    List<Long> ids = new ArrayList<Long>();
    
    for (int i = 0; i < 5; i++) {
        long processInstanceId = processService.startProcess(deploymentUnitV1.getIdentifier(), REMOVEACTIVETASK_ID_V1);
        assertNotNull(processInstanceId);
        ids.add(processInstanceId);
    }
    
    String activeNodeId = "_ECEDD1CE-7380-418C-B7A6-AF8ECB90B820";
    String nextNodeId = "_9EF3CAE0-D978-4E96-9C00-8A80082EB68E";
    
    Map<String, String> nodeMapping = new HashMap<String, String>();
    nodeMapping.put(activeNodeId, nextNodeId);
    
    List<MigrationReport> reports = migrationService.migrate(deploymentUnitV1.getIdentifier(), ids, deploymentUnitV2.getIdentifier(), REMOVEACTIVETASK_ID_V2, nodeMapping);
    assertNotNull(reports);
    
    Iterator<MigrationReport> reportsIt = reports.iterator();
    for (Long processInstanceId : ids) {
        MigrationReport report = reportsIt.next();
        assertTrue(report.isSuccessful());
        assertMigratedProcessInstance(REMOVEACTIVETASK_ID_V2, processInstanceId, ProcessInstance.STATE_ACTIVE);
        
        assertMigratedTaskAndComplete(REMOVEACTIVETASK_ID_V2, processInstanceId, "Mapped Task");
  
        assertMigratedProcessInstance(REMOVEACTIVETASK_ID_V2, processInstanceId, ProcessInstance.STATE_COMPLETED);
    }
}