@Test public void shouldChainCallableAndRecoverWithErrorHandler() throws Exception { Callable<String> callable = () -> { throw new IOException("BAM!"); }; Callable<String> callableWithRecovery = CallableUtils .andThen(callable, (result) -> result, ex -> "Bla"); String result = callableWithRecovery.call(); assertThat(result).isEqualTo("Bla"); }
public static <T, R> Callable<R> andThen(Callable<T> callable, Function<T, R> resultHandler) { return () -> resultHandler.apply(callable.call()); }
CallableUtils { public static <T, R> Callable<R> andThen(Callable<T> callable, Function<T, R> resultHandler) { return () -> resultHandler.apply(callable.call()); } }
CallableUtils { public static <T, R> Callable<R> andThen(Callable<T> callable, Function<T, R> resultHandler) { return () -> resultHandler.apply(callable.call()); } private  CallableUtils(); }
CallableUtils { public static <T, R> Callable<R> andThen(Callable<T> callable, Function<T, R> resultHandler) { return () -> resultHandler.apply(callable.call()); } private  CallableUtils(); static Callable<R> andThen(Callable<T> callable, Function<T, R> resultHandler); static Callable<R> andThen(Callable<T> callable,
        BiFunction<T, Throwable, R> handler); static Callable<R> andThen(Callable<T> callable, Function<T, R> resultHandler,
        Function<Throwable, R> exceptionHandler); static Callable<T> recover(Callable<T> callable,
        Function<Throwable, T> exceptionHandler); static Callable<T> recover(Callable<T> callable,
        Predicate<T> resultPredicate, UnaryOperator<T> resultHandler); static Callable<T> recover(Callable<T> callable,
        List<Class<? extends Throwable>> exceptionTypes,
        Function<Throwable, T> exceptionHandler); static Callable<T> recover(Callable<T> callable,
        Class<X> exceptionType,
        Function<Throwable, T> exceptionHandler); }
CallableUtils { public static <T, R> Callable<R> andThen(Callable<T> callable, Function<T, R> resultHandler) { return () -> resultHandler.apply(callable.call()); } private  CallableUtils(); static Callable<R> andThen(Callable<T> callable, Function<T, R> resultHandler); static Callable<R> andThen(Callable<T> callable,
        BiFunction<T, Throwable, R> handler); static Callable<R> andThen(Callable<T> callable, Function<T, R> resultHandler,
        Function<Throwable, R> exceptionHandler); static Callable<T> recover(Callable<T> callable,
        Function<Throwable, T> exceptionHandler); static Callable<T> recover(Callable<T> callable,
        Predicate<T> resultPredicate, UnaryOperator<T> resultHandler); static Callable<T> recover(Callable<T> callable,
        List<Class<? extends Throwable>> exceptionTypes,
        Function<Throwable, T> exceptionHandler); static Callable<T> recover(Callable<T> callable,
        Class<X> exceptionType,
        Function<Throwable, T> exceptionHandler);  }