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

commonMain.ch.tutteli.atrium.creating.RootExpect.kt Maven / Gradle / Ivy

package ch.tutteli.atrium.creating

import ch.tutteli.atrium.core.ExperimentalNewExpectTypes
import ch.tutteli.atrium.core.Option
import ch.tutteli.atrium.creating.impl.RootExpectImpl
import ch.tutteli.atrium.reporting.BUG_REPORT_URL
import ch.tutteli.atrium.reporting.translating.Translatable

/**
 * Represents the root of an [Expect] chain, intended as extension point for functionality
 * which should only be available on the root.
 */
interface RootExpect : Expect {

    companion object {
        @ExperimentalNewExpectTypes
        operator fun  invoke(
            maybeSubject: Option,
            assertionVerb: Translatable,
            options: RootExpectOptions?
        ): RootExpect = RootExpectImpl(maybeSubject, assertionVerb, options)

        @ExperimentalNewExpectTypes
        /**
         * Use this overload if you want to modify the options of a [RootExpect].
         */
        operator fun  invoke(
            rootExpect: RootExpect,
            options: RootExpectOptions
        ): RootExpect = when (rootExpect) {
            is RootExpectImpl -> RootExpectImpl(rootExpect, options)
            else -> throw UnsupportedOperationException("Please open an issue that a hook shall be implemented: $BUG_REPORT_URL?template=feature_request&title=Hook%20for%20RootExpect%20creation")
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy