Skip to content

Commit e5d6cfa

Browse files
klueverGoogle Java Core Libraries
authored andcommitted
Fix soon-to-be CRV-related compile errors.
RELNOTES=n/a PiperOrigin-RevId: 786251457
1 parent 87976cd commit e5d6cfa

File tree

6 files changed

+36
-56
lines changed

6 files changed

+36
-56
lines changed

android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void testListIterator_tooHigh() {
102102
}
103103

104104
public void testListIterator_atSize() {
105-
getList().listIterator(getNumElements());
105+
assertNotNull(getList().listIterator(getNumElements()));
106106
// TODO: run the iterator through ListIteratorTester
107107
}
108108

android/guava-tests/test/com/google/common/collect/SynchronizedNavigableMapTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,15 @@ protected SortedMap<String, String> create(Entry<String, String>[] entries) {
290290
}
291291

292292
public void testComparator() {
293-
create().comparator();
293+
assertNotNull(create().comparator());
294294
}
295295

296296
public void testCeilingEntry() {
297-
create().ceilingEntry("a");
297+
assertNotNull(create().ceilingEntry("a"));
298298
}
299299

300300
public void testCeilingKey() {
301-
create().ceilingKey("a");
301+
assertNotNull(create().ceilingKey("a"));
302302
}
303303

304304
public void testDescendingKeySet() {
@@ -316,21 +316,21 @@ public void testDescendingMap() {
316316
}
317317

318318
public void testFirstEntry() {
319-
create().firstEntry();
319+
assertNotNull(create().firstEntry());
320320
}
321321

322322
public void testFirstKey() {
323323
NavigableMap<String, Integer> map = create();
324324
map.put("a", 1);
325-
map.firstKey();
325+
assertNotNull(map.firstKey());
326326
}
327327

328328
public void testFloorEntry() {
329-
create().floorEntry("a");
329+
assertNotNull(create().floorEntry("a"));
330330
}
331331

332332
public void testFloorKey() {
333-
create().floorKey("a");
333+
assertNotNull(create().floorKey("a"));
334334
}
335335

336336
public void testHeadMap_k() {
@@ -348,29 +348,29 @@ public void testHeadMap_k_b() {
348348
}
349349

350350
public void testHigherEntry() {
351-
create().higherEntry("a");
351+
assertNotNull(create().higherEntry("a"));
352352
}
353353

354354
public void testHigherKey() {
355-
create().higherKey("a");
355+
assertNotNull(create().higherKey("a"));
356356
}
357357

358358
public void testLastEntry() {
359-
create().lastEntry();
359+
assertNotNull(create().lastEntry());
360360
}
361361

362362
public void testLastKey() {
363363
NavigableMap<String, Integer> map = create();
364364
map.put("a", 1);
365-
map.lastKey();
365+
assertNotNull(map.lastKey());
366366
}
367367

368368
public void testLowerEntry() {
369-
create().lowerEntry("a");
369+
assertNotNull(create().lowerEntry("a"));
370370
}
371371

372372
public void testLowerKey() {
373-
create().lowerKey("a");
373+
assertNotNull(create().lowerKey("a"));
374374
}
375375

376376
public void testNavigableKeySet() {

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ void assertFutureTimesOut(Future<?> future, long timeoutMillis) {
510510
long startTime = System.nanoTime();
511511
try {
512512
future.get(timeoutMillis, MILLISECONDS);
513-
shouldThrow();
513+
fail("Should throw exception");
514514
} catch (TimeoutException success) {
515515
} catch (Exception e) {
516516
threadUnexpectedException(e);
@@ -520,16 +520,6 @@ void assertFutureTimesOut(Future<?> future, long timeoutMillis) {
520520
assertTrue(millisElapsedSince(startTime) >= timeoutMillis);
521521
}
522522

523-
/** Fails with message "should throw exception". */
524-
public void shouldThrow() {
525-
fail("Should throw exception");
526-
}
527-
528-
/** Fails with message "should throw " + exceptionName. */
529-
public void shouldThrow(String exceptionName) {
530-
fail("Should throw " + exceptionName);
531-
}
532-
533523
/** The number of elements to place in collections, arrays, etc. */
534524
public static final int SIZE = 20;
535525

@@ -1184,17 +1174,17 @@ void checkEmpty(BlockingQueue<?> q) {
11841174
assertFalse(q.iterator().hasNext());
11851175
try {
11861176
q.element();
1187-
shouldThrow();
1177+
fail("Should throw exception");
11881178
} catch (NoSuchElementException success) {
11891179
}
11901180
try {
11911181
q.iterator().next();
1192-
shouldThrow();
1182+
fail("Should throw exception");
11931183
} catch (NoSuchElementException success) {
11941184
}
11951185
try {
11961186
q.remove();
1197-
shouldThrow();
1187+
fail("Should throw exception");
11981188
} catch (NoSuchElementException success) {
11991189
}
12001190
} catch (InterruptedException ie) {

guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void testListIterator_tooHigh() {
102102
}
103103

104104
public void testListIterator_atSize() {
105-
getList().listIterator(getNumElements());
105+
assertNotNull(getList().listIterator(getNumElements()));
106106
// TODO: run the iterator through ListIteratorTester
107107
}
108108

guava-tests/test/com/google/common/collect/SynchronizedNavigableMapTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,15 @@ protected SortedMap<String, String> create(Entry<String, String>[] entries) {
290290
}
291291

292292
public void testComparator() {
293-
create().comparator();
293+
assertNotNull(create().comparator());
294294
}
295295

296296
public void testCeilingEntry() {
297-
create().ceilingEntry("a");
297+
assertNotNull(create().ceilingEntry("a"));
298298
}
299299

300300
public void testCeilingKey() {
301-
create().ceilingKey("a");
301+
assertNotNull(create().ceilingKey("a"));
302302
}
303303

304304
public void testDescendingKeySet() {
@@ -316,21 +316,21 @@ public void testDescendingMap() {
316316
}
317317

318318
public void testFirstEntry() {
319-
create().firstEntry();
319+
assertNotNull(create().firstEntry());
320320
}
321321

322322
public void testFirstKey() {
323323
NavigableMap<String, Integer> map = create();
324324
map.put("a", 1);
325-
map.firstKey();
325+
assertNotNull(map.firstKey());
326326
}
327327

328328
public void testFloorEntry() {
329-
create().floorEntry("a");
329+
assertNotNull(create().floorEntry("a"));
330330
}
331331

332332
public void testFloorKey() {
333-
create().floorKey("a");
333+
assertNotNull(create().floorKey("a"));
334334
}
335335

336336
public void testHeadMap_k() {
@@ -348,29 +348,29 @@ public void testHeadMap_k_b() {
348348
}
349349

350350
public void testHigherEntry() {
351-
create().higherEntry("a");
351+
assertNotNull(create().higherEntry("a"));
352352
}
353353

354354
public void testHigherKey() {
355-
create().higherKey("a");
355+
assertNotNull(create().higherKey("a"));
356356
}
357357

358358
public void testLastEntry() {
359-
create().lastEntry();
359+
assertNotNull(create().lastEntry());
360360
}
361361

362362
public void testLastKey() {
363363
NavigableMap<String, Integer> map = create();
364364
map.put("a", 1);
365-
map.lastKey();
365+
assertNotNull(map.lastKey());
366366
}
367367

368368
public void testLowerEntry() {
369-
create().lowerEntry("a");
369+
assertNotNull(create().lowerEntry("a"));
370370
}
371371

372372
public void testLowerKey() {
373-
create().lowerKey("a");
373+
assertNotNull(create().lowerKey("a"));
374374
}
375375

376376
public void testNavigableKeySet() {

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ void assertFutureTimesOut(Future<?> future, long timeoutMillis) {
510510
long startTime = System.nanoTime();
511511
try {
512512
future.get(timeoutMillis, MILLISECONDS);
513-
shouldThrow();
513+
fail("Should throw exception");
514514
} catch (TimeoutException success) {
515515
} catch (Exception e) {
516516
threadUnexpectedException(e);
@@ -520,16 +520,6 @@ void assertFutureTimesOut(Future<?> future, long timeoutMillis) {
520520
assertTrue(millisElapsedSince(startTime) >= timeoutMillis);
521521
}
522522

523-
/** Fails with message "should throw exception". */
524-
public void shouldThrow() {
525-
fail("Should throw exception");
526-
}
527-
528-
/** Fails with message "should throw " + exceptionName. */
529-
public void shouldThrow(String exceptionName) {
530-
fail("Should throw " + exceptionName);
531-
}
532-
533523
/** The number of elements to place in collections, arrays, etc. */
534524
public static final int SIZE = 20;
535525

@@ -1184,17 +1174,17 @@ void checkEmpty(BlockingQueue<?> q) {
11841174
assertFalse(q.iterator().hasNext());
11851175
try {
11861176
q.element();
1187-
shouldThrow();
1177+
fail("Should throw exception");
11881178
} catch (NoSuchElementException success) {
11891179
}
11901180
try {
11911181
q.iterator().next();
1192-
shouldThrow();
1182+
fail("Should throw exception");
11931183
} catch (NoSuchElementException success) {
11941184
}
11951185
try {
11961186
q.remove();
1197-
shouldThrow();
1187+
fail("Should throw exception");
11981188
} catch (NoSuchElementException success) {
11991189
}
12001190
} catch (InterruptedException ie) {

0 commit comments

Comments
 (0)