doc / ch.tutteli.atrium.api.cc.en_GB / messageContains

messageContains

fun <T : Throwable> Assert<T>.messageContains(expected: Any, vararg otherExpected: Any): Unit (source)

Creates the assertion that the Throwable's message is not null (see message) contains expected's toString representation and the toString representation of the otherExpected (if given), using a non disjoint search.

It is a shortcut for message { contains.atLeast(1).values(expected, otherExpected) }

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

Exceptions

AssertionError - Might throw an AssertionError in case message is null or does not contain expected or otherExpected.

Return
Notice, that this assertion function cannot provide a fluent API because it depends on whether the first assertion message is not null) holds or not.