This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
Class used via an implicit conversion to enable any two objects to be compared with===
in assertions in tests.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This class supports the syntax of FlatSpec
, WordSpec
, FixtureFlatSpec
,
and FixtureWordSpec
.
This class is part of the ScalaTest matchers DSL.
This class is part of the ScalaTest matchers DSL.
This method enables the following syntax:
This method enables the following syntax:
This method enables the following syntax:
This method enables the following syntax:
This method enables the following syntax:
This field enables the following syntax:
This field enables the following syntax:
Assert that an Option[String]
is None
.
Assert that an Option[String]
is None
.
Assert that a boolean condition, described in String
message
, is true.
Assert that a boolean condition is true.
This method enables syntax such as the following:
This method enables syntax such as the following:
Implicitly converts an object of type Byte
to a BytePlusOrMinusWrapper
,
to enable a plusOrMinus
method to be invokable on that object.
Implicitly converts an object of type Double
to a DoublePlusOrMinusWrapper
,
to enable a plusOrMinus
method to be invokable on that object.
Implicitly converts an object of type Float
to a FloatPlusOrMinusWrapper
,
to enable a plusOrMinus
method to be invokable on that object.
This implicit conversion method converts an object with a getLength
field of type Int
to aLengthWrapper
, to enable that object to be used with the have length (7)
syntax.
This implicit conversion method converts an object with a getLength
field of type Long
to aLengthWrapper
, to enable that object to be used with the have length (7)
syntax.
This implicit conversion method converts an object with a getLength
method of type Int
to aLengthWrapper
, to enable that object to be used with the have length (7)
syntax.
This implicit conversion method converts an object with a getLength
method of type Long
to aLengthWrapper
, to enable that object to be used with the have length (7)
syntax.
This implicit conversion method converts an object with a getSize
field of type Int
to aLengthWrapper
, to enable that object to be used with the have size (7)
syntax.
This implicit conversion method converts an object with a getSize
field of type Long
to aLengthWrapper
, to enable that object to be used with the have size (7)
syntax.
This implicit conversion method converts an object with a getSize
method of type Int
to aLengthWrapper
, to enable that object to be used with the have size (7)
syntax.
This implicit conversion method converts an object with a getSize
method of type Long
to aLengthWrapper
, to enable that object to be used with the have size (7)
syntax.
Implicitly converts an AnyRef
of type T
whose structure includes
a getLength
val
of type Int
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a getLength
method that results in Int
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a getSize
val
of type Int
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a getSize
method that results in Int
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a length
val
of type Int
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a length
method that results in Int
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a size
val
of type Int
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a size
method that results in Int
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a getLength
val
of type Long
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a getLength
method that results in Long
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a getSize
val
of type Long
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a getSize
method that results in Long
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a length
val
of type Long
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a length
method that results in Long
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a size
val
type Long
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an AnyRef
of type T
whose structure includes
a size
method that results in Long
to a SizeMustWrapper[T]
, to enable must
methods to be invokable on that object.
Implicitly converts an object of type Int
to a IntPlusOrMinusWrapper
,
to enable a plusOrMinus
method to be invokable on that object.
This implicit conversion method enables the following syntax (javaColl
is a java.
implicit def
convertLengthFieldToIntLengthWrapper(o: AnyRef {...}): LengthWrapper
This implicit conversion method converts an object with a length
field of type Int
to aLengthWrapper
, to enable that object to be used with the have length (7)
syntax.
implicit def
convertLengthFieldToLongLengthWrapper(o: AnyRef {...}): LengthWrapper
This implicit conversion method converts an object with a length
field of type Long
to aLengthWrapper
, to enable that object to be used with the have length (7)
syntax.
implicit def
convertLengthMethodToIntLengthWrapper(o: AnyRef {...}): LengthWrapper
This implicit conversion method converts an object with a length
method of type Int
to aLengthWrapper
, to enable that object to be used with the have length (7)
syntax.
implicit def
convertLengthMethodToLongLengthWrapper(o: AnyRef {...}): LengthWrapper
This implicit conversion method converts an object with a length
method of type Long
to aLengthWrapper
, to enable that object to be used with the have length (7)
syntax.
implicit def
convertLongToPlusOrMinusWrapper(right: Long): LongPlusOrMinusWrapper
Implicitly converts an object of type Long
to a LongPlusOrMinusWrapper
,
to enable a plusOrMinus
method to be invokable on that object.
implicit def
convertMapMatcherToJavaMapMatcher[K, V](mapMatcher: Matcher[Map[K, V]]): Matcher[Map[K, V]]
This implicit conversion method enables the following syntax (javaMap
is a java.
implicit def
convertShortToPlusOrMinusWrapper(right: Short): ShortPlusOrMinusWrapper
Implicitly converts an object of type Short
to a ShortPlusOrMinusWrapper
,
to enable a plusOrMinus
method to be invokable on that object.
implicit def
convertSizeFieldToIntSizeWrapper(o: AnyRef {...}): SizeWrapper
This implicit conversion method converts an object with a size
field of type Int
to aLengthWrapper
, to enable that object to be used with the have size (7)
syntax.
implicit def
convertSizeFieldToLongSizeWrapper(o: AnyRef {...}): SizeWrapper
This implicit conversion method converts an object with a size
field of type Long
to aLengthWrapper
, to enable that object to be used with the have size (7)
syntax.
implicit def
convertSizeMethodToIntSizeWrapper(o: AnyRef {...}): SizeWrapper
This implicit conversion method converts an object with a size
method of type Int
to aLengthWrapper
, to enable that object to be used with the have size (7)
syntax.
implicit def
convertSizeMethodToLongSizeWrapper(o: AnyRef {...}): SizeWrapper
This implicit conversion method converts an object with a size
method of type Long
to aLengthWrapper
, to enable that object to be used with the have size (7)
syntax.
implicit def
convertSymbolToHavePropertyMatcherGenerator(symbol: Symbol): HavePropertyMatcherGenerator
This implicit conversion method converts a Symbol
to aHavePropertyMatcherGenerator
, to enable the symbol to be used with the have ('author ("Dickens"))
syntax.
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.
implicit def
convertToAnyRefMustWrapper[T <: AnyRef](o: T): AnyRefMustWrapper[T]
Implicitly converts a scala.
implicit def
convertToArrayMustWrapper[T](o: Array[T]): ArrayMustWrapper[T]
Implicitly converts an object of type scala.
implicit def
convertToByteMustWrapper(o: Byte): ByteMustWrapper
Implicitly converts an object of type scala.
implicit def
convertToCollectionMustWrapper[T](o: Iterable[T]): CollectionMustWrapper[T]
Implicitly converts an object of type scala.
implicit def
convertToDoubleMustWrapper(o: Double): DoubleMustWrapper
Implicitly converts an object of type scala.
implicit def
convertToEqualizer(left: Any): Equalizer
Implicit conversion from Any
to Equalizer
, used to enable
assertions with ===
comparisons.
Implicitly converts an object of type T
to a EvaluatingApplicationMustWrapper[T]
,
to enable must
methods to be invokable on that object.
Implicitly converts an object of type scala.
implicit def
convertToIntMustWrapper(o: Int): IntMustWrapper
Implicitly converts an object of type scala.
implicit def
convertToJavaCollectionMustWrapper[T](o: Collection[T]): JavaCollectionMustWrapper[T]
Implicitly converts an object of type java.
implicit def
convertToJavaListMustWrapper[T](o: List[T]): JavaListMustWrapper[T]
Implicitly converts an object of type java.
implicit def
convertToJavaMapMustWrapper[K, V](o: Map[K, V]): JavaMapMustWrapper[K, V]
Implicitly converts an object of type java.
implicit def
convertToListMustWrapper[T](o: List[T]): ListMustWrapper[T]
Implicitly converts an object of type scala.
implicit def
convertToLongMustWrapper(o: Long): LongMustWrapper
Implicitly converts an object of type scala.
implicit def
convertToMapMustWrapper[K, V](o: Map[K, V]): MapMustWrapper[K, V]
Implicitly converts an object of type scala.
implicit def
convertToMatcherWrapper[T](leftMatcher: Matcher[T]): MatcherWrapper[T]
This implicit conversion method enables ScalaTest matchers expressions that involve and
and or
.
implicit def
convertToSeqMustWrapper[T](o: Seq[T]): SeqMustWrapper[T]
Implicitly converts an object of type scala.
implicit def
convertToShortMustWrapper(o: Short): ShortMustWrapper
Implicitly converts an object of type scala.
implicit def
convertToStringMustWrapper(o: String): StringMustWrapper
Implicitly converts an object of type java.
val
endWith: EndWithWord
This method enables syntax such as the following:
def
equal(right: Any): Matcher[Any]
This method enables the following syntax:
def
evaluating(fun: ⇒ Any): ResultOfEvaluatingApplication
This method enables syntax such as the following:
def
expect(expected: Any)(actual: Any): Unit
Expect that the value passed as expected
equals the value passed as actual
.
def
expect(expected: Any, clue: Any)(actual: Any): Unit
Expect that the value passed as expected
equals the value passed as actual
.
def
fail(cause: Throwable): Nothing
Throws TestFailedException
, with the passedThrowable
cause, to indicate a test failed.
def
fail(message: String, cause: Throwable): Nothing
Throws TestFailedException
, with the passedString
message
as the exception's detail
message and Throwable
cause, to indicate a test failed.
def
fail(message: String): Nothing
Throws TestFailedException
, with the passedString
message
as the exception's detail
message, to indicate a test failed.
def
fail(): Nothing
Throws TestFailedException
to indicate a test failed.
val
fullyMatch: FullyMatchWord
This method enables syntax such as the following:
val
have: HaveWord
This method enables syntax such as the following:
val
include: IncludeWord
This method enables syntax such as the following:
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.
val
key: KeyWord
This field enables the following syntax:
val
length: LengthWord
This field enables the following syntax:
val
not: NotWord
This field enables syntax like the following:
def
produce[T](implicit manifest: Manifest[T]): ResultOfProduceInvocation[T]
This method enables the following syntax:
val
regex: RegexWord
This field enables the following syntax:
val
size: SizeWord
This field enables the following syntax:
val
startWith: StartWithWord
This method enables syntax such as the following:
val
theSameInstanceAs: TheSameInstanceAsPhrase
This field enables the following syntax:
val
value: ValueWord
This field enables the following syntax:
def
withClue(clue: Any)(fun: ⇒ Unit): Unit
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.
Trait that makes ScalaTest's
MustMatchers
DSL syntax available for use with JUnit.The assertion methods provided in this trait look and behave exactly like the ones in
MustMatchers
, except instead of throwingTestFailedException
they throwJUnitTestFailedError
, which extendsjunit.framework.AssertionFailedError
.JUnit 3 (release 3.8 and earlier) distinguishes between failures and errors. If a test fails because of a failed assertion, that is considered a failure. If a test fails for any other reason, either the test code or the application being tested threw an unexpected exception, that is considered an error. The way JUnit 3 decides whether an exception represents a failure or error is that only thrown
junit.framework.AssertionFailedError
s are considered failures. Any other exception type is considered an error. The exception type thrown by the JUnit 3 assertion methods declared injunit.framework.Assert
(such asassertEquals
,assertTrue
, andfail
) is, therefore,AssertionFailedError
.In JUnit 4,
AssertionFailedError
was made to extendjava.lang.AssertionError
, and the distinction between failures and errors was essentially dropped. However, some tools that integrate with JUnit carry on this distinction, so even if you are using JUnit 4 you may want to use thisMustMatchersForJUnit
trait instead of plain-old ScalaTestMustMatchers
.To use this trait in a JUnit 3
TestCase
, you can mix it into yourTestCase
class, like this:You can alternatively import the methods defined in this trait.
For details on the importing approach, see the documentation for the
MustMatchersForJUnit
companion object. For the details on theMustMatchersForJUnit
syntax, see the Scaladoc documentation fororg.scalatest.matchers.MustMatchers
authors:
Bill Venners