@Deployment(resources="open-account.bpmn")
public void testNonApprovedPath() throws Exception {
// Get services
RuntimeService runtimeService = activitiRule.getRuntimeService();
TaskService taskService = activitiRule.getTaskService();
HistoryService historyService = activitiRule.getHistoryService();
// Prepare fake camel behavior
CamelBehaviourStub camelBehaviour = new CamelBehaviourStub();
Mocks.register("camel", camelBehaviour);
// Start process instance
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("open-account");
runtimeService.signal(processInstance.getId());
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("approved", false);
Task task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId(), variables);
assertEquals(0, runtimeService.createProcessInstanceQuery().list().size());
List<HistoricActivityInstance> activityInstances = historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceStartTime().asc().list();
assertEquals(7, activityInstances.size());
assertEquals("order_received", activityInstances.get(0).getActivityId());
assertEquals("wait_for_postident", activityInstances.get(1).getActivityId());
assertEquals("check_documents", activityInstances.get(2).getActivityId());