use of org.camunda.bpm.model.cmmn.util.CmmnModelResource in project camunda-cmmn-model by camunda.
the class SimpleTest method shouldGetElements.
@Test
@CmmnModelResource
public void shouldGetElements() {
ModelElementInstance modelElementById = cmmnModelInstance.getModelElementById("Case_1");
assertThat(modelElementById).isNotNull();
Collection<Case> caseElements = cmmnModelInstance.getDefinitions().getCases();
assertThat(caseElements).hasSize(1);
Case caseElement = caseElements.iterator().next();
assertThat(caseElement.getId()).isEqualTo("Case_1");
assertThat(caseElement.getName()).isNull();
CasePlanModel casePlanModel = caseElement.getCasePlanModel();
assertThat(casePlanModel).isNotNull();
assertThat(casePlanModel.getId()).isEqualTo("CasePlanModel_1");
Collection<PlanItemDefinition> planItemDefinitions = casePlanModel.getPlanItemDefinitions();
assertThat(planItemDefinitions).hasSize(1);
PlanItemDefinition planItemDefinition = planItemDefinitions.iterator().next();
assertThat(planItemDefinition).isInstanceOf(HumanTask.class);
assertThat(planItemDefinition.getId()).isEqualTo("HumanTask_1");
assertThat(planItemDefinition.getName()).isEqualTo("A HumanTask");
Collection<PlanItem> planItems = casePlanModel.getPlanItems();
PlanItem planItem = planItems.iterator().next();
assertThat(planItem.getId()).isEqualTo("PI_HumanTask_1");
assertThat(planItem.getDefinition()).isEqualTo(planItemDefinition);
}
Aggregations