variableMap.put("name", "Activiti");
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("billing", variableMap);
assertNotNull(processInstance.getId());
System.out.println("id " + processInstance.getId() + " " + processInstance.getProcessDefinitionId());
TaskService taskService = activitiRule.getTaskService();
Task task = taskService.createTaskQuery().taskCandidateGroup("drawer").singleResult();
taskService.claim(task.getId(), "aa");
variableMap = new HashMap<String, Object>();
variableMap.put("approved", false);
variableMap.put("applyer", "bb");
taskService.complete(task.getId(), variableMap);
task = taskService.createTaskQuery().taskAssignee("bb").singleResult();
variableMap = new HashMap<String, Object>();
variableMap.put("reApply", false);
taskService.complete(task.getId(), variableMap);
HistoryService historyService = activitiRule.getHistoryService();
long count = historyService.createHistoricProcessInstanceQuery().finished().count();
assertEquals(1, count);
}