Scoop API

scoop:scoop.test:0.1.0

assertFailsWith

function assertFailsWith

source · line 8
public
public fun <E : Throwable> assertFailsWith(message: String? = None, location: SourceLocation = currentSourceLocation(), block: () -> Unit): E

Runs the block and returns the thrown exception if it has the requested type. Normal return or another exception type produces AssertionFailure; a mismatched exception is retained as its cause.