commonMain.ch.tutteli.atrium.assertions.BasicDescriptiveAssertion.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of atrium-core-jvm Show documentation
Show all versions of atrium-core-jvm Show documentation
Core module of Atrium, containing all contracts/interfaces and default implementations
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