String procId = runtimeService.startProcessInstanceByKey("catchErrorOnSequentialMi").getId();
// complete one task
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("throwError", false);
Task task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId(), vars);
// complete second task and throw error
vars.put("throwError", true);
task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId(), vars);
assertProcessEnded(procId);
}