@Test
public void shouldOnlyComputeOnceForConcurrentCalls() throws Throwable {

  var executor = Executors.newCachedThreadPool();
  var queue = new LinkedBlockingQueue<Integer>();
  when(delegate.get()).then(a -> queue.take());
  var f1 = CompletableFuture.supplyAsync(sut, executor);
  var f2 = CompletableFuture.supplyAsync(sut, executor);
  // Wait for first call to the underlying supplier
  verify(delegate, timeout(5000).times(1)).get();
  queue.put(1);
  queue.put(2);
  assertThat(f1.join(), is(1));
  assertThat(f2.join(), is(1));
  // Ensure that there was only one call to the underlying supplier
  Thread.sleep(5000);
  verifyNoMoreInteractions(delegate);
}