strikt-core / strikt.assertions / withFirst

withFirst

fun <T : Iterable<E>, E> Builder<T>.withFirst(block: Builder<E>.() -> Unit): Builder<T>

Runs a group of assertions on the first element in the subject iterable.

Parameters

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

Return
this builder, to facilitate chaining.

fun <T : Iterable<E>, E> Builder<T>.withFirst(predicate: (E) -> Boolean, block: Builder<E>.() -> Unit): Builder<T>

Runs a group of assertions on the first element in the subject iterable that matches predicate.

Exceptions

strikt.internal.opentest4j.MappingFailed - if no elements match predicate.

See Also

Iterable.first