test

fun <V : Any> ObjectRuleBuilder<V>.test(predicate: V.() -> Boolean, message: () -> String)

Validates that the object value passes the given predicate.

Usage:

rules<Post> {
test({ title.isNotBlank() }) { "Title must be not blank" }
}

Parameters

predicate

The predicate to test the object value. Returns true if the test passes; false otherwise.

message

The message to return when the test fails.