A matcher over com.wix.accord.GroupViolations.
A matcher over com.wix.accord.GroupViolations. To generate a violation rule "pattern", call the constructor with the required predicates, for example:
val firstNameNotEmpty = RuleViolationMatcher( description = "firstName", constraint = "must not be empty" )
val lastNameNotEmpty = RuleViolationMatcher( description = "lastName", constraint = "must not be empty" )
val orPredicateFailed = GroupViolationMatcher( constraint = "doesn't meet any of the requirements",
violations = firstNameNotEmpty :: lastNameNotEmpty :: Nil )
val validationResult: Result = ...
validationResult must failWith( orPredicateFailed )
A predicate specifying the object under validation.
A predicate specifying the constraint being violated.
A predicate specifying the description of the object being validated.
The set of violations that comprise the group being validated.
com.wix.accord.GroupViolation
A matcher over validation com.wix.accord.Results.
A matcher over validation com.wix.accord.Results. Takes a set of expected violations and return a suitable match result in case of failure.
The set of expected violations for this matcher.
A matcher over com.wix.accord.RuleViolations.
A matcher over com.wix.accord.RuleViolations. To generate a violation rule "pattern", call the constructor with the required predicates, for example:
val firstNameNotEmpty = RuleViolationMatcher( description = "firstName", constraint = "must not be empty" )
val validationResult: Result = ...
validationResult must failWith( firstNameNotEmpty )
A predicate specifying the object under validation.
A predicate specifying the constraint being violated.
A predicate specifying the description of the object being validated.
com.wix.accord.RuleViolation
Abstracts over validators for the various violation type.
Enables syntax like someResult should fail
A convenience method for matching failures.
A convenience method for matching failures. Enables syntax like:
val result: Result = ...
result should failWith( "firstName" -> "must not be empty", "lastName" -> "must not be empty" )
The set of expected violations.
A matcher over validation com.wix.accord.Results.
A convenience method for matching violation groups.
A convenience method for matching violation groups. Enables syntax like:
val result: Result = ...
result should failWith( group( "teacher", "is invalid", // The group context
"firstName -> "must not be empty" ) ) // The rule violations
The textual description of the object under validation.
A textual description of the constraint being violated (for example, "must not be empty").
The set of expected violations that comprise the group.
A matcher over com.wix.accord.GroupViolations.
A convenience implicit to simplify test code.
A convenience implicit to simplify test code. Enables syntax like:
val rule: RuleViolationMatcher = "firstName" -> "must not be empty"
// ... which is equivalent to
val rule = RuleViolationMatcher( description = "firstName", constraint = "must not be empty" )
Enables syntax like someResult should succeed
Extends a specification with a set of matchers over validation com.wix.accord.Results.