Going back in workflow

Hi,

i have tried your code in rest api project but not sure about the state has been change or not please guide me how can i test that my current task has been change or not.

Task currentTask = taskService.createTaskQuery().taskId(currentTaskId).singleResult();

HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstanceId).orderByHistoricTaskInstanceEndTime().desc().list().get(0);

runtimeService.createChangeActivityStateBuilder().processInstanceId(currentTask.getProcessInstanceId()).moveActivityIdTo(currentTask.getTaskDefinitionKey(), historicTaskInstance.getTaskDefinitionKey());

Please guide me.