@Test public void testDoUntilResultTransparentException() throws Exception { ExceptionalSupplier<String, IOException> task = createMock(new Clazz<ExceptionalSupplier<String, IOException>>() { }); IOException thrown = new IOException(); expect(task.get()).andThrow(thrown); control.replay(); try { backoffHelper.doUntilResult(task); fail("Expected exception to be bubbled"); } catch (IOException e) { assertSame(thrown, e); } control.verify(); }
public <T, E extends Exception> T doUntilResult(ExceptionalSupplier<T, E> task) throws InterruptedException, BackoffStoppedException, E { T result = task.get(); return (result != null) ? result : retryWork(task); }
BackoffHelper { public <T, E extends Exception> T doUntilResult(ExceptionalSupplier<T, E> task) throws InterruptedException, BackoffStoppedException, E { T result = task.get(); return (result != null) ? result : retryWork(task); } }
BackoffHelper { public <T, E extends Exception> T doUntilResult(ExceptionalSupplier<T, E> task) throws InterruptedException, BackoffStoppedException, E { T result = task.get(); return (result != null) ? result : retryWork(task); } BackoffHelper();  BackoffHelper(Amount<Long, Time> initialBackoff, Amount<Long, Time> maxBackoff);  BackoffHelper(BackoffStrategy backoffStrategy); @VisibleForTesting  BackoffHelper(Clock clock, BackoffStrategy backoffStrategy); }
BackoffHelper { public <T, E extends Exception> T doUntilResult(ExceptionalSupplier<T, E> task) throws InterruptedException, BackoffStoppedException, E { T result = task.get(); return (result != null) ? result : retryWork(task); } 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 <T, E extends Exception> T doUntilResult(ExceptionalSupplier<T, E> task) throws InterruptedException, BackoffStoppedException, E { T result = task.get(); return (result != null) ? result : retryWork(task); } 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);  }