diff options
Diffstat (limited to 'guava-tests/test/com/google/common/io/CountingOutputStreamTest.java')
-rw-r--r-- | guava-tests/test/com/google/common/io/CountingOutputStreamTest.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/guava-tests/test/com/google/common/io/CountingOutputStreamTest.java b/guava-tests/test/com/google/common/io/CountingOutputStreamTest.java index 870692b32..d5023492b 100644 --- a/guava-tests/test/com/google/common/io/CountingOutputStreamTest.java +++ b/guava-tests/test/com/google/common/io/CountingOutputStreamTest.java @@ -16,6 +16,8 @@ package com.google.common.io; +import static org.junit.Assert.assertThrows; + import java.io.ByteArrayOutputStream; /** @@ -54,11 +56,7 @@ public class CountingOutputStreamTest extends IoTestCase { assertEquals(written, counter.getCount()); // Test that illegal arguments do not affect count - try { - counter.write(data, 0, data.length + 1); - fail("expected exception"); - } catch (IndexOutOfBoundsException expected) { - } + assertThrows(IndexOutOfBoundsException.class, () -> counter.write(data, 0, data.length + 1)); assertEquals(written, out.size()); assertEquals(written, counter.getCount()); } |