doc / ch.tutteli.atrium.api.infix.en_GB / because

because

infix fun <T> Expect<T>.because(keyWithCreator: KeyWithCreator<String, T>): Expect<T> (source)

Allows to state a reason for one or multiple assertions for the current subject.

expect("filename") because of("? is not allowed in file names on Windows") {
    it notToContain "?"
}

expect(customers) toHaveElementsAndAll (fun Expect<Person>.() {
    it because of("the legal age of maturity in Switzerland is 18") {
        feature { f(it::age) } toBeGreaterThanOrEqualTo 18
    }
})

Parameters

keyWithCreator - Combines the reason with the assertionCreator-lambda. Use the function of(reason) { ... } to create a KeyWithCreator.

Return
an Expect for the subject of this expectation.

Since
0.15.0