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

messageContains

infix fun <T : Throwable> Assert<T>.messageContains(expected: Any): Unit (source)

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

It is a shortcut for message { this to contain atLeast 1 value expected }

Notice that a runtime check applies which assures that only CharSequence, Number and Char are passed (this function expects Any for your convenience.

Exceptions

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

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.

infix fun <T : Throwable> Assert<T>.messageContains(values: Values<Any>): Unit (source)

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

It is a shortcut for message { this to contain atLeast 1 the values }

Notice that a runtime check applies which assures that only CharSequence, Number and Char are passed as values (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 all the values.

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.