assertk.assertions / isNotNull

isNotNull

fun <T : Any> Assert<T?>.isNotNull(f: (Assert<T>) -> Unit): Unit
Deprecated: Use isNotNull() instead

Platform and version requirements: Common

Asserts the value is not null. You can pass in an optional lambda to run additional assertions on the non-null value.

val name: String? = ...
assertThat(name).isNotNull() {
  it.hasLength(4)
}
fun <T : Any> Assert<T?>.isNotNull(): Assert<T>

Platform and version requirements: Common

Asserts the value is not null. You can pass in an optional lambda to run additional assertions on the non-null value.

val name: String? = ...
assertThat(name).isNotNull().hasLength(4)