IntegerRule

Functions

Link copied to clipboard
fun between(min: Int, max: Int): IntegerRule

Validate that the element is (inclusive) between min and max.

Link copied to clipboard
fun <R : ValidationRule<Int>> R.either(vararg option: Int): R

Validate that the element should be equal to one of the elements in option given that it is set.

Link copied to clipboard
fun <R : ValidationRule<Int>> R.exactly(value: Int): R

Validate that the element should be equal to value given that it is set.

Link copied to clipboard
fun <R : ValidationRule<Int>> R.given(precondition: (Int?) -> Boolean, rule: R.() -> R): R

Validate rule only if precondition evaluates to true.

Link copied to clipboard
fun <R : ValidationRule<Int>> R.holds(message: (Int?) -> String = { "Was supposed to hold for '$it' but did not" }, predicate: (Int?) -> Boolean): R

Validate that predicate evaluates to true.

Link copied to clipboard
fun max(value: Int): IntegerRule

Validate that the element is less than or equal to value.

Link copied to clipboard
fun min(value: Int): IntegerRule

Validate that the element is greater than or equal to value.

Link copied to clipboard
fun <R : ValidationRule<Int>> R.not(message: String, rule: R.() -> R): R

Validate that the rule does not hold.

Link copied to clipboard
fun <V, R : ValidationRule<Int>> R.optional(value: (Int?) -> V?, rule: R.() -> R): R

Validate rule only if the evaluated result of value is not null.

Link copied to clipboard

Validate that the element is set.

Link copied to clipboard
fun <R : ValidationRule<Int>> R.since(date: LocalDate, rule: R.() -> R): R

Validate rule only if date has been in the past.

Link copied to clipboard

Validate that the element is not set.

Link copied to clipboard
fun validate(fixture: Int?): ValidationResult

Execute the given rule(s) on the fixture.