Skip to content

Commit c797198

Browse files
cpovirkGoogle Java Core Libraries
authored andcommitted
Very partial rollback of d417c5b.
We're seeing some timeouts under Android. (I've worried for years that Truth might be too expensive in tight loops, including on Android, and this is the first time I recall hearing that it actually happened! I'm sure it's happened somewhere without my hearing about it, but still.) PiperOrigin-RevId: 825192799
1 parent ebcb507 commit c797198

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

android/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleArrayTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
package com.google.common.util.concurrent;
1515

16-
import static com.google.common.truth.Truth.assertThat;
1716
import static org.junit.Assert.assertThrows;
1817

1918
import com.google.common.annotations.GwtIncompatible;
@@ -248,13 +247,14 @@ class Counter extends CheckedRunnable {
248247
aa = a;
249248
}
250249

250+
@SuppressWarnings("DoubleAtLeastJUnit") // causes timeouts under Android
251251
@Override
252252
public void realRun() {
253253
for (; ; ) {
254254
boolean done = true;
255255
for (int i = 0; i < aa.length(); i++) {
256256
double v = aa.get(i);
257-
assertThat(v).isAtLeast(0);
257+
assertTrue(v >= 0);
258258
if (v != 0) {
259259
done = false;
260260
if (aa.compareAndSet(i, v, v - 1.0)) {

guava-tests/test/com/google/common/util/concurrent/AtomicDoubleArrayTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
package com.google.common.util.concurrent;
1515

16-
import static com.google.common.truth.Truth.assertThat;
1716
import static java.lang.Math.max;
1817
import static org.junit.Assert.assertThrows;
1918

@@ -371,13 +370,14 @@ class Counter extends CheckedRunnable {
371370
aa = a;
372371
}
373372

373+
@SuppressWarnings("DoubleAtLeastJUnit") // causes timeouts under Android
374374
@Override
375375
public void realRun() {
376376
for (; ; ) {
377377
boolean done = true;
378378
for (int i = 0; i < aa.length(); i++) {
379379
double v = aa.get(i);
380-
assertThat(v).isAtLeast(0);
380+
assertTrue(v >= 0);
381381
if (v != 0) {
382382
done = false;
383383
if (aa.compareAndSet(i, v, v - 1.0)) {

0 commit comments

Comments
 (0)