@Test
public void containsCurrentStacktrace() {

  final String currentMethod = "containsCurrentStacktrace";
  // Throw an error in an executor, which will cause it to lose the current stack frame
  ListeningExecutorService executor =
      MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
  ListenableFuture<?> futureError =
      executor.submit(
          new Runnable() {
            @Override
            public void run() {
              throw new IllegalArgumentException();
            }
          });
  ListenableFutureToApiFuture<?> futureErrorWrapper =
      new ListenableFutureToApiFuture<>(futureError);
  executor.shutdown();
  // Unwrap the future
  Exception actualError = null;
  try {
    ApiExceptions.callAndTranslateApiException(futureErrorWrapper);
  } catch (Exception e) {
    actualError = e;
  }
  // Sanity check that the current stack trace is not in the exception
  assertThat(actualError).isNotNull();
  assertThat(isMethodInStacktrace(currentMethod, actualError)).isFalse();
  // Verify that it is preserved as a suppressed exception.
  assertThat(actualError.getSuppressed()[0]).isInstanceOf(AsyncTaskException.class);
  assertThat(isMethodInStacktrace(currentMethod, actualError.getSuppressed()[0])).isTrue();
}