class SuccessOrFailure[T] extends AnyRef
Wrapper class that adds success
and failure
methods to scala.util.Try
, allowing
you to make statements like:
try1.success.value should be > 9 try2.failure.exception should have message "/ by zero"
- Source
- TryValues.scala
- Alphabetic
- By Inheritance
- SuccessOrFailure
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
SuccessOrFailure(theTry: Try[T], pos: Position)
- theTry
An
Try
to convert toSuccessOrFailure
, which provides thesuccess
andfailure
methods.
Value Members
-
def
failure: Failure[T]
Returns the
Try
passed to the constructor as aFailure
, if it is aFailure
, else throwsTestFailedException
with a detail message indicating theTry
was not aFailure
.Returns the
Try
passed to the constructor as aFailure
, if it is aFailure
, else throwsTestFailedException
with a detail message indicating theTry
was not aFailure
. -
def
success: Success[T]
Returns the
Try
passed to the constructor as aSuccess
, if it is aSuccess
, else throwsTestFailedException
with a detail message indicating theTry
was not aSuccess
.Returns the
Try
passed to the constructor as aSuccess
, if it is aSuccess
, else throwsTestFailedException
with a detail message indicating theTry
was not aSuccess
.