java.lang.Object
org.junit.platform.commons.function.Try<V>
org.junit.platform.commons.function.Try.Success<V>
-
Nested Class Summary
Nested classes/interfaces inherited from class org.junit.platform.commons.function.Try
Try.Transformer<S,T> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<U> Try<U> If thisTryis a success, apply the supplied function to its value and return the resultingTry; if thisTryis a failure, do nothing.<U> Try<U> andThenTry(Try.Transformer<V, U> transformer) If thisTryis a success, apply the supplied transformer to its value and return a new successful or failedTrydepending on the transformer's outcome; if thisTryis a failure, do nothing.booleanget()If thisTryis a success, get the contained value; if thisTryis a failure, throw the contained exception.getOrThrow(Function<? super Exception, E> exceptionTransformer) inthashCode()If thisTryis a failure, call the suppliedConsumerwith the contained exception; otherwise, do nothing.If thisTryis a success, call the suppliedConsumerwith the contained value; otherwise, do nothing.If thisTryis a failure, call the supplied supplier and return the resultingTry; if thisTryis a success, do nothing.If thisTryis a failure, call the supplied action and return a new successful or failedTrydepending on the action's outcome; if thisTryis a success, do nothing.If thisTryis a failure, return an emptyOptional; if thisTryis a success, wrap the contained value usingOptional.ofNullable(Object).
-
Field Details
-
value
-
-
Constructor Details
-
Success
Success(V value)
-
-
Method Details
-
andThenTry
Description copied from class:TryIf thisTryis a success, apply the supplied transformer to its value and return a new successful or failedTrydepending on the transformer's outcome; if thisTryis a failure, do nothing.- Specified by:
andThenTryin classTry<V>- Parameters:
transformer- the transformer to try; must not benull- Returns:
- a succeeded or failed
Try; nevernull
-
andThen
Description copied from class:TryIf thisTryis a success, apply the supplied function to its value and return the resultingTry; if thisTryis a failure, do nothing. -
orElseTry
Description copied from class:TryIf thisTryis a failure, call the supplied action and return a new successful or failedTrydepending on the action's outcome; if thisTryis a success, do nothing. -
orElse
Description copied from class:TryIf thisTryis a failure, call the supplied supplier and return the resultingTry; if thisTryis a success, do nothing. -
get
Description copied from class:TryIf thisTryis a success, get the contained value; if thisTryis a failure, throw the contained exception. -
getOrThrow
Description copied from class:TryIf thisTryis a success, get the contained value; if thisTryis a failure, call the suppliedFunctionwith the contained exception and throw the resultingException.- Specified by:
getOrThrowin classTry<V>- Parameters:
exceptionTransformer- the transformer to be called with the contained exception, if available; must not benull- Returns:
- the contained value, if available
-
ifSuccess
Description copied from class:TryIf thisTryis a success, call the suppliedConsumerwith the contained value; otherwise, do nothing. -
ifFailure
Description copied from class:TryIf thisTryis a failure, call the suppliedConsumerwith the contained exception; otherwise, do nothing. -
toOptional
Description copied from class:TryIf thisTryis a failure, return an emptyOptional; if thisTryis a success, wrap the contained value usingOptional.ofNullable(Object).- Specified by:
toOptionalin classTry<V>- Returns:
- an
Optional; nevernullbut potentially empty
-
equals
-
hashCode
public int hashCode()
-