aboutsummaryrefslogtreecommitdiff
path: root/guava-tests/test/com/google/common/hash/AbstractStreamingHasherTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'guava-tests/test/com/google/common/hash/AbstractStreamingHasherTest.java')
-rw-r--r--guava-tests/test/com/google/common/hash/AbstractStreamingHasherTest.java19
1 files changed, 4 insertions, 15 deletions
diff --git a/guava-tests/test/com/google/common/hash/AbstractStreamingHasherTest.java b/guava-tests/test/com/google/common/hash/AbstractStreamingHasherTest.java
index 99b2c71a0..77b4e67cc 100644
--- a/guava-tests/test/com/google/common/hash/AbstractStreamingHasherTest.java
+++ b/guava-tests/test/com/google/common/hash/AbstractStreamingHasherTest.java
@@ -17,6 +17,7 @@
package com.google.common.hash;
import static com.google.common.base.Charsets.UTF_16LE;
+import static org.junit.Assert.assertThrows;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
@@ -113,21 +114,9 @@ public class AbstractStreamingHasherTest extends TestCase {
public void testCorrectExceptions() {
Sink sink = new Sink(4);
- try {
- sink.putBytes(new byte[8], -1, 4);
- fail();
- } catch (IndexOutOfBoundsException ok) {
- }
- try {
- sink.putBytes(new byte[8], 0, 16);
- fail();
- } catch (IndexOutOfBoundsException ok) {
- }
- try {
- sink.putBytes(new byte[8], 0, -1);
- fail();
- } catch (IndexOutOfBoundsException ok) {
- }
+ assertThrows(IndexOutOfBoundsException.class, () -> sink.putBytes(new byte[8], -1, 4));
+ assertThrows(IndexOutOfBoundsException.class, () -> sink.putBytes(new byte[8], 0, 16));
+ assertThrows(IndexOutOfBoundsException.class, () -> sink.putBytes(new byte[8], 0, -1));
}
/**