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
Canceledwith aTestCanceledExceptionset as itsexceptionfield.
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
TestCanceledExceptionset as itsexceptionfield- message
the message for the
TestCanceledExceptionset as itsexceptionfield
- Returns:
An instance of
Canceledwith aTestCanceledExceptioncreated from passed inmessageandcauseset as itsexceptionfield.
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
Canceledwithexset as itsexceptionfield ifexis aTestCanceledException, or a newly createdTestCanceledExceptionwithexset as itscauseifexis 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
}
}