use of org.camunda.bpm.engine.test.cmmn.tasklistener.util.MySpecialTaskListener in project camunda-bpm-platform by camunda.
the class TaskListenerTest method testAssignmentListenerByDelegateExpression.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/tasklistener/TaskListenerTest.testAssignmentListenerByDelegateExpression.cmmn" })
public void testAssignmentListenerByDelegateExpression() {
// given
String caseInstanceId = caseService.withCaseDefinitionByKey("case").setVariable("myTaskListener", new MySpecialTaskListener()).create().getId();
String humanTaskId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
String taskId = taskService.createTaskQuery().caseExecutionId(humanTaskId).singleResult().getId();
// when
taskService.setAssignee(taskId, "jonny");
// then
VariableInstanceQuery query = runtimeService.createVariableInstanceQuery().caseInstanceIdIn(caseInstanceId);
assertEquals(4, query.count());
assertTrue((Boolean) query.variableName("assignment").singleResult().getValue());
assertEquals(1, query.variableName("assignmentEventCounter").singleResult().getValue());
assertEquals(1, query.variableName("eventCounter").singleResult().getValue());
}
Aggregations