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.SerializableAn optionalThrowable.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description OptionalThrowable()Constructs anOptionalThrowablecontaining noThrowable.OptionalThrowable(java.lang.Throwable exception)Constructs anOptionalThrowablecontaining aThrowable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.Throwableget()Returns theThrowablecontained in thisOptionalThrowableif defined, else throwsIllegalStateException.inthashCode()booleanisDefined()Indicates whether thisOptionalThrowableis "defined," i.e., contains aThrowable.booleanisEmpty()Indicates whether thisOptionalThrowableis "empty," i.e., contains noThrowable.java.lang.StringtoString()
-
-
-
Method Detail
-
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
public java.lang.Throwable get()
Returns theThrowablecontained in thisOptionalThrowableif defined, else throwsIllegalStateException.To avoid the
IllegalStateException, ensureisDefinedreturnstruebefore calling this method.- Returns:
- the contained
Throwable, if thisOptionalThrowableis defined - Throws:
java.lang.IllegalStateException- if thisOptionalThrowableis not defined.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-