aboutsummaryrefslogtreecommitdiff
path: root/android/guava-tests/test/com/google/common/util/concurrent/AtomicsTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'android/guava-tests/test/com/google/common/util/concurrent/AtomicsTest.java')
-rw-r--r--android/guava-tests/test/com/google/common/util/concurrent/AtomicsTest.java26
1 files changed, 6 insertions, 20 deletions
diff --git a/android/guava-tests/test/com/google/common/util/concurrent/AtomicsTest.java b/android/guava-tests/test/com/google/common/util/concurrent/AtomicsTest.java
index b903e6ce8..90f0f6f76 100644
--- a/android/guava-tests/test/com/google/common/util/concurrent/AtomicsTest.java
+++ b/android/guava-tests/test/com/google/common/util/concurrent/AtomicsTest.java
@@ -16,6 +16,8 @@
package com.google.common.util.concurrent;
+import static org.junit.Assert.assertThrows;
+
import com.google.common.testing.NullPointerTester;
import java.util.concurrent.atomic.AtomicReferenceArray;
import junit.framework.TestCase;
@@ -44,19 +46,11 @@ public class AtomicsTest extends TestCase {
for (int i = 0; i < length; ++i) {
assertEquals(null, refArray.get(i));
}
- try {
- refArray.get(length);
- fail();
- } catch (IndexOutOfBoundsException expected) {
- }
+ assertThrows(IndexOutOfBoundsException.class, () -> refArray.get(length));
}
public void testNewReferenceArray_withNegativeLength() throws Exception {
- try {
- Atomics.newReferenceArray(-1);
- fail();
- } catch (NegativeArraySizeException expected) {
- }
+ assertThrows(NegativeArraySizeException.class, () -> Atomics.newReferenceArray(-1));
}
public void testNewReferenceArray_withStringArray() throws Exception {
@@ -65,19 +59,11 @@ public class AtomicsTest extends TestCase {
for (int i = 0; i < array.length; ++i) {
assertEquals(array[i], refArray.get(i));
}
- try {
- refArray.get(array.length);
- fail();
- } catch (IndexOutOfBoundsException expected) {
- }
+ assertThrows(IndexOutOfBoundsException.class, () -> refArray.get(array.length));
}
public void testNewReferenceArray_withNullArray() throws Exception {
- try {
- Atomics.newReferenceArray(null);
- fail();
- } catch (NullPointerException expected) {
- }
+ assertThrows(NullPointerException.class, () -> Atomics.newReferenceArray(null));
}
public void testNullPointers() {