Package sbt.testing
Class OptionalThrowable
java.lang.Object
sbt.testing.OptionalThrowable
- All Implemented Interfaces:
Serializable
An optional
Throwable
.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs anOptionalThrowable
containing noThrowable
.OptionalThrowable
(Throwable exception) Constructs anOptionalThrowable
containing aThrowable
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
get()
Returns theThrowable
contained in thisOptionalThrowable
if defined, else throwsIllegalStateException
.int
hashCode()
boolean
Indicates whether thisOptionalThrowable
is "defined," i.e., contains aThrowable
.boolean
isEmpty()
Indicates whether thisOptionalThrowable
is "empty," i.e., contains noThrowable
.toString()
-
Constructor Details
-
OptionalThrowable
Constructs anOptionalThrowable
containing aThrowable
. -
OptionalThrowable
public OptionalThrowable()Constructs anOptionalThrowable
containing noThrowable
.
-
-
Method Details
-
isDefined
public boolean isDefined()Indicates whether thisOptionalThrowable
is "defined," i.e., contains aThrowable
.- Returns:
- true if this
OptionalThrowable
contains aThrowable
-
isEmpty
public boolean isEmpty()Indicates whether thisOptionalThrowable
is "empty," i.e., contains noThrowable
.- Returns:
- true if this
OptionalThrowable
contains noThrowable
-
get
Returns theThrowable
contained in thisOptionalThrowable
if defined, else throwsIllegalStateException
.To avoid the
IllegalStateException
, ensureisDefined
returnstrue
before calling this method.- Returns:
- the contained
Throwable
, if thisOptionalThrowable
is defined - Throws:
IllegalStateException
- if thisOptionalThrowable
is not defined.
-
equals
-
hashCode
public int hashCode() -
toString
-