
net.serenitybdd.screenplay.questions.QuestionWithDefinedSubject 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.questions;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.Performable;
import net.serenitybdd.screenplay.Question;
import java.util.ArrayList;
import java.util.List;
import static net.serenitybdd.screenplay.Actor.ErrorHandlingMode.IGNORE_EXCEPTIONS;
public class QuestionWithDefinedSubject implements Question {
private final Question theQuestion;
private final String subject;
private final List precedingTasks;
public QuestionWithDefinedSubject(Question theQuestion, String subject, List precedingTasks) {
this.theQuestion = theQuestion;
this.subject = subject;
this.precedingTasks = precedingTasks;
}
public QuestionWithDefinedSubject(Question theQuestion, String subject) {
this(theQuestion,subject, new ArrayList<>());
}
@Override
public T answeredBy(Actor actor) {
actor.attemptsTo(IGNORE_EXCEPTIONS,precedingTasks.toArray(new Performable[]{}));
return theQuestion.answeredBy(actor);
}
@Override
public String getSubject() {
return subject;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy