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.
- Companion:
- object
Value members
Abstract methods
Concrete methods
Adapt a matcher to another.
ex: be_==("message") ^^ (_.getMessage)
can be applied to an exception
Adapt a matcher to another.
ex: be_==("message") ^^ (_.getMessage)
can be applied to an exception
Adapt a matcher to another.
ex: be_==("message") ^^ (_.getMessage aka "trimmed")
can be applied to an exception
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
- Returns:
a matcher that needs to eventually match, after 40 retries and a sleep time of 100 milliseconds
- Value parameters:
- 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)
when the condition is true the matcher is applied, when it's false, the matcher must fail
when the condition is true the matcher is applied, when it's false, the matcher must fail
The lazily
operator returns a Matcher which will match a function returning the expected value
The lazily
operator returns a Matcher which will match a function returning the expected value
- 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
- Returns:
a Pending MatchResult if this matcher fails, modifying the failure message with a pending message.
- 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
- Returns:
a Skip MatchResult if this matcher fails, modifying the failure message with a skip message.