kotlin-test's assertNotNull lets the compiler know...
# announcements
d
kotlin-test's assertNotNull lets the compiler know that whatever is passed to it is not null afterwards, while junit's assertNotNull does not. Why is it like that?
c
its probably using contracts. look here https://kotlinlang.org/docs/reference/whatsnew13.html
p
yes
Copy code
/** Asserts that the [actual] value is not `null`, with an optional [message]. */
fun <T : Any> assertNotNull(actual: T?, message: String? = null): T {
    contract { returns() implies (actual != null) }
    asserter.assertNotNull(message, actual)
    return actual!!
}
d
Thanks a lot guys!