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

main.kotlin.ch.tutteli.atrium.logic.creating.impl.rootExpectBuilderImpl.kt Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package ch.tutteli.atrium.logic.creating.impl

import ch.tutteli.atrium.core.ExperimentalNewExpectTypes
import ch.tutteli.atrium.core.Some
import ch.tutteli.atrium.creating.RootExpect
import ch.tutteli.atrium.creating.RootExpectOptions
import ch.tutteli.atrium.logic.creating.RootExpectBuilder
import ch.tutteli.atrium.reporting.translating.Translatable

class ExpectationVerbStepImpl(override val subject: T) : RootExpectBuilder.ExpectationVerbStep {
    override fun withVerb(verb: Translatable): RootExpectBuilder.OptionsStep =
        RootExpectBuilder.OptionsStep(subject, verb)
}

class OptionsStepImpl(
    override val subject: T,
    override val expectationVerb: Translatable
) : RootExpectBuilder.OptionsStep {

    @ExperimentalNewExpectTypes
    override fun withOptions(rootExpectOptions: RootExpectOptions): RootExpectBuilder.FinalStep =
        toFinalStep(rootExpectOptions)

    @ExperimentalNewExpectTypes
    override fun withoutOptions(): RootExpectBuilder.FinalStep = toFinalStep(null)

    @ExperimentalNewExpectTypes
    private fun toFinalStep(rootExpectOptions: RootExpectOptions?) =
        RootExpectBuilder.FinalStep(subject, expectationVerb, rootExpectOptions)
}

@ExperimentalNewExpectTypes
class FinalStepImpl(
    override val subject: T,
    override val expectationVerb: Translatable,
    override val options: RootExpectOptions?
) : RootExpectBuilder.FinalStep {

    override fun build(): RootExpect = RootExpect(Some(subject), expectationVerb, options)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy