org.scalatest.matchers

MustMatchers

trait MustMatchers extends Assertions with Tolerance with MustVerb with MatcherWords with Explicitly

Trait that provides a domain specific language (DSL) for expressing assertions in tests using the word must.

Update: Although deprecated in 2.0, MustMatchers was resurrected in 2.1.0 in the org.scalatest package, so there's no need anymore to change must to should. In fact, the org.scalatest.MustMatchers type alias was accidentally left undeprecated in 2.0, so where you are mixing in trait org.scalatest.matchers.MustMatchers, you can in 2.0 get rid of the deprecation warning by mixing in org.scalatest.MustMatchers instead.

For example, if you mix Matchers into a suite class, you can write an equality assertion in that suite like this:

result must equal (3)

Here result is a variable, and can be of any type. If the object is an Int with the value 3, execution will continue (i.e., the expression will result in the unit value, ()). Otherwise, a TestFailedException will be thrown with a detail message that explains the problem, such as "7 did not equal 3". This TestFailedException will cause the test to fail.

Here is a table of contents for this documentation:

Matchers migration in ScalaTest 2.0

Deprecations

In ScalaTest 2.0, traits org.scalatest.matchers.MustMatchers and org.scalatest.matchers.MustMatchers are deprecated, replaced by trait org.scalatest.Matchers. MustMatchers and MustMatchers will continue to work during a lengthy deprecation cycle, but will eventually be removed in a future version of ScalaTest. You can migrate existing uses of MustMatchers by simply importing or mixing in org.scalatest.Matchers instead of org.scalatest.matchers.MustMatchers. You can migrate existing uses of org.scalatest.matchers.MustMatchers in the same manner, by importing or mixing in org.scalatest.Matchers instead of org.scalatest.matchers.MustMatchers, but with one extra step: replacing "should" with "must". org.scalatest.Matchers only supports the verb "must"; We apologize for imposing such a large search-and-replace job on users, but we want to make the verb "must" available to be used for a different purpose in ScalaTest after the deprecation cycle for MustMatchers is completed.

Two other deprecations in ScalaTest 2.0 matchers are be === <value> and evaluating ... must produce syntax. This will both continue to work as before, but will generate a deprecation warning and eventually be removed in a future version of ScalaTest. the be === syntax is being deprecated so that all uses of === in ScalaTest consistently provide the new features of tunable type checking, tolerance support, and customized equality. Please replace uses of this syntax with one of the other ways to check equality described in the next section. The eventually syntax is being deprecated because it is replaced by thrownBy clauses, as described below.

Potential breakages

Although ScalaTest's matchers have undergone a major refactor in 2.0, all previously documented syntax for matchers must continue to work exactly the same with one potential exception, which must in practice be extremely rare. The potential breakage is that if you included length or size along with custom have-property matchers that you wrote, you'll get a compiler error. To fix such an error, add after your length or size invocation an (of [<type>]) clause, as described below.

The only other source of potential breakage is the fragile base class problem. We have added fields and methods to Matchers in 2.0 that may conflict with fields and methods in your existing classes and cause a compiler error. Such issues can usually be easily fixed locally with simple renames or refactors, but if you prefer to subtract a token from Matchers, you can do so by mixing together your own Matchers trait from component traits, as described below. Note that you must not see any new implicit conflicts, because we managed to reduce the number of implicits brought into scope by 2.0 matchers compared to 1.x by about 75%.

Checking equality with matchers

ScalaTest matchers provides five different ways to check equality, each designed to address a different need. They are:

result must equal (3) // can customize equality
result must === (3)   // can customize equality and enforce type constraints
result must be (3)    // cannot customize equality, so fastest to compile
result mustEqual 3    // can customize equality, no parentheses required
result mustBe 3       // cannot customize equality, so fastest to compile, no parentheses required

The “left must equal (right)” syntax requires an org.scalautils.Equality[L] to be provided (either implicitly or explicitly), where L is the left-hand type on which must is invoked. In the "left must equal (right)" case, for example, L is the type of left. Thus if left is type Int, the "left must equal (right)" statement would require an Equality[Int].

By default, an implicit Equality[T] instance is available for any type T, in which equality is implemented by simply invoking == on the left value, passing in the right value, with special treatment for arrays. If either left or right is an array, deep will be invoked on it before comparing with ==. Thus, the following expression will yield false, because Array's equals method compares object identity:

Array(1, 2) == Array(1, 2) // yields false

The next expression will by default not result in a TestFailedException, because default Equality[Array[Int]] compares the two arrays structurally, taking into consideration the equality of the array's contents:

Array(1, 2) must equal (Array(1, 2)) // succeeds (i.e., does not throw TestFailedException)

If you ever do want to verify that two arrays are actually the same object (have the same identity), you can use the be theSameInstanceAs syntax, described below.

You can customize the meaning of equality for a type when using "must equal," "must ===," or mustEqual syntax by defining implicit Equality instances that will be used instead of default Equality. You might do this to normalize types before comparing them with ==, for instance, or to avoid calling the == method entirely, such as if you want to compare Doubles with a tolerance. For an example, see the main documentation of trait Equality.

You can always supply implicit parameters explicitly, but in the case of implicit parameters of type Equality[T], ScalaUtils provides a simple "explictly" DSL. For example, here's how you could explicitly supply an Equality[String] instance that normalizes both left and right sides (which must be strings), by transforming them to lowercase:

scala> import org.scalatest.Matchers._
import org.scalatest.Matchers._

scala> import org.scalautils.Explicitly._ import org.scalautils.Explicitly._

scala> import org.scalautils.StringNormalizations._ import org.scalautils.StringNormalizations._

scala> "Hi" must equal ("hi") (after being lowerCased)

The after being lowerCased expression results in an Equality[String], which is then passed explicitly as the second curried parameter to equal. For more information on the explictly DSL, see the main documentation for trait Explicitly.

The "must be" and mustBe syntax do not take an Equality[T] and can therefore not be customized. They always use the default approach to equality described above. As a result, "must be" and mustBe will likely be the fastest-compiling matcher syntax for equality comparisons, since the compiler need not search for an implicit Equality[T] each time.

The must === syntax (and its complement, must !==) can be used to enforce type constraints at compile-time between the left and right sides of the equality comparison. Here's an example:

scala> import org.scalatest.Matchers._
import org.scalatest.Matchers._

scala> import org.scalautils.TypeCheckedTripleEquals._ import org.scalautils.TypeCheckedTripleEquals._

scala> Some(2) must === (2) <console>:17: error: types Some[Int] and Int do not adhere to the equality constraint selected for the === and !== operators; the missing implicit parameter is of type org.scalautils.Constraint[Some[Int],Int] Some(2) must === (2) ^

By default, the "Some(2) must === (2)" statement would fail at runtime. By mixing in the equality constraints provided by TypeCheckedTripleEquals, however, the statement fails to compile. For more information and examples, see the main documentation for trait TypeCheckedTripleEquals.

Checking size and length

You can check the size or length of any type of object for which it makes sense. Here's how checking for length looks:

result must have length 3

Size is similar:

result must have size 10

The length syntax can be used with String, Array, any scala.collection.GenSeq, any java.util.List, and any type T for which an implicit Length[T] type class is available in scope. Similarly, the size syntax can be used with Array, any scala.collection.GenTraversable, any java.util.Collection, any java.util.Map, and any type T for which an implicit Size[T] type class is available in scope. You can enable the length or size syntax for your own arbitrary types, therefore, by defining Length or Size type classes for those types.

In addition, the length syntax can be used with any object that has a field or method named length or a method named getLength. Similarly, the size syntax can be used with any object that has a field or method named size or a method named getSize. The type of a length or size field, or return type of a method, must be either Int or Long. Any such method must take no parameters. (The Scala compiler will ensure at compile time that the object on which must is being invoked has the appropriate structure.)

Checking strings

You can check for whether a string starts with, ends with, or includes a substring like this:

string must startWith ("Hello")
string must endWith ("world")
string must include ("seven")

You can check for whether a string starts with, ends with, or includes a regular expression, like this:

string must startWith regex "Hel*o"
string must endWith regex "wo.ld"
string must include regex "wo.ld"

And you can check whether a string fully matches a regular expression, like this:

string must fullyMatch regex """(-)?(\d+)(\.\d*)?"""

The regular expression passed following the regex token can be either a String or a scala.util.matching.Regex.

With the startWith, endWith, include, and fullyMatch tokens can also be used with an optional specification of required groups, like this:

"abbccxxx" must startWith regex ("a(b*)(c*)" withGroups ("bb", "cc"))
"xxxabbcc" must endWith regex ("a(b*)(c*)" withGroups ("bb", "cc"))
"xxxabbccxxx" must include regex ("a(b*)(c*)" withGroups ("bb", "cc"))
"abbcc" must fullyMatch regex ("a(b*)(c*)" withGroups ("bb", "cc"))

Greater and less than

You can check whether any type for which an implicit Ordering[T] is available is greater than, less than, greater than or equal, or less than or equal to a value of type T. The syntax is:

one must be < 7
one must be > 0
one must be <= 7
one must be >= 0

Checking Boolean properties with be

If an object has a method that takes no parameters and returns boolean, you can check it by placing a Symbol (after be) that specifies the name of the method (excluding an optional prefix of "is"). A symbol literal in Scala begins with a tick mark and ends at the first non-identifier character. Thus, 'traversableAgain results in a Symbol object at runtime, as does 'completed and 'file. Here's an example:

iter mustBe 'traversableAgain

Given this code, ScalaTest will use reflection to look on the object referenced from emptySet for a method that takes no parameters and results in Boolean, with either the name empty or isEmpty. If found, it will invoke that method. If the method returns true, execution will continue. But if it returns false, a TestFailedException will be thrown that will contain a detail message, such as:

non-empty iterator was not traversableAgain

This be syntax can be used with any reference (AnyRef) type. If the object does not have an appropriately named predicate method, you'll get a TestFailedException at runtime with a detailed message that explains the problem. (For the details on how a field or method is selected during this process, see the documentation for BeWord.)

If you think it reads better, you can optionally put a or an after be. For example, java.io.File has two predicate methods, isFile and isDirectory. Thus with a File object named temp, you could write:

temp must be a 'file

Or, given java.awt.event.KeyEvent has a method isActionKey that takes no arguments and returns Boolean, you could assert that a KeyEvent is an action key with:

keyEvent must be an 'actionKey

If you prefer to check Boolean properties in a type-safe manner, you can use a BePropertyMatcher. This would allow you to write expressions such as:

xs mustBe traversableAgain
temp must be a file
keyEvent must be an actionKey

These expressions would fail to compile if must is used on an inappropriate type, as determined by the type parameter of the BePropertyMatcher being used. (For example, file in this example would likely be of type BePropertyMatcher[java.io.File]. If used with an appropriate type, such an expression will compile and at run time the Boolean property method or field will be accessed directly; i.e., no reflection will be used. See the documentation for BePropertyMatcher for more information.

Using custom BeMatchers

If you want to create a new way of using be, which doesn't map to an actual property on the type you care about, you can create a BeMatcher. You could use this, for example, to create BeMatcher[Int] called odd, which would match any odd Int, and even, which would match any even Int. Given this pair of BeMatchers, you could check whether an Int was odd or even with expressions like:

num mustBe odd
num must not be even

For more information, see the documentation for BeMatcher.

Checking object identity

If you need to check that two references refer to the exact same object, you can write:

ref1 must be theSameInstanceAs ref2

Checking an object's class

If you need to check that an object is an instance of a particular class or trait, you can supply the type to “be a” or “be an”:

result1 mustBe a [Tiger]
result1 must not be an [Orangutan]

Because type parameters are erased on the JVM, we recommend you insert an underscore for any type parameters when using this syntax. Both of the following test only that the result is an instance of List[_], because at runtime the type parameter has been erased:

result mustBe a [List[_]] // recommended
result mustBe a [List[Fruit]] // discouraged

Checking numbers against a range

Often you may want to check whether a number is within a range. You can do that using the +- operator, like this:

sevenDotOh must equal (6.9 +- 0.2)
sevenDotOh must === (6.9 +- 0.2)
sevenDotOh must be (6.9 +- 0.2)
sevenDotOh mustEqual 6.9 +- 0.2
sevenDotOh mustBe 6.9 +- 0.2

Any of these expressions will cause a TestFailedException to be thrown if the floating point value, sevenDotOh is outside the range 6.7 to 7.1. You can use +- with any type T for which an implicit Numeric[T] exists, such as integral types:

seven must equal (6 +- 2)
seven must === (6 +- 2)
seven must be (6 +- 2)
seven mustEqual 6 +- 2
seven mustBe 6 +- 2

Checking for emptiness

You can check whether an object is "empty", like this:

traversable mustBe empty
javaMap must not be empty

The empty token can be used with any type L for which an implicit Emptiness[L] exists. The Emptiness companion object provides implicits for GenTraversable[E], java.util.Collection[E], java.util.Map[K, V], String, Array[E], and Option[E]. In addition, the Emptiness companion object provides structural implicits for types that declare an isEmpty method that returns a Boolean. Here are some examples:

scala> import org.scalatest.Matchers._
import org.scalatest.Matchers._

scala> List.empty mustBe empty

scala> None mustBe empty

scala> Some(1) must not be empty

scala> "" mustBe empty

scala> new java.util.HashMap[Int, Int] mustBe empty

scala> new { def isEmpty = true} mustBe empty

scala> Array(1, 2, 3) must not be empty

Working with "containers"

You can check whether a collection contains a particular element like this:

traversable must contain ("five")

The contain syntax shown above can be used with any type C that has a "containing" nature, evidenced by an implicit org.scalatest.enablers.Containing[L], where L is left-hand type on which must is invoked. In the Containing companion object, implicits are provided for types GenTraversable[E], java.util.Collection[E], java.util.Map[K, V], String, Array[E], and Option[E]. Here are some examples:

scala> import org.scalatest.Matchers._
import org.scalatest.Matchers._

scala> List(1, 2, 3) must contain (2)

scala> Map('a' -> 1, 'b' -> 2, 'c' -> 3) must contain ('b' -> 2)

scala> Set(1, 2, 3) must contain (2)

scala> Array(1, 2, 3) must contain (2)

scala> "123" must contain ('2')

scala> Some(2) must contain (2)

ScalaTest's implicit methods that provide the Containing[L] type classes require an Equality[E], where E is an element type. For example, to obtain a Containing[Array[Int]] you must supply an Equality[Int], either implicitly or explicitly. The contain syntax uses this Equality[E] to determine containership. Thus if you want to change how containership is determined for an element type E, place an implicit Equality[E] in scope or use the explicitly DSL. Although the implicit parameter required for the contain syntax is of type Containing[L], implicit conversions are provided in the Containing companion object from Equality[E] to the various types of containers of E. Here's an example:

scala> import org.scalatest.Matchers._
import org.scalatest.Matchers._

scala> List("Hi", "Di", "Ho") must contain ("ho") org.scalatest.exceptions.TestFailedException: List(Hi, Di, Ho) did not contain element "ho" at ...

scala> import org.scalautils.Explicitly._ import org.scalautils.Explicitly._

scala> import org.scalautils.StringNormalizations._ import org.scalautils.StringNormalizations._

scala> (List("Hi", "Di", "Ho") must contain ("ho")) (after being lowerCased)

Note that when you use the explicitly DSL with contain you need to wrap the entire contain expression in parentheses, as shown here.

(List("Hi", "Di", "Ho") must contain ("ho")) (after being lowerCased)
^                                            ^

In addition to determining whether an object contains another object, you can use contain to make other determinations. For example, the contain oneOf syntax ensures that one and only one of the specified elements are contained in the containing object:

List(1, 2, 3, 4, 5) must contain oneOf (5, 7, 9)
Some(7) must contain oneOf (5, 7, 9)
"howdy" must contain oneOf ('a', 'b', 'c', 'd')

Note that if multiple specified elements appear in the containing object, oneOf will fail:

scala> List(1, 2, 3) must contain oneOf (2, 3, 4)
org.scalatest.exceptions.TestFailedException: List(1, 2, 3) did not contain one of (2, 3, 4)
        at ...

If you really want to ensure one or more of the specified elements are contained in the containing object, use atLeastOneOf, described below, instead of oneOf. Keep in mind, oneOf means "exactly one of."

Note also that with any contain syntax, you can place custom implicit Equality[E] instances in scope to customize how containership is determined, or use the explicitly DSL. Here's an example:

(Array("Doe", "Ray", "Me") must contain oneOf ("X", "RAY", "BEAM")) (after being lowerCased)

The contain noneOf syntax does the opposite of oneOf: it ensures none of the specified elements are contained in the containing object:

List(1, 2, 3, 4, 5) must contain noneOf (7, 8, 9)
Some(0) must contain noneOf (7, 8, 9)
"12345" must contain noneOf ('7', '8', '9')

Working with "aggregations"

As mentioned, the "contain," "contain oneOf," and "contain noneOf" syntax requires a Containing[L] be provided, where L is the left-hand type. Other contain syntax, which will be described in this section, requires an Aggregating[L] be provided, where again L is the left-hand type. (An Aggregating[L] instance defines the "aggregating nature" of a type L.) The reason, essentially, is that contain syntax that makes sense for Option is enabled by Containing[L], whereas syntax that does not make sense for Option is enabled by Aggregating[L]. For example, it doesn't make sense to assert that an Option[Int] contains all of a set of integers, as it could only ever contain one of them. But this does make sense for a type such as List[Int] that can aggregate zero to many integers.

The Aggregating companion object provides implicit instances of Aggregating[L] for types GenTraversable[E], java.util.Collection[E], java.util.Map[K, V], String, Array[E]. Note that these are the same types as are supported with Containing, but with Option[E] missing. Here are some examples:

The contain atLeastOneOf syntax, for example, works for any type L for which an Aggregating[L] exists. It ensures that at least one of (i.e., one or more of) the specified objects are contained in the containing object:

List(1, 2, 3) must contain atLeastOneOf (2, 3, 4)
Array(1, 2, 3) must contain atLeastOneOf (3, 4, 5)
"abc" must contain atLeastOneOf ('c', 'a', 't')

Similar to Containing[L], the implicit methods that provide the Aggregating[L] instances require an Equality[E], where E is an element type. For example, to obtain a Aggregating[Vector[String]] you must supply an Equality[String], either implicitly or explicitly. The contain syntax uses this Equality[E] to determine containership. Thus if you want to change how containership is determined for an element type E, place an implicit Equality[E] in scope or use the explicitly DSL. Although the implicit parameter required for the contain syntax is of type Aggregating[L], implicit conversions are provided in the Aggregating companion object from Equality[E] to the various types of aggregations of E. Here's an example:

(Vector(" A", "B ") must contain atLeastOneOf ("a ", "b", "c")) (after being lowerCased and trimmed)

The "contain atMostOneOf" syntax lets you specify a set of objects at most one of which must be contained in the containing object:

List(1, 2, 3, 4, 5) must contain atMostOneOf (5, 6, 7)

The "contain allOf" syntax lets you specify a set of objects that must all be contained in the containing object:

List(1, 2, 3, 4, 5) must contain allOf (2, 3, 5)

The "contain only" syntax lets you assert that the containing object contains only the specified objects, though it may contain more than one of each:

List(1, 2, 3, 2, 1) must contain only (1, 2, 3)

The "contain theSameElementsAs" and "contain theSameElementsInOrderAs syntax differ from the others in that the right hand side is a GenTraversable[_] rather than a varargs of Any. (Note: in a future 2.0 milestone release, possibly 2.0.M6, these will likely be widened to accept any type R for which an Aggregating[R] exists.)

The "contain theSameElementsAs" syntax lets you assert that two aggregations contain the same objects:

List(1, 2, 2, 3, 3, 3) must contain theSameElementsAs Vector(3, 2, 3, 1, 2, 3)

The number of times any family of equal objects appears must also be the same in both the left and right aggregations. The specified objects may appear multiple times, but must appear in the order they appear in the right-hand list. For example, if the last 3 element is left out of the right-hand list in the previous example, the expression would fail because the left side has three 3's and the right hand side has only two:

List(1, 2, 2, 3, 3, 3) must contain theSameElementsAs Vector(3, 2, 3, 1, 2)
org.scalatest.exceptions.TestFailedException: List(1, 2, 2, 3, 3, 3) did not contain the same elements as Vector(3, 2, 3, 1, 2)
        at ...

Working with "sequences"

The rest of the contain syntax, which will be described in this section, requires a Sequencing[L] be provided, where again L is the left-hand type. (A Sequencing[L] instance defines the "sequencing nature" of a type L.) The reason, essentially, is that contain syntax that implies an "order" of elements makes sense only for types that place elements in a sequence. For example, it doesn't make sense to assert that a Map[String, Int] or Set[Int] contains all of a set of integers in a particular order, as these types don't necessarily define an order for their elements. But this does make sense for a type such as Seq[Int] that does define an order for its elements.

The Sequencing companion object provides implicit instances of Sequencing[L] for types GenSeq[E], java.util.List[E], String, and Array[E]. Here are some examples:

Similar to Containing[L], the implicit methods that provide the Aggregating[L] instances require an Equality[E], where E is an element type. For example, to obtain a Aggregating[Vector[String]] you must supply an Equality[String], either implicitly or explicitly. The contain syntax uses this Equality[E] to determine containership. Thus if you want to change how containership is determined for an element type E, place an implicit Equality[E] in scope or use the explicitly DSL. Although the implicit parameter required for the contain syntax is of type Aggregating[L], implicit conversions are provided in the Aggregating companion object from Equality[E] to the various types of aggregations of E. Here's an example:

The "contain inOrderOnly" syntax lets you assert that the containing object contains only the specified objects, in order. The specified objects may appear multiple times, but must appear in the order they appear in the right-hand list. Here's an example:

List(1, 2, 2, 3, 3, 3) must contain inOrderOnly (1, 2, 3)

The "contain inOrder" syntax lets you assert that the containing object contains only the specified objects in order, like inOrderOnly, but allows other objects to appear in the left-hand aggregation as well: contain more than one of each:

List(0, 1, 2, 2, 99, 3, 3, 3, 5) must contain inOrder (1, 2, 3)

Note that "order" in inOrder, inOrderOnly, and theSameElementsInOrderAs (described below) in the Aggregation[L] instances built-in to ScalaTest is defined as "iteration order".

Lastly, the "contain theSameElementsInOrderAs" syntax lets you assert that two aggregations contain the same exact elements in the same (iteration) order:

List(1, 2, 3) must contain theSameElementsInOrderAs collection.mutable.TreeSet(3, 2, 1)

The previous assertion succeeds because the iteration order of aTreeSet is the natural ordering of its elements, which in this case is 1, 2, 3. An iterator obtained from the left-hand List will produce the same elements in the same order.

Working with iterators

Althought it seems desireable to provide similar matcher syntax for Scala and Java iterators to that provided for sequences like Seqs, Array, and java.util.List, the ephemeral nature of iterators makes this problematic. Some syntax (such as must contain) is relatively straightforward to support on iterators, but other syntax (such as, for example, Inspector expressions on nested iterators) is not. Rather than allowing inconsistencies between sequences and iterators in the API, we chose to not support any such syntax directly on iterators:

scala> val it = List(1, 2, 3).iterator
it: Iterator[Int] = non-empty iterator

scala> it must contain (2) <console>:15: error: could not find implicit value for parameter typeClass1: org.scalatest.enablers.Containing[Iterator[Int]] it must contain (2) ^

Instead, you will need to convert your iterators to a sequence explicitly before using them in matcher expressions:

scala> it.toStream must contain (2)

We recommend you convert (Scala or Java) iterators to Streams, as shown in the previous example, so that you can continue to reap any potential benefits provided by the laziness of the underlying iterator.

Inspector shorthands

You can use the Inspectors syntax with matchers as well as assertions. If you have a multi-dimensional collection, such as a list of lists, using Inspectors is your best option:

val yss =
  List(
    List(1, 2, 3),
    List(1, 2, 3),
    List(1, 2, 3)
  )

forAll (yss) { ys => forAll (ys) { y => y must be > 0 } }

For assertions on one-dimensional collections, however, matchers provides "inspector shorthands." Instead of writing:

val xs = List(1, 2, 3)
forAll (xs) { x => x must be < 10 }

You can write:

all (xs) must be < 10

The previous statement asserts that all elements of the xs list must be less than 10. All of the inspectors have shorthands in matchers. Here is the full list:

Here are some examples:

scala> import org.scalatest.Matchers._
import org.scalatest.Matchers._

scala> val xs = List(1, 2, 3, 4, 5) xs: List[Int] = List(1, 2, 3, 4, 5)

scala> all (xs) must be > 0

scala> atMost(2, xs) must be >= 4

scala> atLeast(3, xs) must be < 5

scala> between(2, 3, xs) must (be > 1 and be < 5)

scala> exactly (2, xs) must be <= 2

scala> every (xs) must be < 10

scala> // And one that fails...

scala> exactly (2, xs) mustEqual 2 org.scalatest.exceptions.TestFailedException: 'exactly(2)' inspection failed, because only 1 element satisfied the assertion block at index 1: at index 0, 1 did not equal 2, at index 2, 3 did not equal 2, at index 3, 4 did not equal 2, at index 4, 5 did not equal 2 in List(1, 2, 3, 4, 5) at ...

Note: in the current 2.0.M6-SNAP release, the type of object used with inspector shorthands must be GenTraversable, but this will likely be widened to include Java collections, arrays, iterators, etc., for 2.0.M6.

Single-element collections

To assert both that a collection contains just one "lone" element as well as something else about that element, you can use the loneElement syntax. For example, if a Set[Int] must contain just one element, an Int less than or equal to 10, you could write:

set.loneElement must be <= 10

You can invoke loneElement on any type T for which an implicit Collecting[E, T] is available, where E is the type returned by the loneElement invocation.

Java collections and maps

You can use similar syntax on Java collections (java.util.Collection) and maps (java.util.Map). For example, you can check whether a Java Collection or Map is empty, like this:

javaCollection must be ('empty)
javaMap must be ('empty)

Even though Java's List type doesn't actually have a length or getLength method, you can nevertheless check the length of a Java List (java.util.List) like this:

javaList must have length 9

You can check the size of any Java Collection or Map, like this:

javaMap must have size 20
javaSet must have size 90

In addition, you can check whether a Java Collection contains a particular element, like this:

javaCollection must contain ("five")

One difference to note between the syntax supported on Java and Scala collections is that in Java, Map is not a subtype of Collection, and does not actually define an element type. You can ask a Java Map for an "entry set" via the entrySet method, which will return the Map's key/value pairs wrapped in a set of java.util.Map.Entry, but a Map is not actually a collection of Entry. To make Java Maps easier to work with, however, ScalaTest matchers allows you to treat a Java Map as a collection of Entry, and defines a convenience implementation of java.util.Map.Entry in org.scalatest.Entry. Here's how you use it:

javaMap must contain (Entry(2, 3))
javaMap must contain oneOf (Entry(2, 3), Entry(3, 4))

You can you alse just check whether a Java Map contains a particular key, or value, like this:

javaMap must contain key 1
javaMap must contain value "Howdy"

be as an equality comparison

All uses of be other than those shown previously perform an equality comparison. They work the same as equal when it is used with default equality. This redundancy between be and equals exists in part because it enables syntax that sometimes sounds more natural. For example, instead of writing:

result must equal (null)

You can write:

result must be (null)

(Hopefully you won't write that too much given null is error prone, and Option is usually a better, well, option.) Here are some other examples of be used for equality comparison:

sum must be (7.0)
boring must be (false)
fun must be (true)
list must be (Nil)
option must be (None)
option must be (Some(1))

As with equal used with default equality, using be on arrays results in deep being called on both arrays prior to calling equal. As a result, the following expression would not throw a TestFailedException:

Array(1, 2) must be (Array(1, 2)) // succeeds (i.e., does not throw TestFailedException)

Because be is used in several ways in ScalaTest matcher syntax, just as it is used in many ways in English, one potential point of confusion in the event of a failure is determining whether be was being used as an equality comparison or in some other way, such as a property assertion. To make it more obvious when be is being used for equality, the failure messages generated for those equality checks will include the word equal in them. For example, if this expression fails with a TestFailedException:

option must be (Some(1))

The detail message in that TestFailedException will include the words "equal to" to signify be was in this case being used for equality comparison:

Some(2) was not equal to Some(1)

Being negative

If you wish to check the opposite of some condition, you can simply insert not in the expression. Here are a few examples:

result must not be (null)
sum must not be <= (10)
mylist must not equal (yourList)
string must not startWith ("Hello")

Logical expressions with and and or

You can also combine matcher expressions with and and/or or, however, you must place parentheses or curly braces around the and or or expression. For example, this and-expression would not compile, because the parentheses are missing:

map must contain key ("two") and not contain value (7) // ERROR, parentheses missing!

Instead, you need to write:

map must (contain key ("two") and not contain value (7))

Here are some more examples:

number must (be > (0) and be <= (10))
option must (equal (Some(List(1, 2, 3))) or be (None))
string must (
  equal ("fee") or
  equal ("fie") or
  equal ("foe") or
  equal ("fum")
)

Two differences exist between expressions composed of these and and or operators and the expressions you can write on regular Booleans using its && and || operators. First, expressions with and and or do not short-circuit. The following contrived expression, for example, would print "hello, world!":

"yellow" must (equal ("blue") and equal { println("hello, world!"); "green" })

In other words, the entire and or or expression is always evaluated, so you'll see any side effects of the right-hand side even if evaluating only the left-hand side is enough to determine the ultimate result of the larger expression. Failure messages produced by these expressions will "short-circuit," however, mentioning only the left-hand side if that's enough to determine the result of the entire expression. This "short-circuiting" behavior of failure messages is intended to make it easier and quicker for you to ascertain which part of the expression caused the failure. The failure message for the previous expression, for example, would be:

"yellow" did not equal "blue"

Most likely this lack of short-circuiting would rarely be noticeable, because evaluating the right hand side will usually not involve a side effect. One situation where it might show up, however, is if you attempt to and a null check on a variable with an expression that uses the variable, like this:

map must (not be (null) and contain key ("ouch"))

If map is null, the test will indeed fail, but with a NullPointerException, not a TestFailedException. Here, the NullPointerException is the visible right-hand side effect. To get a TestFailedException, you would need to check each assertion separately:

map must not be (null)
map must contain key ("ouch")

If map is null in this case, the null check in the first expression will fail with a TestFailedException, and the second expression will never be executed.

The other difference with Boolean operators is that although && has a higher precedence than ||, and and or have the same precedence. Thus although the Boolean expression (a || b && c) will evaluate the && expression before the || expression, like (a || (b && c)), the following expression:

traversable must (contain (7) or contain (8) and have size (9))

Will evaluate left to right, as:

traversable must ((contain (7) or contain (8)) and have size (9))

If you really want the and part to be evaluated first, you'll need to put in parentheses, like this:

traversable must (contain (7) or (contain (8) and have size (9)))

Working with Options

ScalaTest matchers has no special support for Options, but you can work with them quite easily using syntax shown previously. For example, if you wish to check whether an option is None, you can write any of:

option must equal (None)
option must be (None)
option must not be ('defined)
option must be ('empty)

If you wish to check an option is defined, and holds a specific value, you can write either of:

option must equal (Some("hi"))
option must be (Some("hi"))

If you only wish to check that an option is defined, but don't care what it's value is, you can write:

option must be ('defined)

If you mix in (or import the members of) OptionValues, you can write one statement that indicates you believe an option must be defined and then say something else about its value. Here's an example:

import org.scalatest.OptionValues._
option.value must be < (7)

Checking arbitrary properties with have

Using have, you can check properties of any type, where a property is an attribute of any object that can be retrieved either by a public field, method, or JavaBean-style get or is method, like this:

book must have (
  'title ("Programming in Scala"),
  'author (List("Odersky", "Spoon", "Venners")),
  'pubYear (2008)
)

This expression will use reflection to ensure the title, author, and pubYear properties of object book are equal to the specified values. For example, it will ensure that book has either a public Java field or method named title, or a public method named getTitle, that when invoked (or accessed in the field case) results in a the string "Programming in Scala". If all specified properties exist and have their expected values, respectively, execution will continue. If one or more of the properties either does not exist, or exists but results in an unexpected value, a TestFailedException will be thrown that explains the problem. (For the details on how a field or method is selected during this process, see the documentation for HavePropertyMatcherGenerator.)

When you use this syntax, you must place one or more property values in parentheses after have, seperated by commas, where a property value is a symbol indicating the name of the property followed by the expected value in parentheses. The only exceptions to this rule is the syntax for checking size and length shown previously, which does not require parentheses. If you forget and put parentheses in, however, everything will still work as you'd expect. Thus instead of writing:

array must have length (3)
set must have size (90)

You can alternatively, write:

array must have (length (3))
set must have (size (90))

If a property has a value different from the specified expected value, a TestFailedError will be thrown with a detailed message that explains the problem. For example, if you assert the following on a book whose title is Moby Dick:

book must have ('title ("A Tale of Two Cities"))

You'll get a TestFailedException with this detail message:

The title property had value "Moby Dick", instead of its expected value "A Tale of Two Cities",
on object Book("Moby Dick", "Melville", 1851)

If you prefer to check properties in a type-safe manner, you can use a HavePropertyMatcher. This would allow you to write expressions such as:

book must have (
  title ("Programming in Scala"),
  author (List("Odersky", "Spoon", "Venners")),
  pubYear (2008)
)

These expressions would fail to compile if must is used on an inappropriate type, as determined by the type parameter of the HavePropertyMatcher being used. (For example, title in this example might be of type HavePropertyMatcher[org.publiclibrary.Book]. If used with an appropriate type, such an expression will compile and at run time the property method or field will be accessed directly; i.e., no reflection will be used. See the documentation for HavePropertyMatcher for more information.

Using length and size with HavePropertyMatchers

If you want to use length or size syntax with your own custom HavePropertyMatchers, you can do so, but you must write (of [“the type”]) afterwords. For example, you could write:

book must have (
  title ("A Tale of Two Cities"),
  length (220) (of [Book]),
  author ("Dickens")
)

Prior to ScalaTest 2.0, “length (22)” yielded a HavePropertyMatcher[Any, Int] that used reflection to dynamically look for a length field or getLength method. In ScalaTest 2.0, “length (22)” yields a MatcherFactory1[Any, Length], so it is no longer a HavePropertyMatcher. The (of [<type>]) syntax converts the the MatcherFactory1[Any, Length] to a HavePropertyMatcher[<type>, Int].

Using custom matchers

If none of the built-in matcher syntax (or options shown so far for extending the syntax) satisfy a particular need you have, you can create custom Matchers that allow you to place your own syntax directly after must. For example, class java.io.File has a method isHidden, which indicates whether a file of a certain path and name is hidden. Because the isHidden method takes no parameters and returns Boolean, you can call it using be with a symbol or BePropertyMatcher, yielding assertions like:

file must be ('hidden)  // using a symbol
file must be (hidden)   // using a BePropertyMatcher

If it doesn't make sense to have your custom syntax follow be, you might want to create a custom Matcher instead, so your syntax can follow must directly. For example, you might want to be able to check whether a java.io.File's name ends with a particular extension, like this:

// using a plain-old Matcher
file must endWithExtension ("txt")

ScalaTest provides several mechanism to make it easy to create custom matchers, including ways to compose new matchers out of existing ones complete with new error messages. For more information about how to create custom Matchers, please see the documentation for the Matcher trait.

Checking for expected exceptions

Sometimes you need to test whether a method throws an expected exception under certain circumstances, such as when invalid arguments are passed to the method. With Matchers mixed in, you can check for an expected exception like this:

an [IndexOutOfBoundsException] must be thrownBy s.charAt(-1)

If charAt throws an instance of StringIndexOutOfBoundsException, this expression will result in that exception. But if charAt completes normally, or throws a different exception, this expression will complete abruptly with a TestFailedException.

If you need to further isnpect an expected exception, you can capture it using this syntax:

val thrown = the [IndexOutOfBoundsException] thrownBy s.charAt(-1)

This expression returns the caught exception so that you can inspect it further if you wish, for example, to ensure that data contained inside the exception has the expected values. Here's an example:

thrown.getMessage must equal ("String index out of range: -1")

If you prefer you can also capture and inspect an expected exception in one statement, like this:

the [ArithmeticException] thrownBy 1 / 0 must have message "/ by zero"
the [IndexOutOfBoundsException] thrownBy {
  s.charAt(-1)
} must have message "String index out of range: -1"

You can also state that no exception must be thrown by some code, like this:

noException must be thrownBy 0 / 1

Note: the following syntax from ScalaTest 1.x has been deprecated:

evaluating { s.charAt(-1) } must produce [IndexOutOfBoundsException]

Such uses will continue to work during the deprecation cycle, but support for this syntax will eventually be removed in a future version of ScalaTest. Please change all uses to a corresponding use of the syntax described previously in this section.

Those pesky parens

Perhaps the most tricky part of writing assertions using ScalaTest matchers is remembering when you need or don't need parentheses, but bearing in mind a few simple rules should help. It is also reassuring to know that if you ever leave off a set of parentheses when they are required, your code will not compile. Thus the compiler will help you remember when you need the parens. That said, the rules are:

1. Although you don't always need them, it is recommended style to always put parentheses around right-hand values, such as the 7 in num must equal (7):

result must equal (4)
array must have length (3)
book must have (
  'title ("Programming in Scala"),
  'author (List("Odersky", "Spoon", "Venners")),
  'pubYear (2008)
)
option must be ('defined)
catMap must (contain key (9) and contain value ("lives"))
keyEvent must be an ('actionKey)
javaSet must have size (90)

2. Except for length and size, you must always put parentheses around the list of one or more property values following a have:

file must (exist and have ('name ("temp.txt")))
book must have (
  title ("Programming in Scala"),
  author (List("Odersky", "Spoon", "Venners")),
  pubYear (2008)
)
javaList must have length (9) // parens optional for length and size

3. You must always put parentheses around and and or expressions, as in:

catMap must (contain key (9) and contain value ("lives"))
number must (equal (2) or equal (4) or equal (8))

4. Although you don't always need them, it is recommended style to always put parentheses around custom Matchers when they appear directly after not:

file must exist
file must not (exist)
file must (exist and have ('name ("temp.txt")))
file must (not (exist) and have ('name ("temp.txt"))
file must (have ('name ("temp.txt") or exist)
file must (have ('name ("temp.txt") or not (exist))

That's it. With a bit of practice it should become natural to you, and the compiler will always be there to tell you if you forget a set of needed parentheses.

Self Type
MustMatchers
Annotations
@deprecated
Deprecated

Please use org.scalatest.Matchers instead.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. MustMatchers
  2. Explicitly
  3. MatcherWords
  4. MustVerb
  5. Tolerance
  6. Assertions
  7. TripleEquals
  8. TripleEqualsSupport
  9. AnyRef
  10. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. final class AWord extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  2. final class AnWord extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  3. class AnyMustWrapper[T] extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  4. class AssertionsHelper extends AnyRef

    Helper class used by code generated by the assert macro.

  5. class CheckingEqualizer[L] extends AnyRef

    Class used via an implicit conversion to enable two objects to be compared with === and !== with a Boolean result and an enforced type constraint between two object types.

  6. class DecidedByEquality[A] extends Equality[A]

    This class is part of the ScalaUtils “explicitly DSL”.

  7. class DecidedWord extends AnyRef

    This class is part of the ScalaUtils “explicitly DSL”.

  8. class DeterminedByEquivalence[T] extends Equivalence[T]

    This class is part of the ScalaUtils “explicitly DSL”.

  9. class DeterminedWord extends AnyRef

    This class is part of the ScalaUtils “explicitly DSL”.

  10. class Equalizer[L] extends AnyRef

    Class used via an implicit conversion to enable any two objects to be compared with === and !== with a Boolean result and no enforced type constraint between two object types.

  11. final class HavePropertyMatcherGenerator extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  12. final class KeyWord extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  13. class LegacyCheckingEqualizer[L] extends AnyRef

    Class used via an implicit conversion to enable any two objects to be compared with === and !== with an Option[String] result and an enforced type constraint between two object types.

  14. class LegacyEqualizer[L] extends AnyRef

    Class used via an implicit conversion to enable any two objects to be compared with === and !== with an Option[String] result and no enforced type constraint between two object types.

  15. final class PlusOrMinusWrapper[T] extends AnyRef

    Wrapper class with a +- method that, given a Numeric argument, returns a Spread.

  16. final class RegexWord extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  17. final class RegexWrapper extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  18. class ResultOfBeWordForAny[T] extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  19. sealed class ResultOfBeWordForCollectedAny[T] extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  20. final class ResultOfBeWordForCollectedArray[T] extends ResultOfBeWordForCollectedAny[Array[T]]

    This class is part of the ScalaTest matchers DSL.

  21. sealed class ResultOfCollectedAny[T] extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  22. final class ResultOfCollectedString extends ResultOfCollectedAny[String]

    This class is part of the ScalaTest matchers DSL.

  23. sealed class ResultOfContainWordForCollectedAny[T] extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  24. final class ResultOfEndWithWordForCollectedString extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  25. final class ResultOfEndWithWordForString extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  26. final class ResultOfEvaluatingApplication extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  27. final class ResultOfFullyMatchWordForCollectedString extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  28. final class ResultOfFullyMatchWordForString extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  29. final class ResultOfHaveWordForCollectedExtent[A] extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  30. final class ResultOfHaveWordForExtent[A] extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  31. final class ResultOfIncludeWordForCollectedString extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  32. final class ResultOfIncludeWordForString extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  33. sealed class ResultOfNotWordForCollectedAny[T] extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  34. final class ResultOfNotWordForCollectedString extends ResultOfNotWordForCollectedAny[String]

    This class is part of the ScalaTest matchers DSL.

  35. final class ResultOfProduceInvocation[T] extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  36. final class ResultOfStartWithWordForCollectedString extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  37. final class ResultOfStartWithWordForString extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  38. final class StringMustWrapper extends AnyMustWrapper[String] with StringMustWrapperForVerb

    This class is part of the ScalaTest matchers DSL.

  39. trait StringMustWrapperForVerb extends AnyRef

    This class supports the syntax of FlatSpec, WordSpec, fixture.FlatSpec, and fixture.WordSpec.

  40. class TheAfterWord extends AnyRef

    This class is part of the ScalaUtils “explicitly DSL”.

  41. final class TheSameInstanceAsPhrase extends AnyRef

    This class is part of the ScalaTest matchers DSL.

  42. final class ValueWord extends AnyRef

    This class is part of the ScalaTest matchers DSL.

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. def !==[T](right: Spread[T]): TripleEqualsInvocationOnSpread[T]

    Returns a TripleEqualsInvocationOnSpread[T], given an Spread[T], to facilitate the “<left> should !== (<pivot> +- <tolerance>)” syntax of Matchers.

    Returns a TripleEqualsInvocationOnSpread[T], given an Spread[T], to facilitate the “<left> should !== (<pivot> +- <tolerance>)” syntax of Matchers.

    right

    the Spread[T] against which to compare the left-hand value

    returns

    a TripleEqualsInvocationOnSpread wrapping the passed Spread[T] value, with expectingEqual set to false.

    Definition Classes
    TripleEqualsSupport
  4. def !==(right: Null): TripleEqualsInvocation[Null]

    Returns a TripleEqualsInvocation[Null], given a null reference, to facilitate the “<left> should !== null” syntax of Matchers.

    Returns a TripleEqualsInvocation[Null], given a null reference, to facilitate the “<left> should !== null” syntax of Matchers.

    right

    a null reference

    returns

    a TripleEqualsInvocation wrapping the passed null value, with expectingEqual set to false.

    Definition Classes
    TripleEqualsSupport
  5. def !==[T](right: T): TripleEqualsInvocation[T]

    Returns a TripleEqualsInvocation[T], given an object of type T, to facilitate the “<left> should !== <right>” syntax of Matchers.

    Returns a TripleEqualsInvocation[T], given an object of type T, to facilitate the “<left> should !== <right>” syntax of Matchers.

    right

    the right-hand side value for an equality assertion

    returns

    a TripleEqualsInvocation wrapping the passed right value, with expectingEqual set to false.

    Definition Classes
    TripleEqualsSupport
  6. final def ##(): Int

    Definition Classes
    AnyRef → Any
  7. def <[T](right: T)(implicit arg0: Ordering[T]): ResultOfLessThanComparison[T]

    This method enables the following syntax:

    This method enables the following syntax:

    num must (not be < (10) and not be > (17))
                       ^
    

  8. def <=[T](right: T)(implicit arg0: Ordering[T]): ResultOfLessThanOrEqualToComparison[T]

    This method enables the following syntax:

    This method enables the following syntax:

    num must (not be <= (10) and not be > (17))
                       ^
    

  9. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  11. def ===[T](right: Spread[T]): TripleEqualsInvocationOnSpread[T]

    Returns a TripleEqualsInvocationOnSpread[T], given an Spread[T], to facilitate the “<left> should === (<pivot> +- <tolerance>)” syntax of Matchers.

    Returns a TripleEqualsInvocationOnSpread[T], given an Spread[T], to facilitate the “<left> should === (<pivot> +- <tolerance>)” syntax of Matchers.

    right

    the Spread[T] against which to compare the left-hand value

    returns

    a TripleEqualsInvocationOnSpread wrapping the passed Spread[T] value, with expectingEqual set to true.

    Definition Classes
    TripleEqualsSupport
  12. def ===(right: Null): TripleEqualsInvocation[Null]

    Returns a TripleEqualsInvocation[Null], given a null reference, to facilitate the “<left> should === null” syntax of Matchers.

    Returns a TripleEqualsInvocation[Null], given a null reference, to facilitate the “<left> should === null” syntax of Matchers.

    right

    a null reference

    returns

    a TripleEqualsInvocation wrapping the passed null value, with expectingEqual set to true.

    Definition Classes
    TripleEqualsSupport
  13. def ===[T](right: T): TripleEqualsInvocation[T]

    Returns a TripleEqualsInvocation[T], given an object of type T, to facilitate the “<left> should === <right>” syntax of Matchers.

    Returns a TripleEqualsInvocation[T], given an object of type T, to facilitate the “<left> should === <right>” syntax of Matchers.

    right

    the right-hand side value for an equality assertion

    returns

    a TripleEqualsInvocation wrapping the passed right value, with expectingEqual set to true.

    Definition Classes
    TripleEqualsSupport
  14. def >[T](right: T)(implicit arg0: Ordering[T]): ResultOfGreaterThanComparison[T]

    This method enables the following syntax:

    This method enables the following syntax:

    num must (not be > (10) and not be < (7))
                       ^
    

  15. def >=[T](right: T)(implicit arg0: Ordering[T]): ResultOfGreaterThanOrEqualToComparison[T]

    This method enables the following syntax:

    This method enables the following syntax:

    num must (not be >= (10) and not be < (7))
                       ^
    

  16. def a[T](implicit arg0: Manifest[T]): ResultOfATypeInvocation[T]

    This method enables the following syntax:

    This method enables the following syntax:

    a [RuntimeException] must be thrownBy { ... }
    ^
    

  17. val a: AWord

    This field enables the following syntax:

    This field enables the following syntax:

    badBook must not be a ('goodRead)
                          ^
    

  18. val after: TheAfterWord

    This field enables syntax such as the following:

    This field enables syntax such as the following:

    result should equal ("hello") (after being lowerCased)
                                   ^
    

    Definition Classes
    Explicitly
  19. def all(xs: GenTraversable[String]): ResultOfCollectedString

    This method enables the following syntax, where xs is a GenTraversable[String]:

    This method enables the following syntax, where xs is a GenTraversable[String]:

    all(xs) must fullymatch regex ("Hel*o world".r)
    ^
    

  20. def all[T](xs: GenTraversable[T]): ResultOfCollectedAny[T]

    This method enables the following syntax:

    This method enables the following syntax:

    all(xs) must fullymatch regex ("Hel*o world".r)
    ^
    

  21. def allOf(firstEle: Any, secondEle: Any, remainingEles: Any*): ResultOfAllOfApplication

    This method enables the following syntax:

    This method enables the following syntax:

    List(1, 2, 3) must contain (allOf(1, 2))
                                  ^
    

  22. def an[T](implicit arg0: Manifest[T]): ResultOfAnTypeInvocation[T]

    This method enables the following syntax:

    This method enables the following syntax:

    an [Exception] must be thrownBy { ... }
    ^
    

  23. val an: AnWord

    This field enables the following syntax:

    This field enables the following syntax:

    badBook must not be an (excellentRead)
                          ^
    

  24. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  25. def assert(condition: Boolean, clue: Any): Unit

    Assert that a boolean condition, described in String message, is true.

    Assert that a boolean condition, described in String message, is true. If the condition is true, this method returns normally. Else, it throws TestFailedException with the String obtained by invoking toString on the specified clue as the exception's detail message.

    condition

    the boolean condition to assert

    clue

    An objects whose toString method returns a message to include in a failure report.

    Definition Classes
    Assertions
    Annotations
    @macroImpl()
    Exceptions thrown
    NullPointerException

    if message is null.

    TestFailedException

    if the condition is false.

  26. def assert(condition: Boolean): Unit

    Assert that a boolean condition is true.

    Assert that a boolean condition is true. If the condition is true, this method returns normally. Else, it throws TestFailedException.

    This method is implemented in terms of a Scala macro that will generate a more helpful error message for simple quality checks of this form:

    • assert(a == b)
    • assert(a != b)
    • assert(a === b)
    • assert(a !== b)

    Any other form of expression will just get a plain-old TestFailedException at this time. In the future, we will enhance this macro to give helpful error messages in more situations. In ScalaTest 2.0, however, this behavior was sufficient to allow the === that returns Boolean, not Option[String] to be the default in tests. This makes === consistent between tests and production code. If you have pre-existing code you wrote under ScalaTest 1.x, in which you are expecting=== to return an Option[String], use can get that behavior back by mixing in trait LegacyTripleEquals.

    condition

    the boolean condition to assert

    Definition Classes
    Assertions
    Annotations
    @macroImpl()
    Exceptions thrown
    TestFailedException

    if the condition is false.

  27. def assertResult(expected: Any)(actual: Any): Unit

    Assert that the value passed as expected equals the value passed as actual.

    Assert that the value passed as expected equals the value passed as actual. If the actual value equals the expected value (as determined by ==), assertResult returns normally. Else, assertResult throws a TestFailedException whose detail message includes the expected and actual values.

    expected

    the expected value

    actual

    the actual value, which should equal the passed expected value

    Definition Classes
    Assertions
    Exceptions thrown
    TestFailedException

    if the passed actual value does not equal the passed expected value.

  28. def assertResult(expected: Any, clue: Any)(actual: Any): Unit

    Assert that the value passed as expected equals the value passed as actual.

    Assert that the value passed as expected equals the value passed as actual. If the actual equals the expected (as determined by ==), assertResult returns normally. Else, if actual is not equal to expected, assertResult throws a TestFailedException whose detail message includes the expected and actual values, as well as the String obtained by invoking toString on the passed clue.

    expected

    the expected value

    clue

    An object whose toString method returns a message to include in a failure report.

    actual

    the actual value, which should equal the passed expected value

    Definition Classes
    Assertions
    Exceptions thrown
    TestFailedException

    if the passed actual value does not equal the passed expected value.

  29. val assertionsHelper: AssertionsHelper

    Helper instance used by code generated by macro assertion.

    Helper instance used by code generated by macro assertion.

    Definition Classes
    Assertions
  30. def assume(condition: Boolean, clue: Any): Unit

    Assume that a boolean condition, described in String message, is true.

    Assume that a boolean condition, described in String message, is true. If the condition is true, this method returns normally. Else, it throws TestCanceledException with the String obtained by invoking toString on the specified clue as the exception's detail message.

    condition

    the boolean condition to assume

    clue

    An objects whose toString method returns a message to include in a failure report.

    Definition Classes
    Assertions
    Annotations
    @macroImpl()
    Exceptions thrown
    NullPointerException

    if message is null.

    TestCanceledException

    if the condition is false.

  31. def assume(condition: Boolean): Unit

    Assume that a boolean condition is true.

    Assume that a boolean condition is true. If the condition is true, this method returns normally. Else, it throws TestCanceledException.

    This method is implemented in terms of a Scala macro that will generate a more helpful error message for simple quality checks of this form:

    • assume(a == b)
    • assume(a != b)
    • assume(a === b)
    • assume(a !== b)

    Any other form of expression will just get a plain-old TestCanceledException at this time. In the future, we will enhance this macro to give helpful error messages in more situations. In ScalaTest 2.0, however, this behavior was sufficient to allow the === that returns Boolean, not Option[String] to be the default in tests. This makes === consistent between tests and production code. If you have pre-existing code you wrote under ScalaTest 1.x, in which you are expecting=== to return an Option[String], use can get that behavior back by mixing in trait LegacyTripleEquals.

    condition

    the boolean condition to assume

    Definition Classes
    Assertions
    Annotations
    @macroImpl()
    Exceptions thrown
    TestCanceledException

    if the condition is false.

  32. def atLeast(num: Int, xs: GenTraversable[String]): ResultOfCollectedString

    This method enables the following syntax, where xs is a GenTraversable[String]:

    This method enables the following syntax, where xs is a GenTraversable[String]:

    atLeast(1, xs) must fullymatch regex ("Hel*o world".r)
    ^
    

  33. def atLeast[T](num: Int, xs: GenTraversable[T]): ResultOfCollectedAny[T]

    This method enables the following syntax:

    This method enables the following syntax:

    atLeast(1, xs) must fullymatch regex ("Hel*o world".r)
    ^
    

  34. def atLeastOneOf(firstEle: Any, secondEle: Any, remainingEles: Any*): ResultOfAtLeastOneOfApplication

    This method enables the following syntax:

    This method enables the following syntax:

    List(1, 2, 3) must contain (atLeastOneOf(1, 2))
                                  ^
    

  35. def atMost(num: Int, xs: GenTraversable[String]): ResultOfCollectedString

    This method enables the following syntax, where xs is a GenTraversable[String]:

    This method enables the following syntax, where xs is a GenTraversable[String]:

    atMost(3, xs) must fullymatch regex ("Hel*o world".r)
    ^
    

  36. def atMost[T](num: Int, xs: GenTraversable[T]): ResultOfCollectedAny[T]

    This method enables the following syntax:

    This method enables the following syntax:

    atMost(3, xs) must fullymatch regex ("Hel*o world".r)
    ^
    

  37. def atMostOneOf(firstEle: Any, secondEle: Any, remainingEles: Any*): ResultOfAtMostOneOfApplication

    This method enables the following syntax:

    This method enables the following syntax:

    List(1, 2, 3) must contain (atMostOneOf(1, 2))
                                  ^
    

  38. val be: BeWord

    This field enables syntax such as the following:

    This field enables syntax such as the following:

    obj should (be theSameInstanceAs (string) and be theSameInstanceAs (string))
                ^
    

    Definition Classes
    MatcherWords
  39. def between(from: Int, upTo: Int, xs: GenTraversable[String]): ResultOfCollectedString

    This method enables the following syntax, where xs is a GenTraversable[String]:

    This method enables the following syntax, where xs is a GenTraversable[String]:

    between(1, 3, xs) must fullymatch regex ("Hel*o world".r)
    ^
    

  40. def between[T](from: Int, upTo: Int, xs: GenTraversable[T]): ResultOfCollectedAny[T]

    This method enables the following syntax:

    This method enables the following syntax:

    between(1, 3, xs) must fullymatch regex ("Hel*o world".r)
    ^
    

  41. def cancel(cause: Throwable): Nothing

    Throws TestCanceledException, with the passed Throwable cause, to indicate a test failed.

    Throws TestCanceledException, with the passed Throwable cause, to indicate a test failed. The getMessage method of the thrown TestCanceledException will return cause.toString.

    cause

    a Throwable that indicates the cause of the cancellation.

    Definition Classes
    Assertions
    Exceptions thrown
    NullPointerException

    if cause is null

  42. def cancel(message: String, cause: Throwable): Nothing

    Throws TestCanceledException, with the passed String message as the exception's detail message and Throwable cause, to indicate a test failed.

    Throws TestCanceledException, with the passed String message as the exception's detail message and Throwable cause, to indicate a test failed.

    message

    A message describing the failure.

    cause

    A Throwable that indicates the cause of the failure.

    Definition Classes
    Assertions
    Exceptions thrown
    NullPointerException

    if message or cause is null

  43. def cancel(message: String): Nothing

    Throws TestCanceledException, with the passed String message as the exception's detail message, to indicate a test was canceled.

    Throws TestCanceledException, with the passed String message as the exception's detail message, to indicate a test was canceled.

    message

    A message describing the cancellation.

    Definition Classes
    Assertions
    Exceptions thrown
    NullPointerException

    if message is null

  44. def cancel(): Nothing

    Throws TestCanceledException to indicate a test was canceled.

    Throws TestCanceledException to indicate a test was canceled.

    Definition Classes
    Assertions
  45. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  46. val contain: ContainWord

    This field enables syntax such as the following:

    This field enables syntax such as the following:

    list should (contain ('a') and have length (7))
                 ^
    

    Definition Classes
    MatcherWords
  47. def conversionCheckedConstraint[A, B](implicit equivalenceOfA: Equivalence[A], cnv: (B) ⇒ A): Constraint[A, B]

    Provides a Constraint[A, B] class for any two types A and B, enforcing the type constraint that B is implicitly convertible to A, given an implicit Equivalence[A].

    Provides a Constraint[A, B] class for any two types A and B, enforcing the type constraint that B is implicitly convertible to A, given an implicit Equivalence[A].

    The returned Constraint's areEqual method uses the implicitly passed Equivalence[A]'s areEquivalent method to determine equality.

    This method is overridden and made implicit by subtraits ConversionCheckedTripleEquals) and ConversionCheckedLegacyTripleEquals, and overriden as non-implicit by the other subtraits in this package.

    equivalenceOfA

    an Equivalence[A] type class to which the Constraint.areEqual method will delegate to determine equality.

    cnv

    an implicit conversion from B to A

    returns

    a Constraint[A, B] whose areEqual method delegates to the areEquivalent method of the passed Equivalence[A].

    Definition Classes
    TripleEqualsTripleEqualsSupport
  48. def convertEquivalenceToAToBConstraint[A, B](equivalenceOfB: Equivalence[B])(implicit ev: <:<[A, B]): Constraint[A, B]

    Provides a Constraint[A, B] for any two types A and B, enforcing the type constraint that A must be a subtype of B, given an explicit Equivalence[B].

    Provides a Constraint[A, B] for any two types A and B, enforcing the type constraint that A must be a subtype of B, given an explicit Equivalence[B].

    This method is used to enable the Explicitly DSL for TypeCheckedTripleEquals by requiring an explicit Equivalance[B], but taking an implicit function that provides evidence that A is a subtype of B.

    The returned Constraint's areEqual method uses the implicitly passed Equivalence[B]'s areEquivalent method to determine equality.

    This method is overridden and made implicit by subtraits LowPriorityTypeCheckedConstraint (extended by TypeCheckedTripleEquals), and LowPriorityTypeCheckedLegacyConstraint (extended by TypeCheckedLegacyTripleEquals), and overriden as non-implicit by the other subtraits in this package.

    equivalenceOfB

    an Equivalence[B] type class to which the Constraint.areEqual method will delegate to determine equality.

    ev

    evidence that A is a subype of B

    returns

    a Constraint[A, B] whose areEqual method delegates to the areEquivalent method of the passed Equivalence[B].

    Definition Classes
    TripleEqualsTripleEqualsSupport
  49. def convertEquivalenceToAToBConversionConstraint[A, B](equivalenceOfB: Equivalence[B])(implicit ev: (A) ⇒ B): Constraint[A, B]

    Provides a Constraint[A, B] class for any two types A and B, enforcing the type constraint that A is implicitly convertible to B, given an explicit Equivalence[B].

    Provides a Constraint[A, B] class for any two types A and B, enforcing the type constraint that A is implicitly convertible to B, given an explicit Equivalence[B].

    This method is used to enable the Explicitly DSL for ConversionCheckedTripleEquals by requiring an explicit Equivalance[B], but taking an implicit function that converts from A to B.

    The returned Constraint's areEqual method uses the implicitly passed Equivalence[B]'s areEquivalent method to determine equality.

    This method is overridden and made implicit by subtraits LowPriorityConversionCheckedConstraint (extended by ConversionCheckedTripleEquals), and LowPriorityConversionCheckedLegacyConstraint (extended by ConversionCheckedLegacyTripleEquals), and overriden as non-implicit by the other subtraits in this package.

    returns

    a Constraint[A, B] whose areEqual method delegates to the areEquivalent method of the passed Equivalence[B].

    Definition Classes
    TripleEqualsTripleEqualsSupport
  50. def convertEquivalenceToBToAConstraint[A, B](equivalenceOfA: Equivalence[A])(implicit ev: <:<[B, A]): Constraint[A, B]

    Provides a Constraint[A, B] for any two types A and B, enforcing the type constraint that B must be a subtype of A, given an explicit Equivalence[A].

    Provides a Constraint[A, B] for any two types A and B, enforcing the type constraint that B must be a subtype of A, given an explicit Equivalence[A].

    This method is used to enable the Explicitly DSL for TypeCheckedTripleEquals by requiring an explicit Equivalance[B], but taking an implicit function that provides evidence that A is a subtype of B. For example, under TypeCheckedTripleEquals, this method (as an implicit method), would be used to compile this statement:

    def closeEnoughTo1(num: Double): Boolean =
      (num === 1.0)(decided by forgivingEquality)
    

    The returned Constraint's areEqual method uses the implicitly passed Equivalence[A]'s areEquivalent method to determine equality.

    This method is overridden and made implicit by subtraits TypeCheckedTripleEquals) and TypeCheckedLegacyTripleEquals, and overriden as non-implicit by the other subtraits in this package.

    ev

    evidence that B is a subype of A

    returns

    a Constraint[A, B] whose areEqual method delegates to the areEquivalent method of the passed Equivalence[A].

    Definition Classes
    TripleEqualsTripleEqualsSupport
  51. def convertEquivalenceToBToAConversionConstraint[A, B](equivalenceOfA: Equivalence[A])(implicit ev: (B) ⇒ A): Constraint[A, B]

    Provides a Constraint[A, B] class for any two types A and B, enforcing the type constraint that B is implicitly convertible to A, given an explicit Equivalence[A].

    Provides a Constraint[A, B] class for any two types A and B, enforcing the type constraint that B is implicitly convertible to A, given an explicit Equivalence[A].

    This method is used to enable the Explicitly DSL for ConversionCheckedTripleEquals by requiring an explicit Equivalance[A], but taking an implicit function that converts from B to A. For example, under ConversionCheckedTripleEquals, this method (as an implicit method), would be used to compile this statement:

    def closeEnoughTo1(num: Double): Boolean =
      (num === 1.0)(decided by forgivingEquality)
    

    The returned Constraint's areEqual method uses the implicitly passed Equivalence[A]'s areEquivalent method to determine equality.

    This method is overridden and made implicit by subtraits ConversionCheckedTripleEquals) and ConversionCheckedLegacyTripleEquals, and overriden as non-implicit by the other subtraits in this package.

    equivalenceOfA

    an Equivalence[A] type class to which the Constraint.areEqual method will delegate to determine equality.

    returns

    a Constraint[A, B] whose areEqual method delegates to the areEquivalent method of the passed Equivalence[A].

    Definition Classes
    TripleEqualsTripleEqualsSupport
  52. implicit def convertNumericToPlusOrMinusWrapper[T](pivot: T)(implicit arg0: Numeric[T]): PlusOrMinusWrapper[T]

    Implicitly converts an object of a Numeric type to a PlusOrMinusWrapper, to enable a +- method to be invoked on that object.

    Implicitly converts an object of a Numeric type to a PlusOrMinusWrapper, to enable a +- method to be invoked on that object.

    Definition Classes
    Tolerance
  53. implicit def convertSymbolToHavePropertyMatcherGenerator(symbol: Symbol): HavePropertyMatcherGenerator

    This implicit conversion method converts a Symbol to a HavePropertyMatcherGenerator, to enable the symbol to be used with the have ('author ("Dickens")) syntax.

  54. implicit def convertToAnyMustWrapper[T](o: T): AnyMustWrapper[T]

    Implicitly converts an object of type T to a AnyMustWrapper[T], to enable must methods to be invokable on that object.

  55. def convertToCheckingEqualizer[T](left: T): CheckingEqualizer[T]

    Converts to an CheckingEqualizer that provides === and !== operators that result in Boolean and enforce a type constraint.

    Converts to an CheckingEqualizer that provides === and !== operators that result in Boolean and enforce a type constraint.

    This method is overridden and made implicit by subtraits TypeCheckedTripleEquals and ConversionCheckedTripleEquals, and overriden as non-implicit by the other subtraits in this package.

    left

    the object whose type to convert to CheckingEqualizer.

    Definition Classes
    TripleEqualsTripleEqualsSupport
    Exceptions thrown
    NullPointerException

    if left is null.

  56. implicit def convertToEqualizer[T](left: T): Equalizer[T]

    Converts to an Equalizer that provides === and !== operators that result in Boolean and enforce no type constraint.

    Converts to an Equalizer that provides === and !== operators that result in Boolean and enforce no type constraint.

    This method is overridden and made implicit by subtrait TripleEquals and overriden as non-implicit by the other subtraits in this package.

    left

    the object whose type to convert to Equalizer.

    Definition Classes
    TripleEqualsTripleEqualsSupport
    Exceptions thrown
    NullPointerException

    if left is null.

  57. def convertToLegacyCheckingEqualizer[T](left: T): LegacyCheckingEqualizer[T]

    Converts to a LegacyCheckingEqualizer that provides === and !== operators that result in Option[String] and enforce a type constraint.

    Converts to a LegacyCheckingEqualizer that provides === and !== operators that result in Option[String] and enforce a type constraint.

    This method is overridden and made implicit by subtraits TypeCheckedLegacyTripleEquals and ConversionCheckedLegacyTripleEquals, and overriden as non-implicit by the other subtraits in this package.

    left

    the object whose type to convert to LegacyCheckingEqualizer.

    Definition Classes
    TripleEqualsTripleEqualsSupport
    Exceptions thrown
    NullPointerException

    if left is null.

  58. def convertToLegacyEqualizer[T](left: T): LegacyEqualizer[T]

    Converts to a LegacyEqualizer that provides === and !== operators that result in Option[String] and enforce no type constraint.

    Converts to a LegacyEqualizer that provides === and !== operators that result in Option[String] and enforce no type constraint.

    This method is overridden and made implicit by subtrait LegacyTripleEquals and overriden as non-implicit by the other subtraits in this package.

    left

    the object whose type to convert to LegacyEqualizer.

    Definition Classes
    TripleEqualsTripleEqualsSupport
    Exceptions thrown
    NullPointerException

    if left is null.

  59. implicit def convertToRegexWrapper(o: Regex): RegexWrapper

    Implicitly converts an object of type scala.util.matching.Regex to a RegexWrapper, to enable withGroup and withGroups methods to be invokable on that object.

  60. implicit def convertToStringMustWrapper(o: String): StringMustWrapper

    Implicitly converts an object of type java.lang.String to a StringMustWrapper, to enable must methods to be invokable on that object.

    Implicitly converts an object of type java.lang.String to a StringMustWrapper, to enable must methods to be invokable on that object.

    Definition Classes
    MustMatchersMustVerb
  61. val decided: DecidedWord

    This field enables syntax such as the following:

    This field enables syntax such as the following:

    result should equal ("hello") (decided by defaultEquality)
                                   ^
    

    Definition Classes
    Explicitly
  62. def defaultEquality[A]: Equality[A]

    Returns an Equality[A] for any type A that determines equality by first calling .deep on any Array (on either the left or right side), then comparing the resulting objects with ==.

    Returns an Equality[A] for any type A that determines equality by first calling .deep on any Array (on either the left or right side), then comparing the resulting objects with ==.

    returns

    a default Equality for type A

    Definition Classes
    TripleEqualsSupport
  63. val defined: DefinedWord

    This field enables the following syntax:

    This field enables the following syntax:

    seq should be (defined)
                  ^
    

    Definition Classes
    MatcherWords
  64. def definedAt[T](right: T): ResultOfDefinedAt[T]

    This method enables the following syntax:

    This method enables the following syntax:

    list must (not be definedAt (7) and not be definedAt (9))
                        ^
    

  65. val determined: DeterminedWord

    This field enables syntax such as the following, given an Equivalence[String] named myStringEquivalence:

    This field enables syntax such as the following, given an Equivalence[String] named myStringEquivalence:

    result should equal ("hello") (determined by myStringEquivalence)
                                   ^
    

    Definition Classes
    Explicitly
  66. val empty: EmptyWord

    This field enables the following syntax:

    This field enables the following syntax:

    list should be (empty)
                    ^
    

    Definition Classes
    MatcherWords
  67. val endWith: EndWithWord

    This field enables syntax such as the following:

    This field enables syntax such as the following:

    string should (endWith ("ago") and include ("score"))
                   ^
    

    Definition Classes
    MatcherWords
  68. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  69. def equal(o: Null): Matcher[AnyRef]

    This method enables syntax such as the following:

    This method enables syntax such as the following:

    result must equal (null)
                  ^
    

  70. def equal[T](spread: Spread[T]): Matcher[T]

    This method enables syntax such as the following:

    This method enables syntax such as the following:

    result must equal (100 +- 1)
                  ^
    

  71. def equal(right: Any): MatcherFactory1[Any, Equality]

    This method enables the following syntax:

    This method enables the following syntax:

    result should equal (7)
                  ^
    

    The left should equal (right) syntax works by calling == on the left value, passing in the right value, on every type except arrays. If both left and right are arrays, deep will be invoked on both left and right before comparing them with ==. Thus, even though this expression will yield false, because Array's equals method compares object identity:

    Array(1, 2) == Array(1, 2) // yields false
    

    The following expression will not result in a TestFailedException, because ScalaTest will compare the two arrays structurally, taking into consideration the equality of the array's contents:

    Array(1, 2) should equal (Array(1, 2)) // succeeds (i.e., does not throw TestFailedException)
    

    If you ever do want to verify that two arrays are actually the same object (have the same identity), you can use the be theSameInstanceAs syntax.

    Definition Classes
    MatcherWords
  72. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  73. def evaluating(fun: ⇒ Any): ResultOfEvaluatingApplication

    This method enables syntax such as the following:

    This method enables syntax such as the following:

    evaluating { "hi".charAt(-1) } must produce [StringIndexOutOfBoundsException]
    ^
    

  74. def every(xs: GenTraversable[String]): ResultOfCollectedString

    This method enables the following syntax, where xs is a GenTraversable[String]:

    This method enables the following syntax, where xs is a GenTraversable[String]:

    every(xs) must fullymatch regex ("Hel*o world".r)
    ^
    

  75. def every[T](xs: GenTraversable[T]): ResultOfCollectedAny[T]

    This method enables the following syntax:

    This method enables the following syntax:

    every(xs) must fullymatch regex ("Hel*o world".r)
    ^
    

  76. def exactly(num: Int, xs: GenTraversable[String]): ResultOfCollectedString

    This method enables the following syntax, where xs is a GenTraversable[String]:

    This method enables the following syntax, where xs is a GenTraversable[String]:

    exactly(xs) must fullymatch regex ("Hel*o world".r)
    ^
    

  77. def exactly[T](num: Int, xs: GenTraversable[T]): ResultOfCollectedAny[T]

    This method enables the following syntax:

    This method enables the following syntax:

    exactly(xs) must fullymatch regex ("Hel*o world".r)
    ^
    

  78. val exist: ExistWord

    This field enables the following syntax:

    This field enables the following syntax:

    file should exist
                ^
    

    Definition Classes
    MatcherWords
  79. def fail(cause: Throwable): Nothing

    Throws TestFailedException, with the passed Throwable cause, to indicate a test failed.

    Throws TestFailedException, with the passed Throwable cause, to indicate a test failed. The getMessage method of the thrown TestFailedException will return cause.toString.

    cause

    a Throwable that indicates the cause of the failure.

    Definition Classes
    Assertions
    Exceptions thrown
    NullPointerException

    if cause is null

  80. def fail(message: String, cause: Throwable): Nothing

    Throws TestFailedException, with the passed String message as the exception's detail message and Throwable cause, to indicate a test failed.

    Throws TestFailedException, with the passed String message as the exception's detail message and Throwable cause, to indicate a test failed.

    message

    A message describing the failure.

    cause

    A Throwable that indicates the cause of the failure.

    Definition Classes
    Assertions
    Exceptions thrown
    NullPointerException

    if message or cause is null

  81. def fail(message: String): Nothing

    Throws TestFailedException, with the passed String message as the exception's detail message, to indicate a test failed.

    Throws TestFailedException, with the passed String message as the exception's detail message, to indicate a test failed.

    message

    A message describing the failure.

    Definition Classes
    Assertions
    Exceptions thrown
    NullPointerException

    if message is null

  82. def fail(): Nothing

    Throws TestFailedException to indicate a test failed.

    Throws TestFailedException to indicate a test failed.

    Definition Classes
    Assertions
  83. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  84. val fullyMatch: FullyMatchWord

    This field enables syntax such as the following:

    This field enables syntax such as the following:

    string should (fullyMatch regex ("Hel*o, wor.d") and not have length (99))
                   ^
    

    Definition Classes
    MatcherWords
  85. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  86. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  87. val have: HaveWord

    This field enables syntax such as the following:

    This field enables syntax such as the following:

    list should (have length (3) and not contain ('a'))
                 ^
    

    Definition Classes
    MatcherWords
  88. def inOrder(firstEle: Any, secondEle: Any, remainingEles: Any*): ResultOfInOrderApplication

    This method enables the following syntax:

    This method enables the following syntax:

    List(1, 2, 3) must contain (inOrder(1, 2))
                                  ^
    

  89. def inOrderOnly[T](firstEle: Any, secondEle: Any, remainingEles: Any*): ResultOfInOrderOnlyApplication

    This method enables the following syntax:

    This method enables the following syntax:

    List(1, 2, 3) must contain (inOrderOnly(1, 2))
                                  ^
    

  90. val include: IncludeWord

    This field enables syntax such as the following:

    This field enables syntax such as the following:

    string should (include ("hope") and not startWith ("no"))
                   ^
    

    Definition Classes
    MatcherWords
  91. def intercept[T <: AnyRef](f: ⇒ Any)(implicit manifest: Manifest[T]): T

    Intercept and return an exception that's expected to be thrown by the passed function value.

    Intercept and return an exception that's expected to be thrown by the passed function value. The thrown exception must be an instance of the type specified by the type parameter of this method. This method invokes the passed function. If the function throws an exception that's an instance of the specified type, this method returns that exception. Else, whether the passed function returns normally or completes abruptly with a different exception, this method throws TestFailedException.

    Note that the type specified as this method's type parameter may represent any subtype of AnyRef, not just Throwable or one of its subclasses. In Scala, exceptions can be caught based on traits they implement, so it may at times make sense to specify a trait that the intercepted exception's class must mix in. If a class instance is passed for a type that could not possibly be used to catch an exception (such as String, for example), this method will complete abruptly with a TestFailedException.

    f

    the function value that should throw the expected exception

    manifest

    an implicit Manifest representing the type of the specified type parameter.

    returns

    the intercepted exception, if it is of the expected type

    Definition Classes
    Assertions
    Exceptions thrown
    TestFailedException

    if the passed function does not complete abruptly with an exception that's an instance of the specified type passed expected value.

  92. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  93. val key: KeyWord

    This field enables the following syntax:

    This field enables the following syntax:

    map must not contain key (10)
                           ^
    

  94. val length: LengthWord

    This field enables the following syntax:

    This field enables the following syntax:

    "hi" should not have length (3)
                         ^
    

    Definition Classes
    MatcherWords
  95. def lowPriorityConversionCheckedConstraint[A, B](implicit equivalenceOfB: Equivalence[B], cnv: (A) ⇒ B): Constraint[A, B]

    Provides a Constraint[A, B] class for any two types A and B, enforcing the type constraint that A is implicitly convertible to B, given an implicit Equivalence[B].

    Provides a Constraint[A, B] class for any two types A and B, enforcing the type constraint that A is implicitly convertible to B, given an implicit Equivalence[B].

    The returned Constraint's areEqual method uses the implicitly passed Equivalence[B]'s areEquivalent method to determine equality.

    This method is overridden and made implicit by subtraits LowPriorityConversionCheckedConstraint (extended by ConversionCheckedTripleEquals), and LowPriorityConversionCheckedLegacyConstraint (extended by ConversionCheckedLegacyTripleEquals), and overriden as non-implicit by the other subtraits in this package.

    cnv

    an implicit conversion from A to B

    returns

    a Constraint[A, B] whose areEqual method delegates to the areEquivalent method of the passed Equivalence[B].

    Definition Classes
    TripleEqualsTripleEqualsSupport
  96. def lowPriorityTypeCheckedConstraint[A, B](implicit equivalenceOfB: Equivalence[B], ev: <:<[A, B]): Constraint[A, B]

    Provides a Constraint[A, B] for any two types A and B, enforcing the type constraint that A must be a subtype of B, given an implicit Equivalence[B].

    Provides a Constraint[A, B] for any two types A and B, enforcing the type constraint that A must be a subtype of B, given an implicit Equivalence[B].

    The returned Constraint's areEqual method uses the implicitly passed Equivalence[A]'s areEquivalent method to determine equality.

    This method is overridden and made implicit by subtraits LowPriorityTypeCheckedConstraint (extended by TypeCheckedTripleEquals), and LowPriorityTypeCheckedLegacyConstraint (extended by TypeCheckedLegacyTripleEquals), and overriden as non-implicit by the other subtraits in this package.

    equivalenceOfB

    an Equivalence[B] type class to which the Constraint.areEqual method will delegate to determine equality.

    ev

    evidence that A is a subype of B

    returns

    a Constraint[A, B] whose areEqual method delegates to the areEquivalent method of the passed Equivalence[B].

    Definition Classes
    TripleEqualsTripleEqualsSupport
  97. def message(expectedMessage: String): ResultOfMessageWordApplication

    This method enables the following syntax:

    This method enables the following syntax:

    exception must not have message ("file not found")
                              ^
    

  98. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  99. def no(xs: GenTraversable[String]): ResultOfCollectedString

    This method enables the following syntax, where xs is a GenTraversable[String]:

    This method enables the following syntax, where xs is a GenTraversable[String]:

    no(xs) must fullymatch regex ("Hel*o world".r)
    ^
    

  100. def no[T](xs: GenTraversable[T]): ResultOfCollectedAny[T]

    This method enables the following syntax:

    This method enables the following syntax:

    no(xs) must fullymatch regex ("Hel*o world".r)
    ^
    

  101. val noException: NoExceptionWord

    This field enables the following syntax:

    This field enables the following syntax:

    noException should be thrownBy
    ^
    

    Definition Classes
    MatcherWords
  102. def noneOf(firstEle: Any, secondEle: Any, remainingEles: Any*): ResultOfNoneOfApplication

    This method enables the following syntax:

    This method enables the following syntax:

    List(1, 2, 3) must contain (noneOf(1, 2))
                                  ^
    

  103. val not: NotWord

    This field enables syntax like the following:

    This field enables syntax like the following:

    myFile should (not be an (directory) and not have ('name ("foo.bar")))
                   ^
    

    Definition Classes
    MatcherWords
  104. final def notify(): Unit

    Definition Classes
    AnyRef
  105. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  106. def of[T](implicit ev: Manifest[T]): ResultOfOfTypeInvocation[T]

    This method enables syntax such as the following:

    This method enables syntax such as the following:

    book must have (message ("A TALE OF TWO CITIES") (of [Book]), title ("A Tale of Two Cities"))
                                                        ^
    

  107. def oneOf(firstEle: Any, secondEle: Any, remainingEles: Any*): ResultOfOneOfApplication

    This method enables the following syntax:

    This method enables the following syntax:

    List(1, 2, 3) must contain (oneOf(1, 2))
                                  ^
    

  108. def only(xs: Any*): ResultOfOnlyApplication

    This method enables the following syntax:

    This method enables the following syntax:

    List(1, 2, 3) must contain (only(1, 2))
                                  ^
    

  109. def produce[T](implicit arg0: Manifest[T]): ResultOfProduceInvocation[T]

    This method enables the following syntax:

    This method enables the following syntax:

    evaluating { "hi".charAt(-1) } must produce [StringIndexOutOfBoundsException]
                                          ^
    

  110. val readable: ReadableWord

    This field enables the following syntax:

    This field enables the following syntax:

    file should be (readable)
                    ^
    

    Definition Classes
    MatcherWords
  111. val regex: RegexWord

    This field enables the following syntax:

    This field enables the following syntax:

    "eight" must not fullyMatch regex ("""(-)?(\d+)(\.\d*)?""".r)
                                  ^
    

  112. val size: SizeWord

    This field enables the following syntax:

    This field enables the following syntax:

    set should not have size (3)
                        ^
    

    Definition Classes
    MatcherWords
  113. val sorted: SortedWord

    This field enables the following syntax:

    This field enables the following syntax:

    seq should be (sorted)
                  ^
    

    Definition Classes
    MatcherWords
  114. val startWith: StartWithWord

    This field enables syntax such as the following:

    This field enables syntax such as the following:

    string should (startWith ("Four") and include ("year"))
                   ^
    

    Definition Classes
    MatcherWords
  115. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  116. def the[T](implicit arg0: Manifest[T]): ResultOfTheTypeInvocation[T]

    This method enables the following syntax:

    This method enables the following syntax:

    the [FileNotFoundException] must be thrownBy { ... }
    ^
    

  117. def theSameElementsAs(xs: GenTraversable[_]): ResultOfTheSameElementsAsApplication

    This method enables the following syntax:

    This method enables the following syntax:

    List(1, 2, 3) must contain (theSameElementsAs(List(1, 2, 3)))
                                  ^
    

  118. def theSameElementsInOrderAs(xs: GenTraversable[_]): ResultOfTheSameElementsInOrderAsApplication

    This method enables the following syntax:

    This method enables the following syntax:

    List(1, 2, 3) must contain (theSameElementsInOrderAs(List(1, 2)))
                                  ^
    

  119. val theSameInstanceAs: TheSameInstanceAsPhrase

    This field enables the following syntax:

    This field enables the following syntax:

    oneString must not be theSameInstanceAs (anotherString)
                            ^
    

  120. def thrownBy(fun: ⇒ Any): ResultOfThrownByApplication

    This method enables the following syntax:

    This method enables the following syntax:

    a [RuntimeException] must be thrownBy {...}
                                   ^
    

  121. def toString(): String

    Definition Classes
    AnyRef → Any
  122. def trap[T](f: ⇒ T): Throwable

    Trap and return any thrown exception that would normally cause a ScalaTest test to fail, or create and return a new RuntimeException indicating no exception is thrown.

    Trap and return any thrown exception that would normally cause a ScalaTest test to fail, or create and return a new RuntimeException indicating no exception is thrown.

    This method is intended to be used in the Scala interpreter to eliminate large stack traces when trying out ScalaTest assertions and matcher expressions. It is not intended to be used in regular test code. If you want to ensure that a bit of code throws an expected exception, use intercept, not trap. Here's an example interpreter session without trap:

    scala> import org.scalatest._
    import org.scalatest._

    scala> import Matchers._ import Matchers._

    scala> val x = 12 a: Int = 12

    scala> x shouldEqual 13 org.scalatest.exceptions.TestFailedException: 12 did not equal 13 at org.scalatest.Assertions$class.newAssertionFailedException(Assertions.scala:449) at org.scalatest.Assertions$.newAssertionFailedException(Assertions.scala:1203) at org.scalatest.Assertions$AssertionsHelper.macroAssertTrue(Assertions.scala:417) at .<init>(<console>:15) at .<clinit>(<console>) at .<init>(<console>:7) at .<clinit>(<console>) at $print(<console>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:731) at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:980) at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:570) at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:601) at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:565) at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:745) at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:790) at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:702) at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:566) at scala.tools.nsc.interpreter.ILoop.innerLoop$1(ILoop.scala:573) at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:576) at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:867) at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822) at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822) at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135) at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822) at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:83) at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96) at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105) at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

    That's a pretty tall stack trace. Here's what it looks like when you use trap:

    scala> trap { x shouldEqual 13 }
    res1: Throwable = org.scalatest.exceptions.TestFailedException: 12 did not equal 13
    

    Much less clutter. Bear in mind, however, that if no exception is thrown by the passed block of code, the trap method will create a new NormalResult (a subclass of Throwable made for this purpose only) and return that. If the result was the Unit value, it will simply say that no exception was thrown:

    scala> trap { x shouldEqual 12 }
    res2: Throwable = No exception was thrown.
    

    If the passed block of code results in a value other than Unit, the NormalResult's toString will print the value:

    scala> trap { "Dude!" }
    res3: Throwable = No exception was thrown. Instead, result was: "Dude!"
    

    Although you can access the result value from the NormalResult, its type is Any and therefore not very convenient to use. It is not intended that trap be used in test code. The sole intended use case for trap is decluttering Scala interpreter sessions by eliminating stack traces when executing assertion and matcher expressions.

    Definition Classes
    Assertions
  123. def typeCheckedConstraint[A, B](implicit equivalenceOfA: Equivalence[A], ev: <:<[B, A]): Constraint[A, B]

    Provides a Constraint[A, B] for any two types A and B, enforcing the type constraint that B must be a subtype of A, given an implicit Equivalence[A].

    Provides a Constraint[A, B] for any two types A and B, enforcing the type constraint that B must be a subtype of A, given an implicit Equivalence[A].

    The returned Constraint's areEqual method uses the implicitly passed Equivalence[A]'s areEquivalent method to determine equality.

    This method is overridden and made implicit by subtraits TypeCheckedTripleEquals) and TypeCheckedLegacyTripleEquals, and overriden as non-implicit by the other subtraits in this package.

    ev

    evidence that B is a subype of A

    returns

    a Constraint[A, B] whose areEqual method delegates to the areEquivalent method of the passed Equivalence[A].

    Definition Classes
    TripleEqualsTripleEqualsSupport
  124. implicit def unconstrainedEquality[A, B](implicit equalityOfA: Equality[A]): Constraint[A, B]

    Provides a Constraint[A, B] class for any two types A and B, with no type constraint enforced, given an implicit Equality[A].

    Provides a Constraint[A, B] class for any two types A and B, with no type constraint enforced, given an implicit Equality[A].

    The returned Constraint's areEqual method uses the implicitly passed Equality[A]'s areEqual method to determine equality.

    This method is overridden and made implicit by subtraits TripleEquals and LegacyTripleEquals, and overriden as non-implicit by the other subtraits in this package.

    equalityOfA

    an Equality[A] type class to which the Constraint.areEqual method will delegate to determine equality.

    returns

    a Constraint[A, B] whose areEqual method delegates to the areEqual method of the passed Equality[A].

    Definition Classes
    TripleEqualsTripleEqualsSupport
  125. val value: ValueWord

    This field enables the following syntax:

    This field enables the following syntax:

    map must not contain value (10)
                           ^
    

  126. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  127. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  128. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  129. def withClue[T](clue: Any)(fun: ⇒ T): T

    Executes the block of code passed as the second parameter, and, if it completes abruptly with a ModifiableMessage exception, prepends the "clue" string passed as the first parameter to the beginning of the detail message of that thrown exception, then rethrows it.

    Executes the block of code passed as the second parameter, and, if it completes abruptly with a ModifiableMessage exception, prepends the "clue" string passed as the first parameter to the beginning of the detail message of that thrown exception, then rethrows it. If clue does not end in a white space character, one space will be added between it and the existing detail message (unless the detail message is not defined).

    This method allows you to add more information about what went wrong that will be reported when a test fails. Here's an example:

    withClue("(Employee's name was: " + employee.name + ")") {
      intercept[IllegalArgumentException] {
        employee.getTask(-1)
      }
    }
    

    If an invocation of intercept completed abruptly with an exception, the resulting message would be something like:

    (Employee's name was Bob Jones) Expected IllegalArgumentException to be thrown, but no exception was thrown
    

    Definition Classes
    Assertions
    Exceptions thrown
    NullPointerException

    if the passed clue is null

  130. val writable: WritableWord

    This field enables the following syntax:

    This field enables the following syntax:

    file should be (writable)
                    ^
    

    Definition Classes
    MatcherWords

Deprecated Value Members

  1. def assert(o: Option[String]): Unit

    Assert that an Option[String] is None.

    Assert that an Option[String] is None. If the condition is None, this method returns normally. Else, it throws TestFailedException with the String value of the Some included in the TestFailedException's detail message.

    This form of assert is usually called in conjunction with an implicit conversion to Equalizer, using a === comparison, as in:

    assert(a === b)
    

    For more information on how this mechanism works, see the documentation for Equalizer.

    o

    the Option[String] to assert

    Definition Classes
    Assertions
    Annotations
    @deprecated
    Deprecated

    This method has been deprecated in favor of macro assertion and will be removed in a future version of ScalaTest. If you need this, please copy the source code into your own trait instead.

    Exceptions thrown
    TestFailedException

    if the Option[String] is Some.

  2. def assert(o: Option[String], clue: Any): Unit

    Assert that an Option[String] is None.

    Assert that an Option[String] is None. If the condition is None, this method returns normally. Else, it throws TestFailedException with the String value of the Some, as well as the String obtained by invoking toString on the specified clue, included in the TestFailedException's detail message.

    This form of assert is usually called in conjunction with an implicit conversion to Equalizer, using a === comparison, as in:

    assert(a === b, "extra info reported if assertion fails")
    

    For more information on how this mechanism works, see the documentation for Equalizer.

    o

    the Option[String] to assert

    clue

    An object whose toString method returns a message to include in a failure report.

    Definition Classes
    Assertions
    Annotations
    @deprecated
    Deprecated

    This method has been deprecated in favor of macro assertion and will be removed in a future version of ScalaTest. If you need this, please copy the source code into your own trait instead.

    Exceptions thrown
    NullPointerException

    if message is null.

    TestFailedException

    if the Option[String] is Some.

  3. def assume(o: Option[String]): Unit

    Assume that an Option[String] is None.

    Assume that an Option[String] is None. If the condition is None, this method returns normally. Else, it throws TestCanceledException with the String value of the Some included in the TestCanceledException's detail message.

    This form of assume is usually called in conjunction with an implicit conversion to Equalizer, using a === comparison, as in:

    assume(a === b)
    

    For more information on how this mechanism works, see the documentation for Equalizer.

    o

    the Option[String] to assert

    Definition Classes
    Assertions
    Annotations
    @deprecated
    Deprecated

    This method has been deprecated in favor of macro assumption and will be removed in a future version of ScalaTest. If you need this, please copy the source code into your own trait instead.

    Exceptions thrown
    TestCanceledException

    if the Option[String] is Some.

  4. def assume(o: Option[String], clue: Any): Unit

    Assume that an Option[String] is None.

    Assume that an Option[String] is None. If the condition is None, this method returns normally. Else, it throws TestCanceledException with the String value of the Some, as well as the String obtained by invoking toString on the specified clue, included in the TestCanceledException's detail message.

    This form of assume is usually called in conjunction with an implicit conversion to Equalizer, using a === comparison, as in:

    assume(a === b, "extra info reported if assertion fails")
    

    For more information on how this mechanism works, see the documentation for Equalizer.

    o

    the Option[String] to assert

    clue

    An object whose toString method returns a message to include in a failure report.

    Definition Classes
    Assertions
    Annotations
    @deprecated
    Deprecated

    This method has been deprecated in favor of macro assumption and will be removed in a future version of ScalaTest. If you need this, please copy the source code into your own trait instead.

    Exceptions thrown
    NullPointerException

    if message is null.

    TestCanceledException

    if the Option[String] is Some.

  5. def expect(expected: Any)(actual: Any): Unit

    This expect method has been deprecated; Please use assertResult instead.

    This expect method has been deprecated; Please use assertResult instead.

    To get rid of the deprecation warning, simply replace expect with assertResult. The name expect will be used for a different purposes in a future version of ScalaTest.

    Definition Classes
    Assertions
    Annotations
    @deprecated
    Deprecated

    This expect method has been deprecated. Please replace all invocations of expect with an identical invocation of assertResult instead.

  6. def expect(expected: Any, clue: Any)(actual: Any): Unit

    This expect method has been deprecated; Please use assertResult instead.

    This expect method has been deprecated; Please use assertResult instead.

    To get rid of the deprecation warning, simply replace expect with assertResult. The name expect will be used for a different purposes in a future version of ScalaTest.

    Definition Classes
    Assertions
    Annotations
    @deprecated
    Deprecated

    This expect method has been deprecated. Please replace all invocations of expect with an identical invocation of assertResult instead.

  7. def expectResult(expected: Any)(actual: Any): Unit

    This expectResult method has been deprecated; Please use assertResult instead.

    This expectResult method has been deprecated; Please use assertResult instead.

    To get rid of the deprecation warning, simply replace expectResult with assertResult. The name expectResult will be used for a different purposes in a future version of ScalaTest.

    Definition Classes
    Assertions
    Annotations
    @deprecated
    Deprecated

    This expectResult method has been deprecated. Please replace all invocations of expectResult with an identical invocation of assertResult instead.

  8. def expectResult(expected: Any, clue: Any)(actual: Any): Unit

    This expectResult method has been deprecated; Please use assertResult instead.

    This expectResult method has been deprecated; Please use assertResult instead.

    To get rid of the deprecation warning, simply replace expectResult with assertResult. The name expectResult will be used for a different purposes in a future version of ScalaTest.

    Definition Classes
    Assertions
    Annotations
    @deprecated
    Deprecated

    This expectResult method has been deprecated. Please replace all invocations of expectResult with an identical invocation of assertResult instead.

Inherited from Explicitly

Inherited from MatcherWords

Inherited from MustVerb

Inherited from Tolerance

Inherited from Assertions

Inherited from TripleEquals

Inherited from TripleEqualsSupport

Inherited from AnyRef

Inherited from Any

Ungrouped