org.specs2.matcher

Matcher

trait Matcher [-T] extends AnyRef

The Matcher trait is the base trait for any Matcher.

This trait can be extended to provide an appropriate apply method that will check an expectable value a: Expectable[T].

The result of a match is a MatchResult object (@see MatchResult).

Matchers can be composed.

Implementation notes: * the parameter to the apply method must be a by-name parameter. This allows some values to be evaluated only when necessary.

* However in the implementation of the apply function, it must be taken care of not evaluating the parameter twice. Assigning it to a val is the solution to this issue.

Self Type
Matcher[T]
Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Matcher
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

Abstract Value Members

  1. def apply [S <: T] (t: Expectable[S]): MatchResult[S]

    apply this matcher to an Expectable

    apply this matcher to an Expectable

    returns

    a MatchResult describing the outcome of the match

    Attributes
    abstract

Concrete Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

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

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. def ^^ [S] (f: (S) ⇒ T): Matcher[S]

    Adapt a matcher to another.

    Adapt a matcher to another. ex: be_==("message") ^^ (_.getMessage) can be applied to an exception

  7. def and [S <: T] (m: ⇒ Matcher[S]): Matcher[S]

    the logical and between 2 matchers

    the logical and between 2 matchers

    See also

    MatchResult.and

  8. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  9. def atLeastOnce : Matcher[Traversable[T]]

    returns

    a Matcher matching at least one element of a sequence against the current matcher

  10. def clone (): AnyRef

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

    Attributes
    final
    Definition Classes
    AnyRef
  12. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  13. def eventually (retries: Int, sleep: Duration): Matcher[T]

    returns

    a matcher that needs to eventually match, after a given number of retries and a sleep time

  14. def eventually : Matcher[T]

    returns

    a matcher that needs to eventually match, after 40 retries and a sleep time of 100 milliseconds

  15. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  16. def forall : Matcher[Traversable[T]]

    returns

    a Matcher matching all the elements of a sequence against the current matcher, stopping after the first failure

  17. def foreach : Matcher[Traversable[T]]

    returns

    a Matcher matching all the elements of a sequence against the current matcher, cumulating all failures

  18. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  19. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  20. def iff (b: Boolean, m: String = ""): Matcher[T]

    when the condition is true the matcher is applied, when it's false, the matcher must fail

  21. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  22. def lazily : Matcher[() ⇒ T]

    The lazily operator returns a Matcher which will match a function returning the expected value

  23. def mute : Matcher[T]

    returns

    a Matcher with no messages

  24. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  25. def not : Matcher[T]

    negate a Matcher

    negate a Matcher

    See also

    MatchResult.not

  26. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  27. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  28. def or [S <: T] (m: ⇒ Matcher[S]): Matcher[S]

    the logical or between 2 matchers

    the logical or between 2 matchers

    See also

    MatchResult.or

  29. def orSkip (m: String): Matcher[T]

    returns

    a Skip MatchResult if this matcher fails, prefixing the failure message with a skip message. If the skip message is empty, only the failure message is printed

  30. def orSkip : Matcher[T]

    returns

    a Skip MatchResult if this matcher fails

  31. def result [S <: T] (other: MatchResultMessage, value: Expectable[S]): MatchResult[S]

    returns

    a MatchResult using the messages embedded in a MatchResultMessage (i.e. an accumulation of messages from other matches)

    Attributes
    protected
  32. def result [S <: T] (other: org.specs2.matcher.MatchResult[_], value: Expectable[S]): MatchResult[S]

    returns

    a MatchResult copied on another one, but with a different expectable

    Attributes
    protected
  33. def result [S <: T] (test: ⇒ Boolean, okMessage: ⇒ String, koMessage: ⇒ String, value: Expectable[S], expected: String, actual: String): MatchResult[S]

    This convenience method can be used to evaluate a boolean condition and return an appropriate MatchResult

    This convenience method can be used to evaluate a boolean condition and return an appropriate MatchResult

    returns

    a MatchResult with an okMessage, a koMessage, the expectable value and the expected/actual values as string to display a failure comparison if necessary

    Attributes
    protected
  34. def result [S <: T] (test: ⇒ Boolean, okMessage: ⇒ String, koMessage: ⇒ String, value: Expectable[S]): MatchResult[S]

    This convenience method can be used to evaluate a boolean condition and return an appropriate MatchResult

    This convenience method can be used to evaluate a boolean condition and return an appropriate MatchResult

    returns

    a MatchResult with an okMessage, a koMessage and the expectable value

    Attributes
    protected
  35. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  36. def toString (): String

    Definition Classes
    AnyRef → Any
  37. def unless (b: Boolean, m: String = ""): Matcher[T]

    only apply this matcher if the condition is false

  38. def wait (): Unit

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  41. def when (b: Boolean, m: String = ""): Matcher[T]

    only apply this matcher if the condition is true

Inherited from AnyRef

Inherited from Any