assertIs

inline fun <T> assertIs(value: Any?, message: String? = null): T(source)

Asserts that value is of type T, with an optional message.

Note that due to type erasure the type check may be partial (e.g. assertIs<List<String>>(value) only checks for the class being List and not the type of its elements because it's erased).

Since Kotlin

1.5

inline fun <T> assertIs(value: Any?, lazyMessage: () -> String): T(source)

Asserts that value is of type T, with an error message generated by the lazyMessage lambda otherwise.

Note that due to type erasure the type check may be partial (e.g. assertIs<List<String>>(value) only checks for the class being List and not the type of its elements because it's erased).

Since Kotlin

2.4