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

commonMain.ch.tutteli.atrium.assertions.BasicDescriptiveAssertion.kt Maven / Gradle / Ivy

package ch.tutteli.atrium.assertions

import ch.tutteli.atrium.reporting.translating.Translatable

/**
 * A default implementation for [DescriptiveAssertion] which lazily evaluates [holds].
 *
 * @constructor Constructor overload with a lazy [BasicDescriptiveAssertion.holds].
 * @param description The [BasicDescriptiveAssertion.description].
 * @param representation The [BasicDescriptiveAssertion.representation].
 * @param test Lazily determines whether [BasicDescriptiveAssertion.holds].
 */

internal class BasicDescriptiveAssertion(
    override val description: Translatable,
    override val representation: Any,
    private val test: () -> Boolean
) : DescriptiveAssertion {

    override fun holds() = test()

    /**
     * @suppress
     */
    override fun toString() = "$description: $representation (holds=${holds().toString()})"
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy