Clarify the purpose of the message parameter of assertFailsWith

#KT-22869 Fixed
This commit is contained in:
Ilya Gorbunov
2018-09-25 09:01:34 +03:00
parent 9f9033870c
commit 21b71f3bb1
4 changed files with 22 additions and 5 deletions
@@ -32,7 +32,11 @@ private fun <T : Throwable> assertFailsWithImpl(exceptionClass: Class<T>, messag
}
/** Asserts that a [block] fails with a specific exception of type [exceptionClass] being thrown. */
/**
* Asserts that a [block] fails with a specific exception of type [exceptionClass] being thrown.
*
* If the assertion fails, the specified [message] is used unless it is null as a prefix for the failure message.
*/
actual fun <T : Throwable> assertFailsWith(exceptionClass: KClass<T>, message: String?, block: () -> Unit): T =
assertFailsWithImpl(exceptionClass.java, message, block)