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

net.serenitybdd.screenplay.questions.QuestionWithDefinedSubject Maven / Gradle / Ivy

There is a newer version: 4.2.9
Show newest version
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 - 2024 Weber Informatics LLC | Privacy Policy