strikt-core / strikt.api / Assertion / Builder / get

get

open fun <R> get(function: T.() -> R): DescribeableBuilder<R>

Maps the assertion subject to the result of function. This is useful for chaining to property values or method call results on the subject.

If function is a callable reference, (for example a getter or property reference) the subject description will be automatically determined for the returned assertion builder.

If function is a lambda, Strikt will make a best-effort attempt to determine an appropriate function / property name.

Parameters

function - a lambda whose receiver is the current assertion subject.

Return
an assertion builder whose subject is the value returned by function.

abstract fun <R> get(description: String, function: T.() -> R): DescribeableBuilder<R>

Maps the assertion subject to the result of function. This is useful for chaining to property values or method call results on the subject.

Parameters

description - a description of the mapped result.

function - a lambda whose receiver is the current assertion subject.

Return
an assertion builder whose subject is the value returned by function.