diff options
Diffstat (limited to 'guava-tests/test/com/google/common/hash/AbstractByteHasherTest.java')
-rw-r--r-- | guava-tests/test/com/google/common/hash/AbstractByteHasherTest.java | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/guava-tests/test/com/google/common/hash/AbstractByteHasherTest.java b/guava-tests/test/com/google/common/hash/AbstractByteHasherTest.java index 7ceb25e0c..8b54d4959 100644 --- a/guava-tests/test/com/google/common/hash/AbstractByteHasherTest.java +++ b/guava-tests/test/com/google/common/hash/AbstractByteHasherTest.java @@ -16,6 +16,7 @@ package com.google.common.hash; import static com.google.common.base.Charsets.UTF_16LE; import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertThrows; import java.io.ByteArrayOutputStream; import java.util.Random; @@ -92,21 +93,9 @@ public class AbstractByteHasherTest extends TestCase { public void testCorrectExceptions() { TestHasher hasher = new TestHasher(); - try { - hasher.putBytes(new byte[8], -1, 4); - fail(); - } catch (IndexOutOfBoundsException expected) { - } - try { - hasher.putBytes(new byte[8], 0, 16); - fail(); - } catch (IndexOutOfBoundsException expected) { - } - try { - hasher.putBytes(new byte[8], 0, -1); - fail(); - } catch (IndexOutOfBoundsException expected) { - } + assertThrows(IndexOutOfBoundsException.class, () -> hasher.putBytes(new byte[8], -1, 4)); + assertThrows(IndexOutOfBoundsException.class, () -> hasher.putBytes(new byte[8], 0, 16)); + assertThrows(IndexOutOfBoundsException.class, () -> hasher.putBytes(new byte[8], 0, -1)); } private class TestHasher extends AbstractByteHasher { |