.getVariable(processInstance.getProcessInstanceId(),
DESCRIPTION_KEY),
endsWith("I hate your xxxing shop!"));
// get a handle on the task service
TaskService taskService = activitiRule.getTaskService();
// seach for a task for candidate-group 'itsupport-critical'
Task approveCriticalIssueTask = taskService.createTaskQuery()
.processInstanceId(processInstance.getProcessInstanceId())
.taskCandidateGroup(itSupportGroup.getId()).singleResult();
assertThat(approveCriticalIssueTask.getName(),
equalTo("Approve Critical Issue"));
// claim the task for the user 'itguy'
taskService.claim(approveCriticalIssueTask.getId(), itguy.getId());
// approve the request and complete the task
Map<String, Object> taskParams = new HashMap<String, Object>();
taskParams.put("requestApproved", "true");
taskService.complete(approveCriticalIssueTask.getId(), taskParams);
// now we should have received an email..
smtpServer.waitForIncomingEmail(5000L, 1);
MimeMessage[] messages = smtpServer.getReceivedMessages();
assertThat(messages.length, equalTo(1));