assertk / assertk.assertions / matchesPredicate

matchesPredicate

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

Asserts if the values satisfies the predicate provided.

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