diff options
Diffstat (limited to 'guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java')
-rw-r--r-- | guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java b/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java index ab53f5383..48d5c8e5a 100644 --- a/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java @@ -23,6 +23,7 @@ import static com.google.common.util.concurrent.Futures.immediateFuture; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import static java.util.concurrent.Executors.newScheduledThreadPool; import static java.util.concurrent.TimeUnit.SECONDS; +import static org.junit.Assert.assertThrows; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; @@ -138,12 +139,8 @@ public class FluentFutureTest extends TestCase { try { FluentFuture<?> f = FluentFuture.from(SettableFuture.create()).withTimeout(0, SECONDS, executor); - try { - f.get(); - fail(); - } catch (ExecutionException e) { - assertThat(e).hasCauseThat().isInstanceOf(TimeoutException.class); - } + ExecutionException e = assertThrows(ExecutionException.class, () -> f.get()); + assertThat(e).hasCauseThat().isInstanceOf(TimeoutException.class); } finally { executor.shutdown(); } |