trait
MatchResult[+T] extends ResultLike
Concrete Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
-
final
def
asInstanceOf[T0]: T0
-
def
be[S >: T <: AnyRef](s: S): MatchResult[T]
-
-
def
clone(): AnyRef
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
evaluate[S >: T]: MatchResult[S]
-
def
filterTrace(f: (List[StackTraceElement]) ⇒ List[StackTraceElement]): MatchResult[T]
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
-
final
def
isInstanceOf[T0]: Boolean
-
def
isSuccess: Boolean
-
def
message: String
-
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
-
-
def
setMessage(message: String): MatchResult[T]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toResult: Result
-
def
toString(): String
-
def
updateMessage(f: (String) ⇒ String): MatchResult[T]
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Inherited from AnyRef
Inherited from Any
Result of a Match.
A MatchResult contains several information about a match on an expectable:
- the expectable value, to allow the chaining of matches - a pair of messages ok message / ko message to allow the easy creation of the negation of a match
A MatchResult can be transformed to a simple Result object to be the body of an Example.
There are different kinds of MatchResults, some of them being only created to support English-like combination of Matchers:
1 must be equalTo(1) and not be equalTo(2)
In an Expectation like the one above, there is a left to right evaluation:
2. equalTo(1) is a real Matcher which is applied to the NeutralMatch MatchResult thanks to an implicit definition in the BeHaveAnyMatchers trait. This yields a MatchSuccess result
3. not creates a NotMatcher and can be and-ed with the previous MatchSuccess to yield a AndMatch(MatchSuccess, NotMatch), with NotMatch being the result of applying the NotMatcher to the expectable. This AndMatch is evaluated to create a AndNotMatch(MatchSuccess, MatchSkip)
Basically this is like forming an evaluation structure which will be resolved when the next 'real' matcher will arrive
4. the AndNotMatch get nows it be method called with the equalTo Matcher. This results in equalTo being applied to the AndNotMatch, effectively doing: MatchSuccess and MatchSkip.apply(equalTo(2).not), which is MatchSuccess and expectable.applyMatcher(equalTo(2).not) which is MatchSuccess
org.specs2.matcher.BeHaveMatchersSpec for examples