SchemasRule

class SchemasRule : IterableRule<Pair<String, Schema<*>>> (source)

Functions

Link copied to clipboard
fun all(description: String = "", rule: SchemaRule.() -> SchemaRule): SchemasRule
Link copied to clipboard
fun <R : IterableRule<Pair<String, Schema<*>>>> R.each(description: String = "", predicate: (Pair<String, Schema<*>>) -> Boolean): R

Validate that all elements satisfy predicate.

Link copied to clipboard
fun <R : ValidationRule<Iterable<Pair<String, Schema<*>>>>> R.either(vararg option: Iterable<Pair<String, Schema<*>>>): 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<Iterable<Pair<String, Schema<*>>>>> R.exactly(value: Iterable<Pair<String, Schema<*>>>): R

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

Link copied to clipboard
fun <R : ValidationRule<Iterable<Pair<String, Schema<*>>>>> R.given(precondition: (Iterable<Pair<String, Schema<*>>>?) -> Boolean, rule: R.() -> R): R

Validate rule only if precondition evaluates to true.

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

Validate that predicate evaluates to true.

Link copied to clipboard
fun <R : IterableRule<Pair<String, Schema<*>>>> R.none(description: String = "", predicate: (Pair<String, Schema<*>>) -> Boolean): R

Validate that no element satisfies predicate.

Link copied to clipboard
fun <R : ValidationRule<Iterable<Pair<String, Schema<*>>>>> R.not(message: String, rule: R.() -> R): R

Validate that the rule does not hold.

Link copied to clipboard
fun <V, R : ValidationRule<Iterable<Pair<String, Schema<*>>>>> R.optional(value: (Iterable<Pair<String, Schema<*>>>?) -> V?, rule: R.() -> R): R

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

Link copied to clipboard
fun <R : ValidationRule<Iterable<Pair<String, Schema<*>>>>> R.required(): R

Validate that the element is set.

Link copied to clipboard
fun schema(description: String = "", named: String, rule: SchemaRule.() -> SchemaRule): SchemasRule
Link copied to clipboard
fun <R : ValidationRule<Iterable<Pair<String, Schema<*>>>>> R.since(date: LocalDate, rule: R.() -> R): R

Validate rule only if date has been in the past.

Link copied to clipboard
fun <R : IterableRule<Pair<String, Schema<*>>>> R.some(description: String = "", predicate: (Pair<String, Schema<*>>) -> Boolean): R

Validate that at least one element satisfies predicate.

Link copied to clipboard
fun <R : ValidationRule<Iterable<Pair<String, Schema<*>>>>> R.unspecified(): R

Validate that the element is not set.

Link copied to clipboard
fun validate(fixture: Iterable<Pair<String, Schema<*>>>?): ValidationResult

Execute the given rule(s) on the fixture.