use of org.jbpm.casemgmt.api.model.CaseStage in project jbpm by kiegroup.
the class StageCompletionConditionTest method testAutoCompleteNoAutoStartTaskNotExistingAdHocInStage.
@Test
public void testAutoCompleteNoAutoStartTaskNotExistingAdHocInStage() {
String caseId = caseService.startCase(deploymentUnit.getIdentifier(), STAGE_WITH_TASK_NO_AUTOSTART);
assertThat(caseId).isNotNull().isEqualTo(FIRST_CASE_ID);
assertCaseInstanceActive(caseId);
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER, new QueryFilter());
assertThat(tasks).isEmpty();
CaseDefinition caseDef = caseRuntimeDataService.getCase(deploymentUnit.getIdentifier(), STAGE_WITH_TASK_NO_AUTOSTART);
Collection<CaseStage> stages = caseDef.getCaseStages();
assertThat(stages).hasSize(1);
String stageId = stages.iterator().next().getId();
assertThatExceptionOfType(AdHocFragmentNotFoundException.class).isThrownBy(() -> {
caseService.triggerAdHocFragment(caseId, stageId, "not existing", null);
}).withMessageContaining("AdHoc fragment 'not existing' not found in case " + caseId + " and stage " + stageId);
assertCaseInstanceActive(caseId);
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER, new QueryFilter());
assertThat(tasks).hasSize(0);
caseService.cancelCase(caseId);
assertCaseInstanceNotActive(caseId);
}
Aggregations