maxSize

fun <V> ArrayRuleBuilder<V>.maxSize(limit: Int, message: () -> String)

Validates that the array size is no more than limit.

Usage:

rules<Array<String>> {
maxSize(20) { "must have at no more 20 items" }
}

Parameters

limit

The maximum number of elements the array can have.

message

The message to return when the test fails.


fun <V> CollectionRuleBuilder<V>.maxSize(limit: Int, message: () -> String)

Validates that the collection size is no more than limit.

Usage:

rules<Collection<String>> {
maxSize(20) { "must have at no more 20 items" }
}

Parameters

limit

The maximum number of elements the collection can have.

message

The message to return when the test fails.