EncodingRule

class EncodingRule(group: RuleGroup = RuleGroup.unknown()) : ValidationRule<Encoding> (source)

Constructors

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

Functions

Link copied to clipboard
fun allowReserved(description: String = "", rule: BooleanRule.() -> BooleanRule): EncodingRule
Link copied to clipboard
fun contentType(description: String = "", rule: StringRule.() -> StringRule): EncodingRule
Link copied to clipboard
fun <R : ValidationRule<Encoding>> R.either(vararg option: Encoding): 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<Encoding>> R.exactly(value: Encoding): R

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

Link copied to clipboard
fun explode(description: String = "", rule: BooleanRule.() -> BooleanRule): EncodingRule
Link copied to clipboard
fun <R : ValidationRule<Encoding>> R.given(precondition: (Encoding?) -> Boolean, rule: R.() -> R): R

Validate rule only if precondition evaluates to true.

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

Validate that predicate evaluates to true.

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

Validate that the rule does not hold.

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

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

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

Validate that the element is set.

Link copied to clipboard
fun <R : ValidationRule<Encoding>> 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<Encoding.StyleEnum>.() -> EnumRule<Encoding.StyleEnum>): EncodingRule
Link copied to clipboard
fun <R : ValidationRule<Encoding>> R.unspecified(): R

Validate that the element is not set.

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

Execute the given rule(s) on the fixture.