
net.serenitybdd.screenplay.GivenWhenThen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of serenity-screenplay Show documentation
Show all versions of serenity-screenplay Show documentation
Support for the User Journey pattern in Serenity
package net.serenitybdd.screenplay;
import com.beust.jcommander.internal.Lists;
import org.hamcrest.Matcher;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
public class GivenWhenThen {
public static T givenThat(T actor) {
return actor;
}
public static Actor andThat(Actor actor) {return actor; }
public static Actor when(Actor actor) { return actor; }
public static Actor then(Actor actor) { return actor; }
public static Actor and(Actor actor) { return actor; }
public static Actor but(Actor actor) { return actor; }
public static void then(T actual, Matcher super T> matcher) {
assertThat(actual, matcher);
}
public static Consequence seeThat(Question extends T> actual, Matcher expected) {
return new QuestionConsequence(actual, expected);
}
public static Consequence seeThat(Question actual) {
return new BooleanQuestionConsequence(actual);
}
public static Consequence[] seeThat(Question extends T> actual, Matcher... expectedMatchers) {
List> consequences = Lists.newArrayList();
for(Matcher matcher : expectedMatchers) {
consequences.add(new QuestionConsequence(actual, matcher));
}
return consequences.toArray(new Consequence[]{});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy