net.serenitybdd.screenplay.questions.MinQuestion Maven / Gradle / Ivy
package net.serenitybdd.screenplay.questions;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.Question;
import net.serenitybdd.screenplay.annotations.Subject;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@Subject("the minimum value of #listQuestion")
public class MinQuestion> implements Question {
private final Question extends Collection> listQuestion;
private final Comparator super T> comparator;
public MinQuestion(Question extends Collection> listQuestion) {
this(listQuestion, null);
}
public MinQuestion(Question extends Collection> listQuestion, Comparator super T> comparator) {
this.listQuestion = listQuestion;
this.comparator = comparator;
}
@Override
public T answeredBy(Actor actor) {
return Collections.min(listQuestion.answeredBy(actor), comparator);
}
}