assertNotNull(caseDefinition);
// when
// create a new case instance by key
CaseInstance caseInstance = caseService
.withCaseDefinitionByKey(caseDefinition.getKey())
.create();
// then
// the returned caseInstance is not null
assertNotNull(caseInstance);
// verify that there are three case execution:
// - the case instance itself (ie. for the casePlanModel)
// - a case execution for the stage
// - a case execution for the humanTask
List<CaseExecution> caseExecutions = caseService
.createCaseExecutionQuery()
.caseInstanceId(caseInstance.getId())
.list();
assertEquals(3, caseExecutions.size());
CaseExecution casePlanModelExecution = caseService