public StepBreakpoint addStepBreakpoint(
      String workflowId,
      long version,
      long instanceId,
      long runId,
      String stepId,
      long stepAttemptId,
      User user) {
    final String revisedWorkflowId = getRevisedWorkflowId(workflowId, stepId, true);
    return withMetricLogError(
        () ->
            withRetryableTransaction(
                conn -> {
                  try (PreparedStatement stmt = conn.prepareStatement(ADD_STEP_BREAKPOINT)) {
                    int idx = 0;
                    stmt.setString(++idx, revisedWorkflowId);
                    stmt.setLong(++idx, version);
                    stmt.setLong(++idx, instanceId);
                    stmt.setLong(++idx, runId);
                    stmt.setString(++idx, stepId);
                    stmt.setLong(++idx, stepAttemptId);
                    stmt.setString(++idx, toJson(user));
                    try (ResultSet rs = stmt.executeQuery()) {
                      if (rs.next()) {
                        return stepBreakpointFromResultSet(rs);
                      } else {
                        throw new MaestroBadRequestException(
                            Collections.emptyList(),
                            "Breakpoint could not be set with identifier [%s][%d][%d][%d][%s][%d]",
                            workflowId,
                            version,
                            instanceId,
                            runId,
                            stepId,
                            stepAttemptId);
                      }
                    }
                  }
                }),
        "addStepBreakpointForStepIdentifier",
        "Failed to addStepBreakpointForStepIdentifier [{}][{}][{}][{}][{}][{}]",
        workflowId,
        version,
        instanceId,
        runId,
        stepId,
        stepAttemptId);
  }
@Test
  public void testAddStepBreakpointForAllWorkflowVersionsInvalid() {
    when(workflowDao.getWorkflowDefinition(anyString(), anyString())).thenReturn(wfd);
    AssertHelper.assertThrows(
        "invalid step",
        MaestroBadRequestException.class,
        "Breakpoint can't be set as stepId [non-exist] is not present for the workflowId"
            + " [sample-active-wf-with-props]",
        () ->
            maestroStepBreakpointDao.addStepBreakpoint(
                TEST_WORKFLOW_ID1,
                Constants.MATCH_ALL_WORKFLOW_VERSIONS,
                Constants.MATCH_ALL_WORKFLOW_INSTANCES,
                Constants.MATCH_ALL_RUNS,
                TEST_NON_EXIST_STEP_ID,
                Constants.MATCH_ALL_RUNS,
                TEST_USER));
  }