Trait/Object

org.specs2.matcher

Matcher

Related Docs: object Matcher | package matcher

Permalink

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:

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

Abstract Value Members

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

    Permalink

    apply this matcher to an Expectable

    apply this matcher to an Expectable

    returns

    a MatchResult describing the outcome of the match

Concrete Value Members

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. def ^^[S](f: (S) ⇒ Expectable[T], dummy: Int = 0): Matcher[S]

    Permalink

    Adapt a matcher to another.

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

    The dummy value is used to help to disambiguate with the overloaded ^^ function

  5. def ^^[S](f: (S) ⇒ T): Matcher[S]

    Permalink

    Adapt a matcher to another.

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

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

    Permalink

    the logical and between 2 matchers

    the logical and between 2 matchers

    See also

    MatchResult.and

  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

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

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

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

    Permalink

    sleep

    the function applied on the retry number (first is 1)

    returns

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

    aResult mustEqual(expected).eventually(retries = 2, _ * 100.milliseconds)
  12. def eventually(retries: Int, sleep: Duration): Matcher[T]

    Permalink

    returns

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

  13. def eventually: Matcher[T]

    Permalink

    returns

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

  14. def failure[S <: T](message: ⇒ String, value: Expectable[S]): MatchResult[S]

    Permalink

    This method can be used to create a failed match result

    This method can be used to create a failed match result

    Attributes
    protected
  15. def finalize(): Unit

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

    Permalink
    Definition Classes
    AnyRef → Any
  17. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  18. def iff(b: Boolean): Matcher[T]

    Permalink

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

  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. def lazily: Matcher[() ⇒ T]

    Permalink

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

  21. def mute: Matcher[T]

    Permalink

    returns

    a Matcher with no messages

  22. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  23. def not: Matcher[T]

    Permalink

    negate a Matcher

    negate a Matcher

    See also

    MatchResult.not

  24. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  25. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  26. def or[S <: T](m: ⇒ Matcher[S]): Matcher[S]

    Permalink

    the logical or between 2 matchers

    the logical or between 2 matchers

    See also

    MatchResult.or

  27. def orPending(message: (String) ⇒ String): Matcher[T]

    Permalink

    returns

    a Pending MatchResult if this matcher fails, modifying the failure message with a pending message.

  28. def orPending(m: String): Matcher[T]

    Permalink

    returns

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

  29. def orPending: Matcher[T]

    Permalink

    returns

    a Pending MatchResult if this matcher fails

  30. def orSkip(message: (String) ⇒ String): Matcher[T]

    Permalink

    returns

    a Skip MatchResult if this matcher fails, modifying the failure message with a skip message.

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

    Permalink

    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

  32. def orSkip: Matcher[T]

    Permalink

    returns

    a Skip MatchResult if this matcher fails

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

    Permalink

    returns

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

    Attributes
    protected
  34. def result[S <: T](other: Result, value: Expectable[S]): MatchResult[S]

    Permalink

    returns

    a Match Result from another result

    Attributes
    protected
  35. def result[S <: T](other: MatchResult[_], value: Expectable[S]): MatchResult[S]

    Permalink

    returns

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

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

    Permalink

    returns

    a MatchResult with an okMessage, a koMessage, the expectable value and details about the failure if any

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

    Permalink

    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
  38. def result[S <: T](triplet: ⇒ (Boolean, String, String), value: Expectable[S]): MatchResult[S]

    Permalink

    returns

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

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

    Permalink

    returns

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

    Attributes
    protected
  40. def setMessage(message: String): Matcher[T]

    Permalink

    returns

    set a new failure message of a matcher

  41. def success[S <: T](message: ⇒ String, value: Expectable[S]): MatchResult[S]

    Permalink

    This method can be used to create a successful match result

    This method can be used to create a successful match result

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

    Permalink
    Definition Classes
    AnyRef
  43. def test: (T) ⇒ Boolean

    Permalink

    returns

    a test function corresponding to this matcher

  44. def toString(): String

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

    Permalink

    only apply this matcher if the condition is false

  46. def updateMessage(f: (String) ⇒ String): Matcher[T]

    Permalink

    returns

    update the failure message of a matcher

  47. final def wait(): Unit

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

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

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

    Permalink

    only apply this matcher if the condition is true

Inherited from AnyRef

Inherited from Any

Ungrouped