@Test
public void testRemoveNonActiveTask() {

    
    createRuntimeManagers("migration/v1/RemoveNonActiveTask-v1.bpmn2", "migration/v2/RemoveNonActiveTask-v2.bpmn2");
    assertNotNull(managerV1);
    assertNotNull(managerV2);
    
    RuntimeEngine runtime = managerV1.getRuntimeEngine(EmptyContext.get());
    KieSession ksession = runtime.getKieSession();
    assertNotNull(ksession); 
    
    ProcessInstance pi1 = ksession.startProcess(REMOVENONACTIVETASK_ID_V1);
    assertNotNull(pi1);
    assertEquals(ProcessInstance.STATE_ACTIVE, pi1.getState());        
    managerV1.disposeRuntimeEngine(runtime);
    
    MigrationSpec migrationSpec = new MigrationSpec(DEPLOYMENT_ID_V1, pi1.getId(), DEPLOYMENT_ID_V2, REMOVENONACTIVETASK_ID_V2);        
    MigrationManager migrationManager = new MigrationManager(migrationSpec);
    MigrationReport report = migrationManager.migrate();        
    assertNotNull(report);
    assertTrue(report.isSuccessful());
    
    assertMigratedProcessInstance(REMOVENONACTIVETASK_ID_V2, pi1.getId(), ProcessInstance.STATE_ACTIVE);
            
    runtime = managerV2.getRuntimeEngine(EmptyContext.get());
    TaskService taskService = runtime.getTaskService();        
    assertMigratedTaskAndComplete(taskService, REMOVENONACTIVETASK_ID_V2, pi1.getId(), "Active Task");                
    assertMigratedProcessInstance(REMOVENONACTIVETASK_ID_V2, pi1.getId(), ProcessInstance.STATE_COMPLETED);
    
    managerV2.disposeRuntimeEngine(runtime);
}