assertk / assertk.assertions / isInstanceOf

isInstanceOf

(common, jvm) fun <T : Any, S : T> Assert<T>.isInstanceOf(kclass: KClass<S>): Assert<S>

Asserts the value is an instance of the expected kotlin class. Both assertThat("test").isInstanceOf(String::class) and assertThat("test").isInstanceOf(Any::class) is successful.

See Also

isNotInstanceOf

hasClass

(jvm) fun <T : Any, S : T> Assert<T>.isInstanceOf(jclass: Class<S>): Assert<S>

Asserts the value is an instance of the expected java class. Both assertThat("test").isInstanceOf(String::class.java) and assertThat("test").isInstanceOf(Any::class.java) is successful.

See Also

isNotInstanceOf

hasClass