public static Map<String, Map<String, Object>> getAllStepOutputData(Workflow workflow) {
    return workflow.getTasks().stream()
        // step should be in terminal state and normal tasks in DAG
        .filter(TaskHelper::isValidTaskWithParamData)
        .collect(
            Collectors.toMap(
                Task::getReferenceTaskName,
                Task::getOutputData,
                // it includes retried tasks so pick the last one
                (task1, task2) -> task2));
  }
@Test
  public void testGetAllStepOutputData() {
    when(workflow.getTasks()).thenReturn(Collections.singletonList(task));
    when(task.getTaskType()).thenReturn(Constants.MAESTRO_TASK_NAME);
    when(task.getReferenceTaskName()).thenReturn("test-job");
    when(task.getStatus()).thenReturn(Task.Status.COMPLETED);
    when(task.getOutputData()).thenReturn(Collections.singletonMap("foo", "bar"));
    Assert.assertEquals(
        Collections.singletonMap("test-job", Collections.singletonMap("foo", "bar")),
        TaskHelper.getAllStepOutputData(workflow));
  }