org.specs.matcher.Matcher

class Matcher

abstract class Matcher[T]

 extends AbstractMatcher[T] with MatcherResult


This class is the base class for asserting if a given value, of type T, is matching an expected value

The matcher parameter is a function which takes a value and return a Boolean saying if the match is ok and 2 messages: 1 if the match is ok, and another one if the match is ko. Those messages should usually specify which was the expected value and which was the actual one

It is also possible to use the boolean logical operator on matchers: and, or, not, xor to combine matchers together. This is the essential reason why the ok message is included in the matcher function. For instance, when the not operator is used, the ok message is used as a ko message



Source: Matchers.scala(44)

Direct Known Subclasses

CaseMatcher, FindMatcher, XmlMatcher, SeqMatcher, ExceptionMatcher, FindMatcherWithGroups, SetMatcher,

 Constructors

def this

 Fields

not def not
The not operator allow to combine to matchers through a logical not [details]
m1.not returns a matcher failing if m1 succeeds, and succeeding if m1 fails
Matcher[T]
orSkip def orSkip
Alias for orSkipExample
Matcher[T]
orSkipExample def orSkipExample
The orSkipExample operator throws a SkippedException if the matcher fails
Matcher[T]

 Methods

!= final def !=(arg0 : Any) Boolean Any
!= final def !=(arg0 : Object) Boolean AnyRef
== final def ==(arg0 : Object) Boolean AnyRef
== final def ==(arg0 : Any) Boolean Any
^^ def ^^[A](f : (A) => T) Matcher[A]
and def and(m : => Matcher[T])
The and operator allow to combine to matchers through a logical and [details]
m1 and m2 can successfully match a value a only if m1 succeeds and m2 succeeds also
Matcher[T]
apply abstract def apply(a : => T) (Boolean, String, String) AbstractMatcher
asInstanceOf final def asInstanceOf[T0] T0 Any
clone protected def clone Object AnyRef
composeWithFunction def composeWithFunction[A](f : (A) => T)
The ^^ operator returns a matcher which will apply a function before doing the match
Matcher[A]
eq final def eq(arg0 : Object) Boolean AnyRef
equals def equals(arg0 : Any) Boolean AnyRef
finalize protected def finalize Unit AnyRef
getClass final def getClass Class[Object] AnyRef
hashCode def hashCode Int AnyRef
isInstanceOf final def isInstanceOf[T0] Boolean Any
lazily def lazily
The lazily operator returns a matcher which will match a function returning the expected value
Matcher[() => T]
ne final def ne(arg0 : Object) Boolean AnyRef
notify final def notify Unit AnyRef
notifyAll final def notifyAll Unit AnyRef
or def or(m : => Matcher[T])
The or operator allow to combine to matchers through a logical or [details]
m1 or m2 can successfully match a value a if m1 succeeds or m2 succeeds. m2 is not evaluated if m1 succeeds
Matcher[T]
synchronized final def synchronized[T0](arg0 : T0) T0 AnyRef
toMatcherResult implicit def toMatcherResult(t : (Boolean, String, String)) MatcherResult MatcherResult
toString def toString String AnyRef
toTuple implicit def toTuple(m : MatcherResult) (Boolean, String, String) MatcherResult
unless def unless(condition : => Boolean)
The unless operator returns a matcher which will be ok only if a condition is false
Matcher[T]
wait final def wait Unit AnyRef
wait final def wait(arg0 : Long) Unit AnyRef
wait final def wait(arg0 : Long, arg1 : Int) Unit AnyRef
when def when(condition : => Boolean)
The when operator returns a matcher which will be ok only if a condition is true
Matcher[T]
xor def xor(m : => Matcher[T])
The xor operator allow to combine to matchers through a logical xor [details]
m1 xor m2 can successfully match a value a if m1 succeeds and m2 fails, or if m1 fails and m2 succeeds
Matcher[T]
Copyright (c) 2007-2008. All Rights Reserved.