doc / ch.tutteli.atrium.api.fluent.en_GB / messageToContain

messageToContain

fun <T : Throwable> Expect<T>.messageToContain(expected: CharSequenceOrNumberOrChar, vararg otherExpected: CharSequenceOrNumberOrChar): Expect<T> (source)

Expects that the property Throwable.message of the subject of this expectation is not null and contains expected's toString representation and the toString representation of the otherExpected (if given), using a non-disjoint search.

Notice that a runtime check applies which assures that only CharSequence, Number and Char are passed. This function expects CharSequenceOrNumberOrChar (which is a typealias for Any) for your convenience, so that you can mix String and Int for instance.

expect(RuntimeException("abc")).messageToContain("b")

fails {
    expect(RuntimeException("abc")).messageToContain("d")
}

Return
an Expect for the subject of this expectation.

Since
0.17.0