This class is part of the ScalaTest matchers DSL.
Class that supports shared test registration via instances referenced from the behave
field of FunSpec
s,
FlatSpec
s, and WordSpec
s as well as instance of their sister traits,
fixture.FunSpec
, fixture.FlatSpec
, and fixture.WordSpec
.
Class that supports shared test registration via instances referenced from the behave
field of FunSpec
s,
FlatSpec
s, and WordSpec
s as well as instance of their sister traits,
fixture.FunSpec
, fixture.FlatSpec
, and fixture.WordSpec
.
This class, via the behave
field, enables syntax such as the following in FunSpec
s, FlatSpec
s,
fixture.FunSpec
s, and fixture.FlatSpec
s:
it should behave like nonFullStack(stackWithOneItem) ^
It also enables syntax such as the following syntax in WordSpec
s and fixture.WordSpec
s:
behave like nonEmptyStack(lastValuePushed) ^
For more information and examples of the use of <cod>behave, see the Shared tests section
in the main documentation for trait FunSpec
,
FlatSpec
, or WordSpec
.
Provides an implicit conversion that adds can
methods to String
to support the syntax of FlatSpec
, WordSpec
, org.scalatest.fixture.FlatSpec
,
and fixture.WordSpec
.
Provides an implicit conversion that adds can
methods to String
to support the syntax of FlatSpec
, WordSpec
, org.scalatest.fixture.FlatSpec
,
and fixture.WordSpec
.
For example, this trait enables syntax such as the following test registration in FlatSpec
and fixture.FlatSpec
:
"A Stack (when empty)" can "be empty" in { ... } ^
It also enables syntax such as the following shared test registration in FlatSpec
and fixture.FlatSpec
:
"A Stack (with one item)" can behave like nonEmptyStack(stackWithOneItem, lastValuePushed)
^
In addition, it supports the registration of subject descriptions in WordSpec
and fixture.WordSpec
, such as:
"A Stack (when empty)" can { ...
^
And finally, it also supportds the registration of subject descriptions with after words
in WordSpec
and fixture.WordSpec
. For example:
def provide = afterWord("provide")The reason this implicit conversion is provided in a separate trait, instead of being provided directly in
"The ScalaTest Matchers DSL" can provide { ^
FlatSpec
, WordSpec
, fixture.FlatSpec
, and
fixture.WordSpec
, is primarily for design symmetry with ShouldVerb
and MustVerb
. Both ShouldVerb
and MustVerb
must exist
as a separate trait because an implicit conversion provided directly would conflict
with the implicit conversion that provides should
or must
methods on String
in the ShouldMatchers
and MustMatchers
traits.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
Provides an implicit conversion that adds must
methods to String
to support the syntax of FlatSpec
, WordSpec
, fixture.FlatSpec
,
and fixture.WordSpec
.
Provides an implicit conversion that adds must
methods to String
to support the syntax of FlatSpec
, WordSpec
, fixture.FlatSpec
,
and fixture.WordSpec
.
For example, this trait enables syntax such as the following test registration in FlatSpec
and fixture.FlatSpec
:
"A Stack (when empty)" must "be empty" in { ... } ^
It also enables syntax such as the following shared test registration in FlatSpec
and fixture.FlatSpec
:
"A Stack (with one item)" must behave like nonEmptyStack(stackWithOneItem, lastValuePushed)
^
In addition, it supports the registration of subject descriptions in WordSpec
and fixture.WordSpec
, such as:
"A Stack (when empty)" must { ...
^
And finally, it also supportds the registration of subject descriptions with after words
in WordSpec
and fixture.WordSpec
. For example:
def provide = afterWord("provide")The reason this implicit conversion is provided in a separate trait, instead of being provided directly in
"The ScalaTest Matchers DSL" must provide { ^
FlatSpec
, WordSpec
, fixture.FlatSpec
, and
fixture.WordSpec
, is because an implicit conversion provided directly would conflict
with the implicit conversion that provides must
methods on String
in the MustMatchers
trait. By contrast, there is no conflict with
the separate MustVerb
trait approach, because:
- FlatSpec
, WordSpec
, fixture.FlatSpec
, and fixture.WordSpec
mix in MustVerb
directly, and
- MustMatchers
extends MustVerb
, overriding the
convertToStringMustWrapper
implicit conversion function.
So whether or not
a FlatSpec
, WordSpec
, fixture.FlatSpec
, or fixture.WordSpec
mixes in MustMatchers
, there will only be one
implicit conversion in scope that adds must
methods to String
s.
Also, because the class of the result of the overriding convertToStringMustWrapper
implicit conversion method provided in MustMatchers
extends this trait's
StringMustWrapperForVerb
class, the four uses of must
provided here
are still available. These four must
are in fact available to any class
that mixes in MustMatchers
, but each takes an implicit parameter that is provided
only in FlatSpec
and fixture.FlatSpec
, or WordSpec
and
fixture.WordSpec
.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
Class that supports the use of after words in WordSpec
and fixture.WordSpec
.
Class that supports the use of after words in WordSpec
and fixture.WordSpec
.
A ResultOfAfterWordApplication
, which encapsulates the text of the after word
and a block,
is accepted by when
, should
, must
, can
, and that
methods. For more information, see the
main documentation for trait WordSpec
.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
The primary constructor enables the following syntax (with a passed scala.util.matching.Regex
):
"eight" should not fullyMatch regex ("""(-)?(\d+)(\.\d*)?""".r) ^
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
Abstract class that supports test registration in FlatSpec
and fixture.FlatSpec
.
Abstract class that supports test registration in FlatSpec
and fixture.FlatSpec
.
For example, this class enables syntax such as the following pending test registration
in FlatSpec
and fixture.FlatSpec
:
"A Stack (when empty)" should "be empty" is (pending) ^
For example, this class enables syntax such as the following tagged test registration
in FlatSpec
and fixture.FlatSpec
:
"A Stack (when empty)" should "be empty" taggedAs(SlowTet) in { ... } ^
This class also indirectly enables syntax such as the following regular test registration
in FlatSpec
and fixture.FlatSpec
:
"A Stack (when empty)" should "be empty" in { ... } ^
However, this class does not declare any methods named in
, because the
type passed to in
differs in a FlatSpec
and a fixture.FlatSpec
.
A fixture.FlatSpec
needs two in
methods, one that takes a no-arg
test function and another that takes a one-arg test function (a test that takes a
Fixture
as its parameter). By constrast, a FlatSpec
needs
only one in
method that takes a by-name parameter. As a result,
FlatSpec
and fixture.FlatSpec
each provide an implicit conversion
from ResultOfStringPassedToVerb
to a type that provides the appropriate
in
methods.
Supports the registration of tagged tests in shorthand form in FlatSpec
and fixture.FlatSpec
.
Supports the registration of tagged tests in shorthand form in FlatSpec
and fixture.FlatSpec
.
For example, this class enables syntax such as the following tagged, pending test registration in shorthand form:
"A Stack (when empty)" should "be empty" taggedAs() is (pending) ^
In addition, this class indirectly enables syntax such as the following tagged test registration in shorthand form:
"A Stack (when empty)" should "be empty" taggedAs() in { ... } ^
Rather than provide in
and ignore
methods directly, these
methods are provided after taggedAs()
by implicit conversions
because the type passed to in
(and ignore
)
differs in a FlatSpec
and a fixture.FlatSpec
.
A fixture.FlatSpec
needs two in
methods, one that takes a no-arg
test function and another that takes a one-arg test function (a test that takes a
Fixture
as its parameter). By constrast, a FlatSpec
needs
only one in
method that takes a by-name parameter. As a result,
FlatSpec
and fixture.FlatSpec
each provide an implicit conversion
from ResultOfTaggedAsInvocation
to a type that provides the appropriate
in
methods.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
Provides an implicit conversion that adds should
methods to String
to support the syntax of FlatSpec
, WordSpec
, fixture.FlatSpec
,
and fixture.WordSpec
.
Provides an implicit conversion that adds should
methods to String
to support the syntax of FlatSpec
, WordSpec
, fixture.FlatSpec
,
and fixture.WordSpec
.
For example, this trait enables syntax such as the following test registration in FlatSpec
and fixture.FlatSpec
:
"A Stack (when empty)" should "be empty" in { ... } ^
It also enables syntax such as the following shared test registration in FlatSpec
and fixture.FlatSpec
:
"A Stack (with one item)" should behave like nonEmptyStack(stackWithOneItem, lastValuePushed)
^
In addition, it supports the registration of subject descriptions in WordSpec
and fixture.WordSpec
, such as:
"A Stack (when empty)" should { ...
^
And finally, it also supportds the registration of subject descriptions with after words
in WordSpec
and fixture.WordSpec
. For example:
def provide = afterWord("provide")The reason this implicit conversion is provided in a separate trait, instead of being provided directly in
"The ScalaTest Matchers DSL" should provide { ^
FlatSpec
, WordSpec
, fixture.FlatSpec
, and
fixture.WordSpec
, is because an implicit conversion provided directly would conflict
with the implicit conversion that provides should
methods on String
in the ShouldMatchers
trait. By contrast, there is no conflict with
the separate ShouldVerb
trait approach, because:
- FlatSpec
, WordSpec
, fixture.FlatSpec
, and fixture.WordSpec
mix in ShouldVerb
directly, and
- ShouldMatchers
extends ShouldVerb
, overriding the
convertToStringShouldWrapper
implicit conversion function.
So whether or not
a FlatSpec
, WordSpec
, fixture.FlatSpec
, or fixture.WordSpec
mixes in ShouldMatchers
, there will only be one
implicit conversion in scope that adds should
methods to String
s.
Also, because the class of the result of the overriding convertToStringShouldWrapper
implicit conversion method provided in ShouldMatchers
extends this trait's
StringShouldWrapperForVerb
class, the four uses of should
provided here
are still available. These four should
are in fact available to any class
that mixes in ShouldMatchers
, but each takes an implicit parameter that is provided
only in FlatSpec
and fixture.FlatSpec
, or WordSpec
and
fixture.WordSpec
.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
Class that provides a role-specific type for an implicit conversion used to support
the registration of subject descriptions in WordSpec
and fixture.WordSpec
.
Class that provides a role-specific type for an implicit conversion used to support
the registration of subject descriptions in WordSpec
and fixture.WordSpec
.
For example, this class enables syntax such as the following in WordSpec
and fixture.WordSpec
:
"A Stack (when empty)" should { ...
^
This should
method, which is provided in ShouldVerb
, needs an implicit parameter
of type (String, String, () => Unit) => Unit
. Because the required type has no ScalaTest-specific
types in it, it is possible that another implicit parameter of that same type could be in scope, which would
cause a compile failure. Requiring an implicit parameter of the more specific StringVerbBlockRegistration
,
which simply extends the needed type, (String, String, () => Unit) => Unit
, avoids this potential conflict.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers
for an overview of
the matchers DSL.
This class is part of the ScalaTest matchers DSL. Please see the documentation for
ShouldMatchers
orMustMatchers
for an overview of the matchers DSL.Class
BeWord
contains anapply
method that takes aSymbol
, which uses reflection to find and access aBoolean
property and determine if it istrue
. If the symbol passed is'empty
, for example, theapply
method will use reflection to look for a public Java field named "empty", a public method named "empty", or a public method named "isEmpty". If a field, it must be of typeBoolean
. If a method, it must take no parameters and returnBoolean
. If multiple candidates are found, theapply
method will select based on the following algorithm:TestFailedException
, because no candidates foundisEmpty()
isEmpty()
empty()
empty()
empty()
isEmpty()
empty()
(this can occur whenBeanProperty
annotation is used)empty
empty
empty
isEmpty()
isEmpty()
empty
empty()
empty()
empty
empty()
isEmpty()
empty()
(this can occur whenBeanProperty
annotation is used)