All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.chutneytesting.execution.domain.scenario.composed.ExecutableComposedScenario Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package com.chutneytesting.execution.domain.scenario.composed;

import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static java.util.Optional.ofNullable;

import java.util.List;
import java.util.Map;
import java.util.Objects;

public class ExecutableComposedScenario {

    public final List composedSteps;
    public final Map parameters;

    private ExecutableComposedScenario(List composedSteps, Map parameters) {
        this.composedSteps = composedSteps;
        this.parameters = parameters;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ExecutableComposedScenario that = (ExecutableComposedScenario) o;
        return Objects.equals(composedSteps, that.composedSteps) &&
            Objects.equals(parameters, that.parameters);
    }

    @Override
    public int hashCode() {
        return Objects.hash(composedSteps, parameters);
    }

    @Override
    public String toString() {
        return "ExecutableComposedScenario{" +
            "ExecutableComposedSteps=" + composedSteps +
            ", parameters=" + parameters +
            '}';
    }

    public static ExecutableComposedScenarioBuilder builder() {
        return new ExecutableComposedScenarioBuilder();
    }

    public static class ExecutableComposedScenarioBuilder {

        private List executableComposedSteps;
        private Map parameters;

        private ExecutableComposedScenarioBuilder() {}

        public ExecutableComposedScenario build() {
            return new ExecutableComposedScenario(
                ofNullable(executableComposedSteps).orElse(emptyList()),
                ofNullable(parameters).orElse(emptyMap())
            );
        }

        public ExecutableComposedScenarioBuilder withComposedSteps(List executableComposedSteps) {
            this.executableComposedSteps = executableComposedSteps;
            return this;
        }

        public ExecutableComposedScenarioBuilder withParameters(Map parameters) {
            this.parameters = parameters;
            return this;
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy