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

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

package ch.tutteli.atrium.creating

import ch.tutteli.atrium.assertions.Assertion
import ch.tutteli.atrium.core.ExperimentalNewExpectTypes
import ch.tutteli.atrium.core.Option
import ch.tutteli.atrium.creating.impl.FeatureExpectImpl
import ch.tutteli.atrium.reporting.BUG_REPORT_URL
import ch.tutteli.atrium.reporting.translating.Translatable

/**
 * Represents an [Expect] which results due to a feature extraction from he subject of the expectation.
 */
interface FeatureExpect : Expect {

    companion object {

        @ExperimentalComponentFactoryContainer
        @ExperimentalNewExpectTypes
        operator fun  invoke(
            previousExpect: Expect,
            maybeSubject: Option,
            description: Translatable,
            assertions: List,
            featureExpectOptions: FeatureExpectOptions
        ): FeatureExpect =
            FeatureExpectImpl(previousExpect, maybeSubject, description, assertions, featureExpectOptions)

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

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy