public WorkflowInstanceActionResponse unblock(
      String workflowId, long workflowInstanceId, long workflowRunId, User caller) {
    WorkflowInstance instance =
        loadInstanceForAction(
            workflowId, workflowInstanceId, workflowRunId, Actions.WorkflowInstanceAction.UNBLOCK);
    LOG.debug("Unblocking workflow instance {} by user [{}]", instance.getIdentity(), caller);

    if (instance.getStatus() != WorkflowInstance.Status.FAILED) {
      throw new MaestroInvalidStatusException(
          "Cannot unblock a workflow instance %s from status [%s] as it is not FAILED status",
          instance.getIdentity(), instance.getStatus());
    }

    TimelineEvent event =
        TimelineActionEvent.builder()
            .action(Actions.WorkflowAction.UNBLOCK)
            .author(caller)
            .reason("[API] call to UNBLOCK a failed workflow instance run.")
            .build();
    boolean updated =
        instanceDao.tryUnblockFailedWorkflowInstance(
            workflowId, workflowInstanceId, instance.getWorkflowRunId(), event);
    workflowHelper.publishStartWorkflowEvent(workflowId, updated);
    return WorkflowInstanceActionResponse.from(instance, event, updated);
  }
@Test
  public void testUnblock() {
    when(instanceDao.tryUnblockFailedWorkflowInstance(any(), anyLong(), anyLong(), any()))
        .thenReturn(true);
    when(instance.getStatus()).thenReturn(WorkflowInstance.Status.FAILED);
    when(workflowDao.getRunStrategy("test-workflow"))
        .thenReturn(RunStrategy.create("STRICT_SEQUENTIAL"));
    boolean res = actionHandler.unblock("test-workflow", 1, 1, user).isCompleted();
    assertTrue(res);
    verify(instanceDao, times(1)).getLatestWorkflowInstanceRun("test-workflow", 1);
    verify(instanceDao, times(1))
        .tryUnblockFailedWorkflowInstance(eq("test-workflow"), eq(1L), eq(1L), any());
    verify(workflowHelper, times(1)).publishStartWorkflowEvent(eq("test-workflow"), eq(true));
  }