@Test
public void testMigrateMultipleProcessInstances() {

    
    List<Long> ids = new ArrayList<Long>();
    
    for (int i = 0; i < 5; i++) {
        long processInstanceId = processService.startProcess(deploymentUnitV1.getIdentifier(), ADDTASKAFTERACTIVE_ID_V1);
        assertNotNull(processInstanceId);
        ids.add(processInstanceId);
    }
    
    List<MigrationReport> reports = migrationService.migrate(deploymentUnitV1.getIdentifier(), ids, deploymentUnitV2.getIdentifier(), ADDTASKAFTERACTIVE_ID_V2);
    assertNotNull(reports);
    
    Iterator<MigrationReport> reportsIt = reports.iterator();
    for (Long processInstanceId : ids) {
        MigrationReport report = reportsIt.next();
        assertTrue(report.isSuccessful());
        assertMigratedProcessInstance(ADDTASKAFTERACTIVE_ID_V2, processInstanceId, ProcessInstance.STATE_ACTIVE);
        
        assertMigratedTaskAndComplete(ADDTASKAFTERACTIVE_ID_V2, processInstanceId, "Active Task");
  
        assertMigratedTaskAndComplete(ADDTASKAFTERACTIVE_ID_V2, processInstanceId, "Added Task");
        
        assertMigratedProcessInstance(ADDTASKAFTERACTIVE_ID_V2, processInstanceId, ProcessInstance.STATE_COMPLETED);
    }
}