in future/src/main/java/com/spotify/hamcrest/future/ExceptionallyCompletedBlockingFuture.java [44:66]
protected boolean matchesSafely(final Future<T> future, final Description mismatchDescription) {
try {
final T item = future.get();
mismatchDescription
.appendText("a future that completed to a value that was ")
.appendValue(item);
return false;
} catch (InterruptedException e) {
mismatchDescription.appendText("a future that was interrupted");
return false;
} catch (CancellationException e) {
mismatchDescription.appendText("a future that was cancelled");
return false;
} catch (ExecutionException e) {
if (matcher.matches(e.getCause())) {
return true;
} else {
mismatchDescription.appendText("a future completed exceptionally with ");
matcher.describeMismatch(e.getCause(), mismatchDescription);
return false;
}
}
}