protected boolean matchesSafely()

in future/src/main/java/com/spotify/hamcrest/future/SuccessfullyCompletedBlockingFuture.java [44:64]


  protected boolean matchesSafely(
      final Future<? extends T> future, final Description mismatchDescription) {
    try {
      final T item = future.get();
      if (matcher.matches(item)) {
        return true;
      } else {
        mismatchDescription.appendText("a future that completed with a value that ");
        matcher.describeMismatch(item, mismatchDescription);
        return false;
      }
    } catch (InterruptedException e) {
      mismatchDescription.appendText("a future that was interrupted");
      return false;
    } catch (ExecutionException e) {
      mismatchDescription
          .appendText("a future that completed exceptionally with ")
          .appendText(Utils.getStackTraceAsString(e.getCause()));
      return false;
    }
  }