Canceled

object Canceled

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
trait Product
trait Mirror
class Object
trait Matchable
class Any

Type members

Inherited types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Inherited from:
Mirror

Value members

Concrete methods

def apply()(implicit pos: Position): Canceled

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 a TestCanceledException set as its exception field.

def apply(message: String, cause: Throwable)(implicit pos: Position): Canceled

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 its exception field

message

the message for the TestCanceledException set as its exception field

Returns:

An instance of Canceled with a TestCanceledException created from passed in message and cause set as its exception field.

def apply(ex: Throwable)(implicit pos: Position): Canceled

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 with ex set as its exception field if ex is a TestCanceledException, or a newly created TestCanceledException with ex set as its cause if ex is not a TestCanceledException.

def apply(message: String)(implicit pos: Position): Canceled

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
   }
}
def here(cause: Throwable)(implicit pos: Position): Canceled

Creates a Canceled with the passed in cause.

Creates a Canceled with the passed in cause.

Value parameters:
cause

the passed in cause

Returns:

A Canceled with exception field set to a newly created TestCanceledException using the passed in cause.