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

com.chutneytesting.design.domain.scenario.compose.ComposableScenario Maven / Gradle / Ivy

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

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 ComposableScenario {

    public final List composableSteps;
    public final Map parameters;

    private ComposableScenario(List composableSteps, Map parameters) {
        this.composableSteps = composableSteps;
        this.parameters = parameters;
    }

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

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

    @Override
    public String toString() {
        return "ComposableScenario{" +
            "composableSteps=" + composableSteps +
            ", parameters=" + parameters +
            '}';
    }

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

    public static class ComposableScenarioBuilder {

        private List composableSteps;
        private Map parameters;

        private ComposableScenarioBuilder() {}

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

        public ComposableScenarioBuilder withComposableSteps(List composableSteps) {
            this.composableSteps = composableSteps;
            return this;
        }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy