@Test public void singleAttemptCallbackThrowsCleanupExceptionOnCleanupFailure() { callback = LambdaCallback.singleAttempt(this::markInitAndFail, this::markCleanupAndFail); assertThatThrownBy(() -> callback.runWithRetry(initsAndCleanups)).isEqualToComparingFieldByField(CLEANUP_FAIL); }
public static <R> Callback<R> singleAttempt(Consumer<R> initialize, BiConsumer<R, Throwable> onInitFailureCleanup) { return new LambdaCallback<>(initialize, onInitFailureCleanup.andThen(FAIL)); }
LambdaCallback extends Callback<R> { public static <R> Callback<R> singleAttempt(Consumer<R> initialize, BiConsumer<R, Throwable> onInitFailureCleanup) { return new LambdaCallback<>(initialize, onInitFailureCleanup.andThen(FAIL)); } }
LambdaCallback extends Callback<R> { public static <R> Callback<R> singleAttempt(Consumer<R> initialize, BiConsumer<R, Throwable> onInitFailureCleanup) { return new LambdaCallback<>(initialize, onInitFailureCleanup.andThen(FAIL)); } private  LambdaCallback(Consumer<R> initialize, BiConsumer<R, Throwable> onInitializationFailure); }
LambdaCallback extends Callback<R> { public static <R> Callback<R> singleAttempt(Consumer<R> initialize, BiConsumer<R, Throwable> onInitFailureCleanup) { return new LambdaCallback<>(initialize, onInitFailureCleanup.andThen(FAIL)); } private  LambdaCallback(Consumer<R> initialize, BiConsumer<R, Throwable> onInitializationFailure); static Callback<R> singleAttempt(Consumer<R> initialize, BiConsumer<R, Throwable> onInitFailureCleanup); static Callback<R> retrying(Consumer<R> initialize, BiConsumer<R, Throwable> onInitFailureCleanup); static Callback<R> of(Consumer<R> initialize); @Override void init(R resource); @Override void cleanup(R resource, Throwable initFailure); }
LambdaCallback extends Callback<R> { public static <R> Callback<R> singleAttempt(Consumer<R> initialize, BiConsumer<R, Throwable> onInitFailureCleanup) { return new LambdaCallback<>(initialize, onInitFailureCleanup.andThen(FAIL)); } private  LambdaCallback(Consumer<R> initialize, BiConsumer<R, Throwable> onInitializationFailure); static Callback<R> singleAttempt(Consumer<R> initialize, BiConsumer<R, Throwable> onInitFailureCleanup); static Callback<R> retrying(Consumer<R> initialize, BiConsumer<R, Throwable> onInitFailureCleanup); static Callback<R> of(Consumer<R> initialize); @Override void init(R resource); @Override void cleanup(R resource, Throwable initFailure);  }