diff options
Diffstat (limited to 'guava-tests/test/com/google/common/util/concurrent/AbstractClosingFutureTest.java')
-rw-r--r-- | guava-tests/test/com/google/common/util/concurrent/AbstractClosingFutureTest.java | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/guava-tests/test/com/google/common/util/concurrent/AbstractClosingFutureTest.java b/guava-tests/test/com/google/common/util/concurrent/AbstractClosingFutureTest.java index ecccd784c..b6ca74e8e 100644 --- a/guava-tests/test/com/google/common/util/concurrent/AbstractClosingFutureTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/AbstractClosingFutureTest.java @@ -30,6 +30,7 @@ import static com.google.common.util.concurrent.Uninterruptibles.getUninterrupti import static java.util.Arrays.asList; import static java.util.concurrent.Executors.newSingleThreadExecutor; import static java.util.concurrent.TimeUnit.SECONDS; +import static org.junit.Assert.assertThrows; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.verify; @@ -739,11 +740,7 @@ public abstract class AbstractClosingFutureTest extends TestCase { waitUntilClosed(closingFuture); assertStillOpen(closeable2); assertClosed(closeable1); - try { - capturedPeeker.get().getDone(input1); - fail("Peeker should not be able to peek except during call."); - } catch (IllegalStateException expected) { - } + assertThrows(IllegalStateException.class, () -> capturedPeeker.get().getDone(input1)); } public void testWhenAllComplete_call_cancelledPipeline() throws Exception { @@ -825,11 +822,7 @@ public abstract class AbstractClosingFutureTest extends TestCase { assertThat(getFinalValue(closingFuture)).isSameInstanceAs(closeable2); waitUntilClosed(closingFuture); assertClosed(closeable1, closeable2); - try { - capturedPeeker.get().getDone(input1); - fail("Peeker should not be able to peek except during call."); - } catch (IllegalStateException expected) { - } + assertThrows(IllegalStateException.class, () -> capturedPeeker.get().getDone(input1)); } public void testWhenAllComplete_callAsync_cancelledPipeline() throws Exception { |