org.scalatest

FailureOf

object FailureOf extends FailureOf

Companion object that facilitates the importing of FailureOf's method as an alternative to mixing it in. One use case is to import FailureOf's method so you can use it in the Scala interpreter:

$scala -classpath scalatest.jar
Welcome to Scala version 2.8.0.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_22).
Type in expressions to have them evaluated.
Type :help for more information.
 
scala> import org.scalatest.Assertions._
import org.scalatest.Assertions._
 
scala> import org.scalatest.FailureOf._
import org.scalatest.FailureOf._
 
scala> failureOf { assert(1 + 1 === 2) }
res0: Option[Throwable] = None
 
scala> failureOf { assert(1 + 1 === 3) }
res1: Option[Throwable] = Some(org.scalatest.TestFailedException: 2 did not equal 3)

@author Bill Venners

Linear Supertypes
FailureOf, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. FailureOf
  2. FailureOf
  3. AnyRef
  4. Any
Visibility
  1. Public
  2. All

Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  7. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  8. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  9. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def failureOf (f: ⇒ Unit): Option[Throwable]

    Executes the supplied code (a by-name parameter) and returns in an optional throwable indicating whether the passed expression failed (threw an exception that would normally cause a test to fail) or succeeded (did not throw any exception).

    Executes the supplied code (a by-name parameter) and returns in an optional throwable indicating whether the passed expression failed (threw an exception that would normally cause a test to fail) or succeeded (did not throw any exception).

    Because Errors are used to denote serious errors, trait Suite and its subtypes in the ScalaTest API do not always treat a test that completes abruptly with an Error as a test failure, but sometimes as an indication that serious problems have arisen that should cause the run to abort. For example, if a test completes abruptly with an OutOfMemoryError, it will not be reported as a test failure, but will instead cause the run to abort. Because not everyone uses Errors only to represent serious problems, however, ScalaTest only behaves this way for the following exception types (and their subclasses):

    • java.lang.annotation.AnnotationFormatError
    • java.awt.AWTError
    • java.nio.charset.CoderMalfunctionError
    • javax.xml.parsers.FactoryConfigurationError
    • java.lang.LinkageError
    • java.lang.ThreadDeath
    • javax.xml.transform.TransformerFactoryConfigurationError
    • java.lang.VirtualMachineError

    The previous list includes all Errors that exist as part of Java 1.5 API, excluding java.lang.AssertionError. ScalaTest does treat a thrown AssertionError as an indication of a test failure. In addition, any other Error that is not an instance of a type mentioned in the previous list will be caught by the Suite traits in the ScalaTest API and reported as the cause of a test failure.

    If the code supplied to failureOf completes abruptly in one of the errors in the previous list, failureOf will not return it wrapped in an option, but rather will complete abruptly with the same exception. The failureOf method will wrap any other exception thrown by the supplied code in a Some and return it.

    Definition Classes
    FailureOf
  11. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  12. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef
  13. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  14. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  15. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  16. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  17. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  18. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  19. def toString (): String

    Definition Classes
    AnyRef → Any
  20. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  21. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  22. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from FailureOf

Inherited from AnyRef

Inherited from Any