Package sbt.testing
Class OptionalThrowable
- java.lang.Object
-
- sbt.testing.OptionalThrowable
-
- All Implemented Interfaces:
java.io.Serializable
public final class OptionalThrowable extends java.lang.Object implements java.io.Serializable
An optionalThrowable
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description OptionalThrowable()
Constructs anOptionalThrowable
containing noThrowable
.OptionalThrowable(java.lang.Throwable exception)
Constructs anOptionalThrowable
containing aThrowable
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.Throwable
get()
Returns theThrowable
contained in thisOptionalThrowable
if defined, else throwsIllegalStateException
.int
hashCode()
boolean
isDefined()
Indicates whether thisOptionalThrowable
is "defined," i.e., contains aThrowable
.boolean
isEmpty()
Indicates whether thisOptionalThrowable
is "empty," i.e., contains noThrowable
.java.lang.String
toString()
-
-
-
Method Detail
-
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
public java.lang.Throwable 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:
java.lang.IllegalStateException
- if thisOptionalThrowable
is not defined.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-