sdk-common / com.tomtom.online.sdk.common.functional / Predicates / failWith

failWith

static fun <T : Any!, C : RuntimeException!> failWith(@NonNull exception: C): Predicate<T>!

Returns a predicate that will fail with a given RuntimeException. This method is useful for testing other code that is using predicates and how it handles exceptional situations.

Parameters

exception - C: instance of exception that should be thrown by the created Predicate.

- type of the resulting Predicate.

- type of the RuntimeException.

Return
Predicate<T>!: instance of Predicate.

static fun <T : Any!, C : RuntimeException!> failWith(@NonNull exception: Class<C>): Predicate<T>!

Returns a predicate that will fail with a given RuntimeException. This method is useful for testing other code that is using predicates and how it handles exceptional situations.

Parameters

exception - Class<C>: class of exception that should be thrown by the created Predicate.

- type of the resulting Predicate.

- type of the RuntimeException.

Return
Predicate<T>!: instance of Predicate.