@Test
public void testPopulateWorkflowAndTaskData() {

    String workflowInputPath = "workflow/input/test.json";
    String taskInputPath = "task/input/test.json";
    String taskOutputPath = "task/output/test.json";
    Map<String, Object> workflowParams = new HashMap<>();
    workflowParams.put("key1", "value1");
    workflowParams.put("key2", 100);
    when(externalPayloadStorageUtils.downloadPayload(workflowInputPath)).thenReturn(workflowParams);
    Map<String, Object> taskInputParams = new HashMap<>();
    taskInputParams.put("key", "taskInput");
    when(externalPayloadStorageUtils.downloadPayload(taskInputPath)).thenReturn(taskInputParams);
    Map<String, Object> taskOutputParams = new HashMap<>();
    taskOutputParams.put("key", "taskOutput");
    when(externalPayloadStorageUtils.downloadPayload(taskOutputPath)).thenReturn(taskOutputParams);
    Task task = new Task();
    task.setExternalInputPayloadStoragePath(taskInputPath);
    task.setExternalOutputPayloadStoragePath(taskOutputPath);
    Workflow workflow = new Workflow();
    workflow.setExternalInputPayloadStoragePath(workflowInputPath);
    workflow.getTasks().add(task);
    Workflow workflowInstance = deciderService.populateWorkflowAndTaskData(workflow);
    assertNotNull(workflowInstance);
    assertTrue(workflow.getInput().isEmpty());
    assertNotNull(workflowInstance.getInput());
    assertEquals(workflowParams, workflowInstance.getInput());
    assertTrue(workflow.getTasks().get(0).getInputData().isEmpty());
    assertNotNull(workflowInstance.getTasks().get(0).getInputData());
    assertEquals(taskInputParams, workflowInstance.getTasks().get(0).getInputData());
    assertTrue(workflow.getTasks().get(0).getOutputData().isEmpty());
    assertNotNull(workflowInstance.getTasks().get(0).getOutputData());
    assertEquals(taskOutputParams, workflowInstance.getTasks().get(0).getOutputData());
    assertNull(workflowInstance.getExternalInputPayloadStoragePath());
    assertNull(workflowInstance.getTasks().get(0).getExternalInputPayloadStoragePath());
    assertNull(workflowInstance.getTasks().get(0).getExternalOutputPayloadStoragePath());
}