public void parseStepParameter(
      Map<String, Map<String, Object>> allStepOutputData,
      Map<String, Parameter> workflowParams,
      Map<String, Parameter> stepParams,
      Parameter param,
      String stepId) {
    parseStepParameter(
        allStepOutputData, workflowParams, stepParams, param, stepId, new HashSet<>());
  }
@Test
  public void testParseStepParameterWithInvalidReference() {
    AssertHelper.assertThrows(
        "cannot find a step id or signal instance",
        MaestroInvalidExpressionException.class,
        "Expression evaluation throws an exception",
        () ->
            paramEvaluator.parseStepParameter(
                Collections.singletonMap("step1", Collections.emptyMap()),
                Collections.emptyMap(),
                Collections.singletonMap("foo", StringParameter.builder().value("123").build()),
                StringParameter.builder().name("bar").expression("step2__foo + '-1';").build(),
                "step1"));

    AssertHelper.assertThrows(
        "step id is ambiguous",
        MaestroInternalError.class,
        "reference [step2___foo] cannot be parsed due to ambiguity (both step ids [step2] and [step2_] exist",
        () ->
            paramEvaluator.parseStepParameter(
                twoItemMap("step2", Collections.emptyMap(), "step2_", Collections.emptyMap()),
                Collections.emptyMap(),
                Collections.emptyMap(),
                StringParameter.builder().name("bar").expression("step2___foo + '-1';").build(),
                "step1"));

    AssertHelper.assertThrows(
        "cannot find a step id",
        MaestroInternalError.class,
        "reference [step3___foo] cannot be parsed as cannot find either step id [step3] or [step3_]",
        () ->
            paramEvaluator.parseStepParameter(
                Collections.singletonMap("step2", Collections.emptyMap()),
                Collections.emptyMap(),
                Collections.emptyMap(),
                StringParameter.builder().name("bar").expression("step3___foo + '-1';").build(),
                "step1"));

    AssertHelper.assertThrows(
        "cannot find a step id",
        MaestroInternalError.class,
        "reference [step3____foo] cannot be parsed as cannot find either step id [step3] or [step3_]",
        () ->
            paramEvaluator.parseStepParameter(
                Collections.singletonMap("step2", Collections.emptyMap()),
                Collections.emptyMap(),
                Collections.emptyMap(),
                StringParameter.builder().name("bar").expression("step3____foo + '-1';").build(),
                "step1"));
  }