@Test
public void testCompleteTaskByTaskId() throws Exception {

    TaskDetails taskDetails = new TaskDetails();
    taskDetails.setWorkflowId("${workflowId}");
    taskDetails.setTaskId("${taskId}");
    Action action = new Action();
    action.setAction(Type.complete_task);
    action.setComplete_task(taskDetails);
    Object payload = objectMapper.readValue("{\"workflowId\":\"workflow_1\", \"taskId\":\"task_1\"}", Object.class);
    Task task = new Task();
    task.setTaskId("task_1");
    task.setReferenceTaskName("testTask");
    when(workflowExecutor.getTask(eq("task_1"))).thenReturn(task);
    actionProcessor.execute(action, payload, "testEvent", "testMessage");
    ArgumentCaptor<TaskResult> argumentCaptor = ArgumentCaptor.forClass(TaskResult.class);
    verify(workflowExecutor).updateTask(argumentCaptor.capture());
    assertEquals(Status.COMPLETED, argumentCaptor.getValue().getStatus());
    assertEquals("testMessage", argumentCaptor.getValue().getOutputData().get("conductor.event.messageId"));
    assertEquals("testEvent", argumentCaptor.getValue().getOutputData().get("conductor.event.name"));
    assertEquals("workflow_1", argumentCaptor.getValue().getOutputData().get("workflowId"));
    assertEquals("task_1", argumentCaptor.getValue().getOutputData().get("taskId"));
}