
net.serenitybdd.screenplay.questions.SortedQuestion 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.Question;
import net.serenitybdd.screenplay.annotations.Subject;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@Subject("the minimum value of #listQuestion")
public class SortedQuestion> implements Question> {
private final Question extends List> listQuestion;
private final Comparator super T> comparator;
public SortedQuestion(Question extends List> listQuestion) {
this(listQuestion, null);
}
public SortedQuestion(Question extends List> listQuestion, Comparator super T> comparator) {
this.listQuestion = listQuestion;
this.comparator = comparator;
}
@Override
public List answeredBy(Actor actor) {
List sortedItems = new ArrayList<>(listQuestion.answeredBy(actor));
Collections.sort(sortedItems, comparator);
return sortedItems;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy