Creating scenario using foreach()

I’m trying to create a Gatling scenarioBuilder like this . The following code fails at runtime , how do I use foreach() instead of forEach() ?

protected ScenarioBuilder createScenario(GatlingScenario gatlingScenario) {
        Map<String, ChainBuilder[]> groupBuilderMap = gatlingScenario.getGroupBuilderMap();
        this.scenarioBuilder = scenario(gatlingScenario.getScenarioName())
                .exec(session -> session.setAll(Map.of("timeStamp", nlocalDateTime, "baseUrl", this.baseUrl)));

        groupBuilderMap.forEach((groupName, chainBuilders) -> {
            scenarioBuilder.group(groupName).on(exec(chainBuilders));
        });

        return scenarioBuilder;
    }

@AllArgsConstructor
@Getter
public class GatlingScenario {
    private String scenarioName;
    private Map<String ,ChainBuilder[]> groupBuilderMap;

}

Hi @slandelle - could you please help me on how I should fix createScenario() , I read the documentation of foreach() , how do I iterate on a map using the foreach() ? like I do for groupBuilderMap.forEach() appreciate your help!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.