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 testInvalidUnblock() {
    when(instance.getStatus()).thenReturn(WorkflowInstance.Status.FAILED);
    when(workflowDao.getRunStrategy("test-workflow"))
        .thenReturn(RunStrategy.create("STRICT_SEQUENTIAL"));
    when(instance.getStatus()).thenReturn(WorkflowInstance.Status.STOPPED);
    AssertHelper.assertThrows(
        "can only unblock failed instance",
        MaestroInvalidStatusException.class,
        "from status [STOPPED] as it is not FAILED status",
        () -> actionHandler.unblock("test-workflow", 1, 1, user));
  }