NodeMatcher
Type members
Inherited classlikes
Value members
Concrete methods
Inherited methods
This method enables the following syntax:
This method enables the following syntax:
aMatcher and not (exist) ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher and exist ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher and not contain value (3) ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher and endWith regex (decimalRegex) ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher and startWith regex ("1.7") ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher and include regex ("wor.d") ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher and fullyMatch regex (decimalRegex) ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher and be a ('file) ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher and contain key ("one") ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher and have size (3 - 1) ^
- Inherited from
- Matcher
Returns a MatcherFactory
whose matcher
method returns a Matcher
,
which has apply
method that returns a MatchResult
that represents the logical-and
of the results of the wrapped and the passed MatcherFactory
applied to the same value.
Returns a MatcherFactory
whose matcher
method returns a Matcher
,
which has apply
method that returns a MatchResult
that represents the logical-and
of the results of the wrapped and the passed MatcherFactory
applied to the same value.
- Value Params
- rightMatcherFactory1
the
MatcherFactory
to logical-and with thisMatcherFactory
- Returns
a
MatcherFactory
that performs the logical-and of this and the passedMatcherFactory
- Inherited from
- Matcher
Returns a matcher whose apply
method returns a MatchResult
that represents the logical-and of the results of the wrapped and the passed matcher applied to
the same value.
Returns a matcher whose apply
method returns a MatchResult
that represents the logical-and of the results of the wrapped and the passed matcher applied to
the same value.
The reason and
has an upper bound on its type parameter is so that the Matcher
resulting from an invocation of and
will have the correct type parameter. If you call
and
on a Matcher[Orange]
, passing in a Matcher[Valencia]
,
the result will have type Matcher[Valencia]
. This is correct because both a
Matcher[Orange]
and a Matcher[Valencia]
know how to match a
Valencia
(but a Matcher[Valencia]
doesn't know how to
match any old Orange
). If you call
and
on a Matcher[Orange]
, passing in a Matcher[Fruit]
,
the result will have type Matcher[Orange]
. This is also correct because both a
Matcher[Orange]
and a Matcher[Fruit]
know how to match an
Orange
(but a Matcher[Orange]
doesn't know how to
match any old Fruit
).
- Value Params
- the
matcher to logical-and with this matcher
- Returns
a matcher that performs the logical-and of this and the passed matcher
- Inherited from
- Matcher
Compose this matcher with the passed function, returning a new matcher.
Compose this matcher with the passed function, returning a new matcher.
This method overrides compose
on Function1
to
return a more specific function type of Matcher
. For example, given
a beOdd
matcher defined like this:
val beOdd = new Matcher[Int] { def apply(left: Int) = MatchResult( left % 2 == 1, left + " was not odd", left + " was odd" ) }
You could use beOdd
like this:
3 should beOdd 4 should not (beOdd)
If for some odd reason, you wanted a Matcher[String]
that
checked whether a string, when converted to an Int
,
was odd, you could make one by composing beOdd
with
a function that converts a string to an Int
, like this:
val beOddAsInt = beOdd compose { (s: String) => s.toInt }
Now you have a Matcher[String]
whose apply
method first
invokes the converter function to convert the passed string to an Int
,
then passes the resulting Int
to beOdd
. Thus, you could use
beOddAsInt
like this:
"3" should beOddAsInt "4" should not (beOddAsInt)
- Definition Classes
- Matcher -> Function1
- Inherited from
- Matcher
Creates a new Matcher
that will produce MatchResult
s that contain error messages constructed
using arguments that are transformed by the passed prettify
function. In other words, the MatchResult
produced by this Matcher
will use arguments transformed by prettify
function to construct the final
error messages.
Creates a new Matcher
that will produce MatchResult
s that contain error messages constructed
using arguments that are transformed by the passed prettify
function. In other words, the MatchResult
produced by this Matcher
will use arguments transformed by prettify
function to construct the final
error messages.
- Value Params
- prettify
a function with which to transform the arguments of error messages.
- Returns
a new
Matcher
that will produceMatchResult
s that contain error messages constructed using arguments transformed by the passedprettify
function.- Inherited from
- Matcher
Creates a new Matcher
that will produce MatchResult
s by applying the original MatchResult
produced by this Matcher
to the passed prettify
function. In other words, the MatchResult
produced by this Matcher
will be passed to prettify
to produce the final MatchResult
Creates a new Matcher
that will produce MatchResult
s by applying the original MatchResult
produced by this Matcher
to the passed prettify
function. In other words, the MatchResult
produced by this Matcher
will be passed to prettify
to produce the final MatchResult
- Value Params
- prettify
a function to apply to the original
MatchResult
produced by thisMatcher
- Returns
a new
Matcher
that will produceMatchResult
s by applying the originalMatchResult
produced by thisMatcher
to the passedprettify
function- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher or not (exist) ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher or exist ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher or not contain value (3) ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher or endWith regex ("7b") ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher or startWith regex ("1.7") ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher or include regex ("1.7") ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher or fullyMatch regex (decimal) ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher or be a ('directory) ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher or contain value (1) ^
- Inherited from
- Matcher
This method enables the following syntax:
This method enables the following syntax:
aMatcher or have size (3 - 1) ^
- Inherited from
- Matcher
Returns a MatcherFactory
whose matcher
method returns a Matcher
,
which has apply
method that returns a MatchResult
that represents the logical-or
of the results of the wrapped and the passed MatcherFactory
applied to the same value.
Returns a MatcherFactory
whose matcher
method returns a Matcher
,
which has apply
method that returns a MatchResult
that represents the logical-or
of the results of the wrapped and the passed MatcherFactory
applied to the same value.
- Value Params
- rightMatcherFactory1
the
MatcherFactory
to logical-or with thisMatcherFactory
- Returns
a
MatcherFactory
that performs the logical-or of this and the passedMatcherFactory
- Inherited from
- Matcher
Returns a matcher whose apply
method returns a MatchResult
that represents the logical-or of the results of this and the passed matcher applied to
the same value.
Returns a matcher whose apply
method returns a MatchResult
that represents the logical-or of the results of this and the passed matcher applied to
the same value.
The reason or
has an upper bound on its type parameter is so that the Matcher
resulting from an invocation of or
will have the correct type parameter. If you call
or
on a Matcher[Orange]
, passing in a Matcher[Valencia]
,
the result will have type Matcher[Valencia]
. This is correct because both a
Matcher[Orange]
and a Matcher[Valencia]
know how to match a
Valencia
(but a Matcher[Valencia]
doesn't know how to
match any old Orange
). If you call
or
on a Matcher[Orange]
, passing in a Matcher[Fruit]
,
the result will have type Matcher[Orange]
. This is also correct because both a
Matcher[Orange]
and a Matcher[Fruit]
know how to match an
Orange
(but a Matcher[Orange]
doesn't know how to
match any old Fruit
).
- Value Params
- rightMatcher
the matcher to logical-or with this matcher
- Returns
a matcher that performs the logical-or of this and the passed matcher
- Inherited from
- Matcher