kotest-assertions / io.kotest.assertions / ErrorCollector

ErrorCollector

object ErrorCollector

Functions

clear

Clears all errors from the current context.

fun clear(): Unit

clueContext

Returns the current clue context. That is all the clues nested to this point.

fun clueContext(): List<Any>

errors

Returns the errors accumulated in the current context.

fun errors(): List<Throwable>

getCollectionMode

fun getCollectionMode(): ErrorCollectionMode

popClue

fun popClue(): Unit

pushClue

fun pushClue(clue: Any): Unit

pushError

Adds the given error to the current context.

fun pushError(t: Throwable): Unit

setCollectionMode

fun setCollectionMode(mode: ErrorCollectionMode): Unit

Extension Functions

collectOrThrow

If we are in "soft assertion mode" will add this throwable to the list of throwables for the current execution. Otherwise will throw immediately.

fun ErrorCollector.collectOrThrow(error: Throwable): Unit

throwCollectedErrors

The errors for the current execution are thrown as a single throwable.

fun ErrorCollector.throwCollectedErrors(): Unit