@JsonIgnore
  public long deriveInstanceStepConcurrency() {
    Long stepConcurrency = runProperties.getStepConcurrency();
    // if both are set, should return the smaller one
    if (instanceStepConcurrency != null && stepConcurrency != null) {
      return Math.min(instanceStepConcurrency, stepConcurrency);
    }
    return ObjectHelper.valueOrDefault(
        ObjectHelper.valueOrDefault(instanceStepConcurrency, stepConcurrency),
        Defaults.DEFAULT_STEP_CONCURRENCY);
  }
@Test
  public void testDeriveInstanceStepConcurrency() throws Exception {
    WorkflowSummary summary =
        loadObject("fixtures/parameters/sample-wf-summary-params.json", WorkflowSummary.class);

    // use default if no concurrences are set
    assertEquals(Defaults.DEFAULT_STEP_CONCURRENCY, summary.deriveInstanceStepConcurrency());

    // use properties' step concurrency
    summary.getRunProperties().setStepConcurrency(10L);
    assertEquals(10L, summary.deriveInstanceStepConcurrency());

    // use workflow instance step concurrency
    summary.getRunProperties().setStepConcurrency(null);
    summary.setInstanceStepConcurrency(20L);
    assertEquals(20L, summary.deriveInstanceStepConcurrency());

    // use the min of both concurrences
    summary.getRunProperties().setStepConcurrency(10L);
    summary.setInstanceStepConcurrency(20L);
    assertEquals(10L, summary.deriveInstanceStepConcurrency());
  }