aboutsummaryrefslogtreecommitdiff
path: root/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java')
-rw-r--r--guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java b/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java
index fd51a7329..7b501dc3d 100644
--- a/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java
+++ b/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java
@@ -17,6 +17,7 @@
package com.google.common.util.concurrent;
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
+import static org.junit.Assert.assertThrows;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
@@ -113,12 +114,9 @@ public class ListenableFutureTaskTest extends TestCase {
runLatch.await();
taskLatch.countDown();
- try {
- task.get(5, TimeUnit.SECONDS);
- fail("Should have propagated the failure.");
- } catch (ExecutionException e) {
- assertEquals(IllegalStateException.class, e.getCause().getClass());
- }
+ ExecutionException e =
+ assertThrows(ExecutionException.class, () -> task.get(5, TimeUnit.SECONDS));
+ assertEquals(IllegalStateException.class, e.getCause().getClass());
assertTrue(listenerLatch.await(5, TimeUnit.SECONDS));
assertTrue(task.isDone());