Companion object to class Canceled
that provides, in addition to the extractor and factory method
provided by the compiler given its companion is a case class, a second factory method
that produces a Canceled
outcome given a string message.
- Companion:
- class
Type members
Value members
Concrete methods
Creates a Canceled
instance, with a TestCanceledException
set as its exception
field.
Creates a Canceled
instance, with a TestCanceledException
set as its exception
field.
- Returns:
An instance of
Canceled
with aTestCanceledException
set as itsexception
field.
Creates a Canceled
instance with the passed in message and cause.
Creates a Canceled
instance with the passed in message and cause.
- Value parameters:
- cause
the cause for the
TestCanceledException
set as itsexception
field- message
the message for the
TestCanceledException
set as itsexception
field
- Returns:
An instance of
Canceled
with aTestCanceledException
created from passed inmessage
andcause
set as itsexception
field.
Creates a Canceled
instance with the passed in Throwable
. If the passed in Throwable
is a TestCanceledException
,
it will be set as exception
field, in other case a new TestCanceledException
will be created using ex
as its cause
Creates a Canceled
instance with the passed in Throwable
. If the passed in Throwable
is a TestCanceledException
,
it will be set as exception
field, in other case a new TestCanceledException
will be created using ex
as its cause
- Value parameters:
- ex
the passed in
Throwable
- Returns:
An instance of
Canceled
withex
set as itsexception
field ifex
is aTestCanceledException
, or a newly createdTestCanceledException
withex
set as itscause
ifex
is not aTestCanceledException
.
Creates a Canceled
outcome given a string message.
Creates a Canceled
outcome given a string message.
For example, trait CancelAfterFailure
uses this factory method to create
a Canceled
status if a cancelRemaining
flag is set, which will
be the case if a test failed previously while running the suite:
abstract override def withFixture(test: NoArgTest): Outcome = { if (cancelRemaining) Canceled("Canceled by CancelOnFailure because a test failed previously") else super.withFixture(test) match { case failed: Failed => cancelRemaining = true failed case outcome => outcome } }