private DefaultWorkflowContext buildWorkflowContext() {
   DefaultWorkflowContext context = new DefaultWorkflowContext();
   context.setValue(
       CreateFlexRequestStepParameter.IN.CONGESTION_POINT_ENTITY_ADDRESS.name(),
       CONGESTION_POINT_ENTITY_ADDRESS);
   context.setValue(CreateFlexRequestStepParameter.IN.PERIOD.name(), PTU_DATE);
   context.setValue(
       CreateFlexRequestStepParameter.IN.GRID_SAFETY_ANALYSIS_DTO.name(),
       buildGridSafetyAnalysisList());
   return context;
 }
  @Test
  public void testInvoke() {
    DefaultWorkflowContext context = buildWorkflowContext();
    dsoCreateFlexRequest.invoke(context);
    @SuppressWarnings("unchecked")
    List<FlexRequestDto> flexRequestDtos =
        (List<FlexRequestDto>)
            context.getValue(CreateFlexRequestStepParameter.OUT.FLEX_REQUESTS_DTO_LIST.name());
    Assert.assertNotNull("Did not expect a null array of FlexRequest.", flexRequestDtos);

    switch (flexRequestDtos.size()) {
      case 1:
        Assert.assertEquals(
            TEST_POWER, flexRequestDtos.get(0).getPtus().get(0).getPower().longValue());
        break;
      case 2:
        Assert.assertEquals(
            TEST_POWER_60, flexRequestDtos.get(0).getPtus().get(0).getPower().longValue());
        Assert.assertEquals(
            TEST_POWER_40, flexRequestDtos.get(1).getPtus().get(0).getPower().longValue());
        break;
    }
  }