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

net.serenitybdd.screenplay.questions.MaxQuestion 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.Question;
import net.serenitybdd.screenplay.annotations.Subject;

import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;

@Subject("the maximum value of #listQuestion")
public class MaxQuestion> implements Question {

    private final Question> listQuestion;
    private final Comparator comparator;

    public MaxQuestion(Question> listQuestion) {
        this(listQuestion, null);
    }

    public MaxQuestion(Question> listQuestion, Comparator comparator) {
        this.listQuestion = listQuestion;
        this.comparator = comparator;
    }

    @Override
    public T answeredBy(Actor actor) {
        return Collections.max(listQuestion.answeredBy(actor), comparator);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy