ContactRule

class ContactRule : ValidationRule<Contact> (source)

Functions

Link copied to clipboard
fun <R : ValidationRule<Contact>> R.either(vararg option: Contact): 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 email(description: String = "", rule: StringRule.() -> StringRule): ContactRule
Link copied to clipboard
fun <R : ValidationRule<Contact>> R.exactly(value: Contact): R

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

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

Validate rule only if precondition evaluates to true.

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

Validate that predicate evaluates to true.

Link copied to clipboard
fun name(description: String = "", rule: StringRule.() -> StringRule): ContactRule
Link copied to clipboard
fun <R : ValidationRule<Contact>> R.not(message: String, rule: R.() -> R): R

Validate that the rule does not hold.

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

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

Link copied to clipboard
fun <R : ValidationRule<Contact>> R.required(): R

Validate that the element is set.

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

Validate rule only if date has been in the past.

Link copied to clipboard
fun <R : ValidationRule<Contact>> R.unspecified(): R

Validate that the element is not set.

Link copied to clipboard
fun url(description: String = "", rule: URLRule.() -> URLRule): ContactRule
Link copied to clipboard
fun validate(fixture: Contact?): ValidationResult

Execute the given rule(s) on the fixture.