Exceptional

sealed abstract class Exceptional(ex: Throwable) extends Outcome

Superclass for the two outcomes of running a test that contain an exception: Failed and Canceled.

This class provides a toOption method that returns a Some wrapping the contained exception, and an isExceptional field with the value true. It's companion object provides an extractor that enables patterns that match a test that either failed or canceled, as in:

outcome match {
 case Exceptional(ex) => // handle failed or canceled case
 case _ => // handle succeeded, pending, or omitted case
}
Value parameters:
ex

the Throwable contained in this Exceptional.

Companion:
object
class Outcome
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
class Canceled
class Failed

Value members

Concrete methods

override def toOption: Option[Throwable]

Converts this Exceptional to a Some that wraps the contained exception.

Converts this Exceptional to a Some that wraps the contained exception.

Returns:

A Some wrapping the exception contained in this Exceptional.

Definition Classes

Inherited methods

def canEqual(that: Any): Boolean
Inherited from:
Equals
def productArity: Int
Inherited from:
Product
def productElement(n: Int): Any
Inherited from:
Product
def productElementName(n: Int): String
Inherited from:
Product
def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product
def productPrefix: String
Inherited from:
Product

Converts this Outcome to a Succeeded.

Converts this Outcome to a Succeeded.

When this Outcome instance is not Succeeded, it behaves as followed:

  • Failed(ex) - throws ex

  • Canceled(tce) - throws tce

  • Pending - throws TestPendingException

Returns:

Succeeded if this Outcome instance is a Succeeded.

Inherited from:
Outcome

Concrete fields

override val isExceptional: Boolean

Indicates that this Outcome represents a test that either failed or was canceled.

Indicates that this Outcome represents a test that either failed or was canceled.

Returns:

true

Inherited fields

val isCanceled: Boolean

Indicates whether this Outcome represents a test that was canceled.

Indicates whether this Outcome represents a test that was canceled.

This class's implementation of this method always returns false.

Returns:

true if this Outcome is an instance of Canceled.

Inherited from:
Outcome
val isFailed: Boolean

Indicates whether this Outcome represents a test that failed.

Indicates whether this Outcome represents a test that failed.

This class's implementation of this method always returns false.

Returns:

true if this Outcome is an instance of Failed.

Inherited from:
Outcome
val isPending: Boolean

Indicates whether this Outcome represents a test that was pending.

Indicates whether this Outcome represents a test that was pending.

This class's implementation of this method always returns false.

Returns:

true if this Outcome is an instance of Pending.

Inherited from:
Outcome
val isSucceeded: Boolean

Indicates whether this Outcome represents a test that succeeded.

Indicates whether this Outcome represents a test that succeeded.

This class's implementation of this method always returns false.

Returns:

true if this Outcome is an instance of Succeeded.

Inherited from:
Outcome