public List<Map<String, Artifact>> getBatchStepInstancesArtifactsFromList(
      String workflowId, long workflowInstanceId, Map<String, Long> stepIdToRunId) {
    List<Map<String, Long>> batches = splitMap(stepIdToRunId);

    List<Map<String, Artifact>> results = new ArrayList<>();

    for (Map<String, Long> batch : batches) {
      results.addAll(
          getBatchStepInstancesArtifactsFromListLimited(workflowId, workflowInstanceId, batch));
    }

    return results;
  }
@Test
  public void testGetBatchStepInstancesArtifactsFromList() throws IOException {
    MaestroStepInstanceDao stepDaoSpy = Mockito.spy(stepDao);
    StepInstance siSubWf = loadObject(TEST_STEP_INSTANCE_SUBWORKFLOW, StepInstance.class);
    Map<String, Long> stepIdToRunId = new LinkedHashMap<>();
    int numberOfInstancesToInsert = Constants.BATCH_SIZE_ROLLUP_STEP_ARTIFACTS_QUERY * 2 + 3;
    long runId = 1;
    for (int i = 1; i <= numberOfInstancesToInsert; i++) {
      siSubWf.setStepId("step_" + i);
      siSubWf.setWorkflowRunId(runId);
      stepIdToRunId.put("step_" + i, runId);
      stepDaoSpy.insertOrUpsertStepInstance(siSubWf, false);
      if (i == numberOfInstancesToInsert / 2) {
        runId = 2;
      }
    }

    List<Map<String, Artifact>> artifacts =
        stepDaoSpy.getBatchStepInstancesArtifactsFromList(
            siSubWf.getWorkflowId(), siSubWf.getWorkflowInstanceId(), stepIdToRunId);

    assertEquals(numberOfInstancesToInsert, artifacts.size());

    assertEquals(
        "sample-dag-test-3",
        artifacts.get(10).get("maestro_subworkflow").asSubworkflow().getSubworkflowId());
    assertNotNull(
        artifacts.get(10).get("maestro_subworkflow").asSubworkflow().getSubworkflowOverview());

    Mockito.verify(stepDaoSpy, Mockito.times(3))
        .getBatchStepInstancesArtifactsFromListLimited(
            eq(siSubWf.getWorkflowId()), eq(siSubWf.getWorkflowInstanceId()), any());
  }