aboutsummaryrefslogtreecommitdiff
path: root/android/guava-tests/test/com/google/common/collect/FilteredCollectionsTestUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'android/guava-tests/test/com/google/common/collect/FilteredCollectionsTestUtil.java')
-rw-r--r--android/guava-tests/test/com/google/common/collect/FilteredCollectionsTestUtil.java19
1 files changed, 4 insertions, 15 deletions
diff --git a/android/guava-tests/test/com/google/common/collect/FilteredCollectionsTestUtil.java b/android/guava-tests/test/com/google/common/collect/FilteredCollectionsTestUtil.java
index 77e01dc58..d2fc05fd8 100644
--- a/android/guava-tests/test/com/google/common/collect/FilteredCollectionsTestUtil.java
+++ b/android/guava-tests/test/com/google/common/collect/FilteredCollectionsTestUtil.java
@@ -17,6 +17,7 @@
package com.google.common.collect;
import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertThrows;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
@@ -156,11 +157,7 @@ public final class FilteredCollectionsTestUtil {
C filtered = filter(createUnfiltered(contents), EVEN);
C filteredToModify = filter(createUnfiltered(contents), EVEN);
- try {
- filteredToModify.addAll(toAdd);
- fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException expected) {
- }
+ assertThrows(IllegalArgumentException.class, () -> filteredToModify.addAll(toAdd));
assertThat(filteredToModify).containsExactlyElementsIn(filtered);
}
@@ -172,17 +169,9 @@ public final class FilteredCollectionsTestUtil {
C filtered1 = filter(unfiltered, EVEN);
C filtered2 = filter(filtered1, PRIME_DIGIT);
- try {
- filtered2.add(4);
- fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException expected) {
- }
+ assertThrows(IllegalArgumentException.class, () -> filtered2.add(4));
- try {
- filtered2.add(3);
- fail("Expected IllegalArgumentException");
- } catch (IllegalArgumentException expected) {
- }
+ assertThrows(IllegalArgumentException.class, () -> filtered2.add(3));
filtered2.add(2);
}