diff options
Diffstat (limited to 'guava-tests/test/com/google/common/io/CountingInputStreamTest.java')
-rw-r--r-- | guava-tests/test/com/google/common/io/CountingInputStreamTest.java | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/guava-tests/test/com/google/common/io/CountingInputStreamTest.java b/guava-tests/test/com/google/common/io/CountingInputStreamTest.java index 163027b49..945f5d023 100644 --- a/guava-tests/test/com/google/common/io/CountingInputStreamTest.java +++ b/guava-tests/test/com/google/common/io/CountingInputStreamTest.java @@ -17,6 +17,7 @@ package com.google.common.io; import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.assertThrows; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -90,23 +91,15 @@ public class CountingInputStreamTest extends IoTestCase { } public void testMarkNotSet() { - try { - counter.reset(); - fail(); - } catch (IOException expected) { - assertThat(expected).hasMessageThat().isEqualTo("Mark not set"); - } + IOException expected = assertThrows(IOException.class, () -> counter.reset()); + assertThat(expected).hasMessageThat().isEqualTo("Mark not set"); } public void testMarkNotSupported() { counter = new CountingInputStream(new UnmarkableInputStream()); - try { - counter.reset(); - fail(); - } catch (IOException expected) { - assertThat(expected).hasMessageThat().isEqualTo("Mark not supported"); - } + IOException expected = assertThrows(IOException.class, () -> counter.reset()); + assertThat(expected).hasMessageThat().isEqualTo("Mark not supported"); } private static class UnmarkableInputStream extends InputStream { |