assertk / AssertBlock

AssertBlock

sealed class AssertBlock<out T>

Platform and version requirements: Common

An assertion on a block of code. Can assert that it either throws and error or returns a value.

Functions

doesNotThrowAnyException

abstract fun doesNotThrowAnyException(): Unit

returnedValue

abstract fun returnedValue(f: Assert<T>.() -> Unit): Unit

Runs the given lambda if the block returns a value, otherwise fails.

thrownError

abstract fun thrownError(f: Assert<Throwable>.() -> Unit): Unit

Runs the given lambda if the block throws an error, otherwise fails.