public WorkflowInstance getWorkflowInstanceRun(String workflowId, long instanceId, long runId) {
    WorkflowInstance ret =
        withMetricLogError(
            () ->
                withRetryableQuery(
                    runId == Constants.LATEST_ONE
                        ? GET_LATEST_WORKFLOW_INSTANCE_RUN_QUERY
                        : GET_WORKFLOW_INSTANCE_QUERY,
                    stmt -> {
                      int idx = 0;
                      stmt.setString(++idx, workflowId);
                      stmt.setLong(++idx, instanceId);
                      if (runId != Constants.LATEST_ONE) {
                        stmt.setLong(++idx, runId);
                      }
                    },
                    result -> {
                      if (result.next()) {
                        return workflowInstanceFromResult(result);
                      }
                      return null;
                    }),
            "getWorkflowInstance",
            "Failed to get the workflow instance for [{}][{}][{}]",
            workflowId,
            instanceId,
            runId);
    if (ret == null) {
      throw new MaestroNotFoundException(
          "workflow instance [%s][%s][%s] not found (either not created or deleted)",
          workflowId, instanceId, runId);
    }
    return ret;
  }
@Test
  public void testGetWorkflowInstanceRun() {
    WorkflowInstance instanceRun =
        instanceDao.getWorkflowInstanceRun(
            wfi.getWorkflowId(), wfi.getWorkflowInstanceId(), wfi.getWorkflowRunId());
    instanceRun.setModifyTime(null);
    assertEquals(wfi, instanceRun);
  }