ScenarioNodeBuilder { public BasicScenarioNode buildBasicScenarioNode(final Scenario scenario, final ExampleParameter scenarioParameters, Set<String> inheritedTags, int depth) { Set<String> allTags = Sets.newHashSet(); allTags.addAll(inheritedTags); if (scenario.getTags() != null) { allTags.addAll(scenario.getTags()); } SubstepNode background = scenario.hasBackground() ? substepNodeBuilder.build(scenario.getDescription(), scenario.getBackground().getSteps(), parameters.getSyntax().getSubStepsMap(), null, scenarioParameters, true, allTags, depth + 1) : null; List<StepNode> steps = Lists.newArrayList(); if (scenario.hasSteps()) { for (Step step : scenario.getSteps()) { steps.add(substepNodeBuilder.buildStepNode(scenario.getDescription(), step, parameters.getSyntax().getSubStepsMap(), null, scenarioParameters, false, allTags, depth + 1)); } } String scenarioDescription = scenarioParameters == null ? scenario.getDescription() : SubstepNodeBuilder.substitutePlaceholders(scenario.getDescription(), scenarioParameters.getParameters()); return new BasicScenarioNode(scenarioDescription, background, steps, allTags, depth); } ScenarioNodeBuilder(TestParameters parameters); ScenarioNode<? extends IExecutionNode> build(final Scenario scenario, final Set<String> inheritedTags, int depth); OutlineScenarioNode buildOutlineScenarioNode(final Scenario scenario, Set<String> inheritedTags, int depth); BasicScenarioNode buildBasicScenarioNode(final Scenario scenario, final ExampleParameter scenarioParameters,
                                                    Set<String> inheritedTags, int depth);  }
@Test public void testBasicScenarioBuilding(){ Scenario scenario = new Scenario(); scenario.setDescription("a test description with a <param>"); Map parameters = ImmutableMap.of("param", "Parameter"); ExampleParameter scenarioParameters = new ExampleParameter(5, parameters); TestParameters params = null; ScenarioNodeBuilder builder = new ScenarioNodeBuilder(params); BasicScenarioNode basicScenarioNode = builder.buildBasicScenarioNode(scenario, scenarioParameters, Collections.emptySet(), 1); Assert.assertThat(basicScenarioNode.getDescription() , is("a test description with a Parameter")); Scenario scenario2 = new Scenario(); scenario2.setDescription("a test description without any parameters"); BasicScenarioNode basicScenarioNode2 = builder.buildBasicScenarioNode(scenario2, scenarioParameters, Collections.emptySet(), 1); Assert.assertThat(basicScenarioNode2.getDescription() , is("a test description without any parameters")); }