
net.serenitybdd.screenplay.ensure.Ensure.kt Maven / Gradle / Ivy
@file:JvmName("Ensure")
package net.serenitybdd.screenplay.ensure
import net.serenitybdd.core.pages.PageObject
import net.serenitybdd.screenplay.Actor
import net.serenitybdd.screenplay.Performable
import net.serenitybdd.screenplay.Question
import net.serenitybdd.screenplay.ensure.web.PageObjectEnsure
import net.serenitybdd.screenplay.ensure.web.TargetEnsure
import net.serenitybdd.screenplay.targets.Target
import org.openqa.selenium.By
import java.time.LocalDate
import java.time.LocalTime
fun that(value: String?) = StringEnsure(value)
fun that(value: LocalDate?) = DateEnsure(value)
fun that(value: LocalTime?) = TimeEnsure(value)
fun that(value: Boolean?) = BooleanEnsure(value)
fun that(value: Float?) = FloatEnsure(value)
fun that(value: Double?) = DoubleEnsure(value)
fun that(value: Comparable) = ComparableEnsure(value)
fun that(value: Collection?) = CollectionEnsure(value)
fun thatTheAnswerTo(description: String, question: Question) = BooleanEnsure(KnowableBooleanAnswer(question, description))
fun thatTheAnswerTo(question: Question) = BooleanEnsure(KnowableBooleanAnswer(question, question.subject))
fun thatTheAnswerTo(description: String, question: Question) = StringEnsure(KnowableStringAnswer(question, description))
fun thatTheAnswerTo(question: Question) = StringEnsure(KnowableStringAnswer(question, question.subject))
fun > thatTheAnswerTo(description: String, question: Question) =
ComparableEnsure(KnowableComparableAnswer(question, description), null, description)
fun > thatTheAnswerTo(question: Question) = thatTheAnswerTo(question.subject, question)
fun thatTheAnswersTo(description: String, question: Question>) =
CollectionEnsure(KnowableCollectionAnswer(question, description), description)
fun thatTheAnswersTo(question: Question>) = thatTheAnswersTo(question.subject, question)
fun thatTheCurrentPage() = PageObjectEnsure()
fun that(value: Target) = TargetEnsure(value)
fun that(value: By) = TargetEnsure(value)
// Collection matchers
fun thatTheSetOf(value: Target) = CollectionEnsure(KnowableCollectionTarget(value), "a collection of ${KnowableCollectionTarget(value)}")
fun thatTheSetOf(value: By) = CollectionEnsure(KnowableCollectionTarget(value), "a collection of ${KnowableCollectionTarget(value)}")
fun thatAmongst(value: Target) = CollectionEnsure(KnowableCollectionTarget(value), "a collection of ${KnowableCollectionTarget(value)}")
fun thatAmongst(value: By) = CollectionEnsure(KnowableCollectionTarget(value), "a collection of ${KnowableCollectionTarget(value)}")
///**
// * Ensure something
// */
//fun that(description: String, check: Consumer) = net.serenitybdd.rest.Ensure.that(description, check)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy