ActivitiRuntimeHelper { public void signal(String processInstanceId, String signalTaskId) { ExecutionQuery signalTaskQuery = runtimeService.createExecutionQuery().processInstanceId(processInstanceId).activityId(signalTaskId); Execution execution = signalTaskQuery.singleResult(); runtimeService.signal(execution.getId()); }  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 testSignal() { final String processInstanceId = ACTIVITI_ID; final String signalTaskId = ACTIVITI_ID_2; final String executionId = ACTIVITI_ID_3; ExecutionQuery executionQuery = mock(ExecutionQuery.class); Execution execution = mock(Execution.class); when(runtimeService.createExecutionQuery()).thenReturn(executionQuery); when(executionQuery.processInstanceId(processInstanceId)).thenReturn(executionQuery); when(executionQuery.activityId(signalTaskId)).thenReturn(executionQuery); when(executionQuery.singleResult()).thenReturn(execution); when(execution.getId()).thenReturn(executionId); activitiRuntimeHelper.signal(processInstanceId, signalTaskId); verify(runtimeService).createExecutionQuery(); verify(executionQuery).processInstanceId(processInstanceId); verify(executionQuery).activityId(signalTaskId); verify(executionQuery).singleResult(); verify(execution).getId(); verify(runtimeService).signal(executionId); verifyNoMoreInteractions(executionQuery, execution, runtimeService); }