HeaderRule

class HeaderRule(group: RuleGroup = RuleGroup.unknown()) : ValidationRule<Header> (source)

Constructors

Link copied to clipboard
constructor(group: RuleGroup = RuleGroup.unknown())

Functions

Link copied to clipboard
fun content(description: String = "", rule: ContentRule.() -> ContentRule): HeaderRule
Link copied to clipboard
fun deprecated(description: String = "", rule: BooleanRule.() -> BooleanRule): HeaderRule
Link copied to clipboard
fun description(description: String = "", rule: StringRule.() -> StringRule): HeaderRule
Link copied to clipboard
fun <R : ValidationRule<Header>> R.either(vararg option: Header): 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<Header>> R.exactly(value: Header): R

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

Link copied to clipboard
fun example(description: String = "", rule: AnyRule.() -> AnyRule): HeaderRule
Link copied to clipboard
fun examples(description: String = "", rule: ExamplesRule.() -> ExamplesRule): HeaderRule
Link copied to clipboard
fun explode(description: String = "", rule: BooleanRule.() -> BooleanRule): HeaderRule
Link copied to clipboard
fun <R : ValidationRule<Header>> R.given(precondition: (Header?) -> Boolean, rule: R.() -> R): R

Validate rule only if precondition evaluates to true.

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

Validate that predicate evaluates to true.

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

Validate that the rule does not hold.

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

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

Link copied to clipboard
fun required(description: String = "", rule: BooleanRule.() -> BooleanRule): HeaderRule
Link copied to clipboard
fun <R : ValidationRule<Header>> R.required(): R

Validate that the element is set.

Link copied to clipboard
fun schema(description: String = "", rule: SchemaRule.() -> SchemaRule): HeaderRule
Link copied to clipboard
fun <R : ValidationRule<Header>> R.since(date: LocalDate, rule: R.() -> R): R

Validate rule only if date has been in the past.

Link copied to clipboard
fun style(description: String = "", rule: EnumRule<Header.StyleEnum>.() -> EnumRule<Header.StyleEnum>): HeaderRule
Link copied to clipboard
fun <R : ValidationRule<Header>> R.unspecified(): R

Validate that the element is not set.

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

Execute the given rule(s) on the fixture.