ActivitiRuntimeHelper { public void setTaskSuccessInWorkflow(DelegateExecution execution) { setTaskWorkflowVariable(execution, VARIABLE_STATUS, TASK_STATUS_SUCCESS); }  void signal(String processInstanceId, String signalTaskId); void setTaskWorkflowVariable(String executionId, String activitiId, String variableName, Object variableValue); void setTaskWorkflowVariable(DelegateExecution execution, String variableName, Object variableValue); void setTaskSuccessInWorkflow(DelegateExecution execution); void setTaskErrorInWorkflow(DelegateExecution execution, String errorMessage, Exception exception); String buildTaskWorkflowVariableName(String activitiId, String variableName); static final String VARIABLE_STATUS; static final String VARIABLE_ERROR_MESSAGE; static final String TASK_STATUS_SUCCESS; static final String TASK_STATUS_ERROR; static final String TASK_VARIABLE_MARKER; }
@Test public void testSetTaskSuccessInWorkflow() { final String currentActivityId = ACTIVITI_ID; final String executionId = ACTIVITI_ID_2; final String statusTaskWorkflowVariableName = activitiRuntimeHelper.buildTaskWorkflowVariableName(currentActivityId, ActivitiRuntimeHelper.VARIABLE_STATUS); DelegateExecution execution = mock(DelegateExecution.class); when(execution.getCurrentActivityId()).thenReturn(currentActivityId); when(execution.getId()).thenReturn(executionId); activitiRuntimeHelper.setTaskSuccessInWorkflow(execution); verify(execution).getCurrentActivityId(); verify(execution).getId(); verify(runtimeService).getVariables(executionId); verify(runtimeService).setVariable(executionId, statusTaskWorkflowVariableName, ActivitiRuntimeHelper.TASK_STATUS_SUCCESS); verifyNoMoreInteractions(execution, runtimeService); }