Class OptionalThrowable
java.lang.Object
sbt.testing.OptionalThrowable
- All Implemented Interfaces:
Serializable
An optional
Throwable.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs anOptionalThrowablecontaining noThrowable.OptionalThrowable(Throwable exception) Constructs anOptionalThrowablecontaining aThrowable. -
Method Summary
Modifier and TypeMethodDescriptionbooleanget()Returns theThrowablecontained in thisOptionalThrowableif defined, else throwsIllegalStateException.inthashCode()booleanIndicates whether thisOptionalThrowableis "defined," i.e., contains aThrowable.booleanisEmpty()Indicates whether thisOptionalThrowableis "empty," i.e., contains noThrowable.toString()
-
Constructor Details
-
OptionalThrowable
Constructs anOptionalThrowablecontaining aThrowable. -
OptionalThrowable
public OptionalThrowable()Constructs anOptionalThrowablecontaining noThrowable.
-
-
Method Details
-
isDefined
public boolean isDefined()Indicates whether thisOptionalThrowableis "defined," i.e., contains aThrowable.- Returns:
- true if this
OptionalThrowablecontains aThrowable
-
isEmpty
public boolean isEmpty()Indicates whether thisOptionalThrowableis "empty," i.e., contains noThrowable.- Returns:
- true if this
OptionalThrowablecontains noThrowable
-
get
Returns theThrowablecontained in thisOptionalThrowableif defined, else throwsIllegalStateException.To avoid the
IllegalStateException, ensureisDefinedreturnstruebefore calling this method.- Returns:
- the contained
Throwable, if thisOptionalThrowableis defined - Throws:
IllegalStateException- if thisOptionalThrowableis not defined.
-
equals
-
hashCode
-
toString
-