assertk.assertions / matchesPredicate

matchesPredicate

fun <T> Assert<T>.matchesPredicate(f: (T) -> Boolean): Unit

Platform and version requirements: Common

Asserts if the values satisfies the predicate provided.

val divisibleBy5 : (Int) -> Boolean = { it % 5 == 0 }
assert(10).matchesPredicate(divisibleBy5)