// an active case instance
CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
caseInstance.create();
// task A as a child of the case instance
CmmnActivityExecution taskA = caseInstance.findCaseExecution("A");
taskA.manualStart();
// task A is active
assertTrue(taskA.isActive());
// when
// terminate A
taskA.terminate();
// then
List<String> expectedStateTransitions = new ArrayList<String>();
// expected state transition:
// active --terminate(A)--> terminated
// active --complete(Case1)--> completed
expectedStateTransitions.add("active --terminate(A)--> terminated");
expectedStateTransitions.add("active --complete(Case1)--> completed");
assertEquals(expectedStateTransitions, stateTransitionCollector.stateTransitions);
// task A is disabled
assertTrue(taskA.isTerminated());
// case instance is completed
assertTrue(caseInstance.isCompleted());
assertNull(caseInstance.findCaseExecution("A"));