com.wix.accord.specs2

ResultMatchers

trait ResultMatchers extends AnyRef

Extends a specification with a set of matchers over validation com.wix.accord.Results.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ResultMatchers
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. case class GroupViolationMatcher(value: Any = null, constraint: String = null, description: String = null, violations: Set[ViolationMatcher] = null) extends ViolationMatcher with Product with Serializable

    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 )

    value

    A predicate specifying the object under validation.

    constraint

    A predicate specifying the constraint being violated.

    description

    A predicate specifying the description of the object being validated.

    violations

    The set of violations that comprise the group being validated.

    See also

    com.wix.accord.GroupViolation

  2. case class ResultMatcher(expectedViolations: Set[ViolationMatcher]) extends Matcher[Result] with Product with Serializable

    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.

    expectedViolations

    The set of expected violations for this matcher.

  3. case class RuleViolationMatcher(value: Any = null, constraint: String = null, description: String = null) extends ViolationMatcher with Product with Serializable

    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 )

    value

    A predicate specifying the object under validation.

    constraint

    A predicate specifying the constraint being violated.

    description

    A predicate specifying the description of the object being validated.

    See also

    com.wix.accord.RuleViolation

  4. sealed trait ViolationMatcher extends Matcher[Violation]

    Abstracts over validators for the various violation type.

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  8. val fail: Matcher[Result]

    Enables syntax like someResult should fail

  9. def failWith(expectedViolations: ViolationMatcher*): Matcher[Result]

    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" )

    expectedViolations

    The set of expected violations.

    returns

    A matcher over validation com.wix.accord.Results.

  10. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  12. def group(description: String, constraint: String, expectedViolations: (String, String)*): GroupViolationMatcher

    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

    description

    The textual description of the object under validation.

    constraint

    A textual description of the constraint being violated (for example, "must not be empty").

    expectedViolations

    The set of expected violations that comprise the group.

    returns

    A matcher over com.wix.accord.GroupViolations.

  13. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  18. implicit def stringTuple2RuleMatcher(v: (String, String)): RuleViolationMatcher

    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" )

  19. val succeed: Matcher[Result]

    Enables syntax like someResult should succeed

  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  21. def toString(): String

    Definition Classes
    AnyRef → Any
  22. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped