public static <T> Callable<T> recover(Callable<T> callable,
        Function<Throwable, T> exceptionHandler) {
        return () -> {
            try {
                return callable.call();
            } catch (Exception exception) {
                return exceptionHandler.apply(exception);
            }
        };
    }
@Test
    public void shouldRecoverCallableFromSpecificExceptions() throws Exception {
        Callable<String> callable = () -> {
            throw new IOException("BAM!");
        };

        Callable<String> callableWithRecovery = CallableUtils.recover(callable,
            asList(IllegalArgumentException.class, IOException.class),
            (ex) -> "Bla");

        String result = callableWithRecovery.call();

        assertThat(result).isEqualTo("Bla");
    }