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

net.serenitybdd.screenplay.questions.ConsequenceGroup 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.BaseConsequence;
import net.serenitybdd.screenplay.Question;
import net.serenitybdd.screenplay.QuestionSubject;

public class ConsequenceGroup extends BaseConsequence {

    private final Question questionGroup;
    private final String subject;

    public  ConsequenceGroup(Question questionGroup) {
        this.questionGroup = questionGroup;
        this.subject = QuestionSubject.fromClass(questionGroup.getClass()).andQuestion(questionGroup).subject();
    }

    @Override
    public void evaluateFor(Actor actor) {
        performSetupActionsAs(actor);
        questionGroup.answeredBy(actor);
    }

    @Override
    public String toString() {
        String template = explanation.orElse("Then %s");
        return addRecordedInputValuesTo(String.format(template, subjectText.orElse(subject)));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy