String variableName = "someName";
String variableValue = "someValue";
taskService.setVariable(newTask.getId(), variableName, variableValue);
HistoricDetail result = historyService.createHistoricDetailQuery()
.singleResult();
HistoricDetail resultById = historyService.createHistoricDetailQuery().detailId(result.getId()).singleResult();
assertNotNull(resultById);
assertEquals(result.getId(), resultById.getId());
assertEquals(variableName, ((HistoricVariableUpdate)resultById).getVariableName());
assertEquals(variableValue, ((HistoricVariableUpdate)resultById).getValue());
assertEquals(ValueType.STRING.getName(), ((HistoricVariableUpdate)resultById).getVariableTypeName());
assertEquals(ValueType.STRING.getName(), ((HistoricVariableUpdate)resultById).getTypeName());