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 and a
diagram showing expression values.
If multi-line Boolean
is passed in, it will fallback to the macro implementation of Assertions
that does not contain diagram.
the boolean condition to assert
An objects whose toString
method returns a message to include in a failure report.
NullArgumentException
if message
is null
.
TestFailedException
if the condition is false
.
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 that includes a diagram showing expression values.
If multi-line Boolean
is passed in, it will fallback to the macro implementation of Assertions
that does not contain diagram.
the boolean condition to assert
TestFailedException
if the condition is false
.
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 and a
diagram showing expression values.
If multi-line Boolean
is passed in, it will fallback to the macro implementation of Assertions
that does not contain diagram.
the boolean condition to assume
An objects whose toString
method returns a message to include in a failure report.
NullArgumentException
if message
is null
.
TestCanceledException
if the condition is false
.
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 that includes a diagram showing expression values.
If multi-line Boolean
is passed in, it will fallback to the macro implementation of Assertions
that does not contain diagram.
the boolean condition to assume
TestCanceledException
if the condition is false
.
(Since version 3.1.0) The conversionCheckedConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
(Since version 3.1.0) The convertEquivalenceToAToBConversionConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
(Since version 3.1.0) The convertEquivalenceToBToAConversionConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
(Since version 3.1.0) The lowPriorityConversionCheckedConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
Sub-trait of
Assertions
that overridesassert
andassume
methods to include a diagram showing the values of expression in the error message when the assertion or assumption fails.Here are some examples:
If the expression passed to
assert
orassume
spans more than one line,Diagrams
falls back to the default style of error message, since drawing a diagram would be difficult. Here's an example showing howDiagrams
will treat a multi-line assertion (i.e., you don't get a diagram):Also, since an expression diagram essentially represents multi-line ascii art, if a clue string is provided, it appears above the diagram, not after it. It will often also show up in the diagram:
Trait
Diagrams
was inspired by Peter Niederwieser's work in Spock and Expecty.