assertEquals("Task A", taskA.getName());
assertEquals("Task B", taskB.getName());
// Completing the first task should not end the subprocess
taskService.complete(taskA.getId());
assertEquals(1, taskQuery.list().size());
// Completing the second task should end the subprocess and end the whole process instance
taskService.complete(taskB.getId());
assertEquals(0, runtimeService.createExecutionQuery().count());
}