@Test public void shouldRetryWhenForkFailsToLoad() { when(validatorApiChannel.getForkInfo()) .thenReturn(failedFuture(new RuntimeException("Nope"))) .thenReturn(completedFuture(Optional.of(fork))); final SafeFuture<ForkInfo> result = forkProvider.getForkInfo(); verify(validatorApiChannel).getForkInfo(); assertThat(result).isNotDone(); assertThat(asyncRunner.hasDelayedActions()).isTrue(); asyncRunner.executeQueuedActions(); verify(validatorApiChannel, times(2)).getForkInfo(); assertThat(result).isCompletedWithValue(fork); }
public SafeFuture<ForkInfo> getForkInfo() { return currentFork.map(SafeFuture::completedFuture).orElseGet(this::loadForkInfo); }
ForkProvider { public SafeFuture<ForkInfo> getForkInfo() { return currentFork.map(SafeFuture::completedFuture).orElseGet(this::loadForkInfo); } }
ForkProvider { public SafeFuture<ForkInfo> getForkInfo() { return currentFork.map(SafeFuture::completedFuture).orElseGet(this::loadForkInfo); } ForkProvider(
      final AsyncRunner asyncRunner, final ValidatorApiChannel validatorApiChannel); }
ForkProvider { public SafeFuture<ForkInfo> getForkInfo() { return currentFork.map(SafeFuture::completedFuture).orElseGet(this::loadForkInfo); } ForkProvider(
      final AsyncRunner asyncRunner, final ValidatorApiChannel validatorApiChannel); SafeFuture<ForkInfo> getForkInfo(); SafeFuture<ForkInfo> loadForkInfo(); SafeFuture<ForkInfo> requestForkInfo(); @Override String toString(); }
ForkProvider { public SafeFuture<ForkInfo> getForkInfo() { return currentFork.map(SafeFuture::completedFuture).orElseGet(this::loadForkInfo); } ForkProvider(
      final AsyncRunner asyncRunner, final ValidatorApiChannel validatorApiChannel); SafeFuture<ForkInfo> getForkInfo(); SafeFuture<ForkInfo> loadForkInfo(); SafeFuture<ForkInfo> requestForkInfo(); @Override String toString();  }