interface ExpectationBuilder: Any

Receiver for expect providing functions that define assertion subjects and create assertion chains or blocks.

Methods

that

abstract fun <T> that(subject: T): DescribeableBuilder<T>

Start a chain of assertions over subject.

Parameters

Name Description
subject: T

the subject of the chain of assertions.

ReturnValue

Name Description
DescribeableBuilder<T>

an assertion for subject.

that

abstract fun <T> that(subject: T, block: Builder<T>.()->Unit): DescribeableBuilder<T>

Evaluate a block of assertions over subject.

Parameters

Name Description
subject: T

the subject of the block of assertions.

block: Builder<T>.()->Unit

a closure that can perform multiple assertions that will all be evaluated regardless of whether preceding ones pass or fail.

ReturnValue

Name Description
DescribeableBuilder<T>

an assertion for subject.

catching

abstract fun <T> catching(action: suspend ()->T): DescribeableBuilder<Result<T>>

Start a chain of assertions over the result of action.

Parameters

Name Description
action: suspend ()->T

an action that may result in a value being returned or an exception being thrown.

ReturnValue

Name Description
DescribeableBuilder<Result<T>>

an assertion for the result of action.