com.pdsl.gherkin.models.GherkinBackground Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pdsl Show documentation
Show all versions of pdsl Show documentation
The Polymorphic DSL test framework was designed to solve the challenges with testing large, complex systems. Modern architecture requires software to run as distrubited systems or on multiple platforms. The conventional cost of testing these systems is quite high.
PDSL allows a user to describe the system under test using a DSL of some kind: a picture,
sentences in natural languages, graphs, etc. Using a common DSL allows someone to make deeply scalable tests. A simple change to the DSL could generate dozens of tests providing coverage through many layers of the test pyramid or even multiple applications.
package com.pdsl.gherkin.models;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
* A background that contains shared functionality with lower level {@code GherkinScenario} or {@GherkinRule}s.
*/
public class GherkinBackground {
private final Optional title;
private final Optional longDescription;
private final Optional> steps;
public GherkinBackground(Builder builder) {
this.title = builder.title.isEmpty() ? Optional.empty() : Optional.of(new GherkinString(builder.title));
this.longDescription = Optional.of(new GherkinString(builder.longDescription));
this.steps = builder.steps.isEmpty() ? Optional.empty() : Optional.of(builder.steps);
}
public Optional getTitle() {
return title;
}
public Optional getLongDescription() {
return longDescription;
}
public Optional> getSteps() {
return steps;
}
public static class Builder {
private String title = "";
private String longDescription = "";
private List steps = new ArrayList<>();
public Builder withTitle(String title) {
this.title = title;
return this;
}
public Builder withLongDescription(String longDescription) {
this.longDescription = longDescription;
return this;
}
public Builder withSteps(List steps) {
this.steps = steps;
return this;
}
public GherkinBackground build() {
return new GherkinBackground(this);
}
}
}