// Complete task
taskService.complete(task.getId());
// Query task, including processVariables
HistoricTaskInstance historicTask = historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).includeProcessVariables().singleResult();
assertNotNull(historicTask);
assertNotNull(historicTask.getProcessVariables());
byte[] bytes = (byte[]) historicTask.getProcessVariables().get("binaryVariable");
assertEquals("It is I, le binary", new String(bytes));
// Query task, including taskVariables
historicTask = historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).includeTaskLocalVariables().singleResult();
assertNotNull(historicTask);
assertNotNull(historicTask.getTaskLocalVariables());
bytes = (byte[]) historicTask.getTaskLocalVariables().get("binaryTaskVariable");
assertEquals("It is I, le binary", new String(bytes));
}