@Test public void testDoUntilSuccessTransparentException() throws Exception { ExceptionalSupplier<Boolean, RuntimeException> task = createMock(new Clazz<ExceptionalSupplier<Boolean, RuntimeException>>() { }); IllegalArgumentException thrown = new IllegalArgumentException(); expect(task.get()).andThrow(thrown); control.replay(); try { backoffHelper.doUntilSuccess(task); fail("Expected exception to be bubbled"); } catch (IllegalArgumentException e) { assertSame(thrown, e); } control.verify(); }
public <E extends Exception> void doUntilSuccess(final ExceptionalSupplier<Boolean, E> task) throws InterruptedException, BackoffStoppedException, E { doUntilResult(() -> { Boolean result = task.get(); return Boolean.TRUE.equals(result) ? result : null; }); }
BackoffHelper { public <E extends Exception> void doUntilSuccess(final ExceptionalSupplier<Boolean, E> task) throws InterruptedException, BackoffStoppedException, E { doUntilResult(() -> { Boolean result = task.get(); return Boolean.TRUE.equals(result) ? result : null; }); } }
BackoffHelper { public <E extends Exception> void doUntilSuccess(final ExceptionalSupplier<Boolean, E> task) throws InterruptedException, BackoffStoppedException, E { doUntilResult(() -> { Boolean result = task.get(); return Boolean.TRUE.equals(result) ? result : null; }); } BackoffHelper();  BackoffHelper(Amount<Long, Time> initialBackoff, Amount<Long, Time> maxBackoff);  BackoffHelper(BackoffStrategy backoffStrategy); @VisibleForTesting  BackoffHelper(Clock clock, BackoffStrategy backoffStrategy); }
BackoffHelper { public <E extends Exception> void doUntilSuccess(final ExceptionalSupplier<Boolean, E> task) throws InterruptedException, BackoffStoppedException, E { doUntilResult(() -> { Boolean result = task.get(); return Boolean.TRUE.equals(result) ? result : null; }); } BackoffHelper();  BackoffHelper(Amount<Long, Time> initialBackoff, Amount<Long, Time> maxBackoff);  BackoffHelper(BackoffStrategy backoffStrategy); @VisibleForTesting  BackoffHelper(Clock clock, BackoffStrategy backoffStrategy); void doUntilSuccess(final ExceptionalSupplier<Boolean, E> task); BackoffStrategy getBackoffStrategy(); T doUntilResult(ExceptionalSupplier<T, E> task); }
BackoffHelper { public <E extends Exception> void doUntilSuccess(final ExceptionalSupplier<Boolean, E> task) throws InterruptedException, BackoffStoppedException, E { doUntilResult(() -> { Boolean result = task.get(); return Boolean.TRUE.equals(result) ? result : null; }); } BackoffHelper();  BackoffHelper(Amount<Long, Time> initialBackoff, Amount<Long, Time> maxBackoff);  BackoffHelper(BackoffStrategy backoffStrategy); @VisibleForTesting  BackoffHelper(Clock clock, BackoffStrategy backoffStrategy); void doUntilSuccess(final ExceptionalSupplier<Boolean, E> task); BackoffStrategy getBackoffStrategy(); T doUntilResult(ExceptionalSupplier<T, E> task);  }