diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java index a16b523e5be8..0b0d57cd16da 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java @@ -102,7 +102,7 @@ public void testListIterator_tooHigh() { } public void testListIterator_atSize() { - getList().listIterator(getNumElements()); + assertNotNull(getList().listIterator(getNumElements())); // TODO: run the iterator through ListIteratorTester } diff --git a/android/guava-tests/test/com/google/common/collect/SynchronizedNavigableMapTest.java b/android/guava-tests/test/com/google/common/collect/SynchronizedNavigableMapTest.java index 4e1f5b336e17..6c59fc8cf6a3 100644 --- a/android/guava-tests/test/com/google/common/collect/SynchronizedNavigableMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/SynchronizedNavigableMapTest.java @@ -290,15 +290,15 @@ protected SortedMap create(Entry[] entries) { } public void testComparator() { - create().comparator(); + assertNotNull(create().comparator()); } public void testCeilingEntry() { - create().ceilingEntry("a"); + assertNull(create().ceilingEntry("a")); } public void testCeilingKey() { - create().ceilingKey("a"); + assertNull(create().ceilingKey("a")); } public void testDescendingKeySet() { @@ -316,21 +316,21 @@ public void testDescendingMap() { } public void testFirstEntry() { - create().firstEntry(); + assertNull(create().firstEntry()); } public void testFirstKey() { NavigableMap map = create(); map.put("a", 1); - map.firstKey(); + assertNotNull(map.firstKey()); } public void testFloorEntry() { - create().floorEntry("a"); + assertNull(create().floorEntry("a")); } public void testFloorKey() { - create().floorKey("a"); + assertNull(create().floorKey("a")); } public void testHeadMap_k() { @@ -348,29 +348,29 @@ public void testHeadMap_k_b() { } public void testHigherEntry() { - create().higherEntry("a"); + assertNull(create().higherEntry("a")); } public void testHigherKey() { - create().higherKey("a"); + assertNull(create().higherKey("a")); } public void testLastEntry() { - create().lastEntry(); + assertNull(create().lastEntry()); } public void testLastKey() { NavigableMap map = create(); map.put("a", 1); - map.lastKey(); + assertNotNull(map.lastKey()); } public void testLowerEntry() { - create().lowerEntry("a"); + assertNull(create().lowerEntry("a")); } public void testLowerKey() { - create().lowerKey("a"); + assertNull(create().lowerKey("a")); } public void testNavigableKeySet() { diff --git a/android/guava-tests/test/com/google/common/util/concurrent/JSR166TestCase.java b/android/guava-tests/test/com/google/common/util/concurrent/JSR166TestCase.java index d567de443fe6..8e9d2e4d2756 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/JSR166TestCase.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/JSR166TestCase.java @@ -510,7 +510,7 @@ void assertFutureTimesOut(Future future, long timeoutMillis) { long startTime = System.nanoTime(); try { future.get(timeoutMillis, MILLISECONDS); - shouldThrow(); + fail("Should throw exception"); } catch (TimeoutException success) { } catch (Exception e) { threadUnexpectedException(e); @@ -520,16 +520,6 @@ void assertFutureTimesOut(Future future, long timeoutMillis) { assertTrue(millisElapsedSince(startTime) >= timeoutMillis); } - /** Fails with message "should throw exception". */ - public void shouldThrow() { - fail("Should throw exception"); - } - - /** Fails with message "should throw " + exceptionName. */ - public void shouldThrow(String exceptionName) { - fail("Should throw " + exceptionName); - } - /** The number of elements to place in collections, arrays, etc. */ public static final int SIZE = 20; @@ -1184,17 +1174,17 @@ void checkEmpty(BlockingQueue q) { assertFalse(q.iterator().hasNext()); try { q.element(); - shouldThrow(); + fail("Should throw exception"); } catch (NoSuchElementException success) { } try { q.iterator().next(); - shouldThrow(); + fail("Should throw exception"); } catch (NoSuchElementException success) { } try { q.remove(); - shouldThrow(); + fail("Should throw exception"); } catch (NoSuchElementException success) { } } catch (InterruptedException ie) { diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java index a16b523e5be8..0b0d57cd16da 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java @@ -102,7 +102,7 @@ public void testListIterator_tooHigh() { } public void testListIterator_atSize() { - getList().listIterator(getNumElements()); + assertNotNull(getList().listIterator(getNumElements())); // TODO: run the iterator through ListIteratorTester } diff --git a/guava-tests/test/com/google/common/collect/SynchronizedNavigableMapTest.java b/guava-tests/test/com/google/common/collect/SynchronizedNavigableMapTest.java index 4e1f5b336e17..6c59fc8cf6a3 100644 --- a/guava-tests/test/com/google/common/collect/SynchronizedNavigableMapTest.java +++ b/guava-tests/test/com/google/common/collect/SynchronizedNavigableMapTest.java @@ -290,15 +290,15 @@ protected SortedMap create(Entry[] entries) { } public void testComparator() { - create().comparator(); + assertNotNull(create().comparator()); } public void testCeilingEntry() { - create().ceilingEntry("a"); + assertNull(create().ceilingEntry("a")); } public void testCeilingKey() { - create().ceilingKey("a"); + assertNull(create().ceilingKey("a")); } public void testDescendingKeySet() { @@ -316,21 +316,21 @@ public void testDescendingMap() { } public void testFirstEntry() { - create().firstEntry(); + assertNull(create().firstEntry()); } public void testFirstKey() { NavigableMap map = create(); map.put("a", 1); - map.firstKey(); + assertNotNull(map.firstKey()); } public void testFloorEntry() { - create().floorEntry("a"); + assertNull(create().floorEntry("a")); } public void testFloorKey() { - create().floorKey("a"); + assertNull(create().floorKey("a")); } public void testHeadMap_k() { @@ -348,29 +348,29 @@ public void testHeadMap_k_b() { } public void testHigherEntry() { - create().higherEntry("a"); + assertNull(create().higherEntry("a")); } public void testHigherKey() { - create().higherKey("a"); + assertNull(create().higherKey("a")); } public void testLastEntry() { - create().lastEntry(); + assertNull(create().lastEntry()); } public void testLastKey() { NavigableMap map = create(); map.put("a", 1); - map.lastKey(); + assertNotNull(map.lastKey()); } public void testLowerEntry() { - create().lowerEntry("a"); + assertNull(create().lowerEntry("a")); } public void testLowerKey() { - create().lowerKey("a"); + assertNull(create().lowerKey("a")); } public void testNavigableKeySet() { diff --git a/guava-tests/test/com/google/common/util/concurrent/JSR166TestCase.java b/guava-tests/test/com/google/common/util/concurrent/JSR166TestCase.java index d567de443fe6..8e9d2e4d2756 100644 --- a/guava-tests/test/com/google/common/util/concurrent/JSR166TestCase.java +++ b/guava-tests/test/com/google/common/util/concurrent/JSR166TestCase.java @@ -510,7 +510,7 @@ void assertFutureTimesOut(Future future, long timeoutMillis) { long startTime = System.nanoTime(); try { future.get(timeoutMillis, MILLISECONDS); - shouldThrow(); + fail("Should throw exception"); } catch (TimeoutException success) { } catch (Exception e) { threadUnexpectedException(e); @@ -520,16 +520,6 @@ void assertFutureTimesOut(Future future, long timeoutMillis) { assertTrue(millisElapsedSince(startTime) >= timeoutMillis); } - /** Fails with message "should throw exception". */ - public void shouldThrow() { - fail("Should throw exception"); - } - - /** Fails with message "should throw " + exceptionName. */ - public void shouldThrow(String exceptionName) { - fail("Should throw " + exceptionName); - } - /** The number of elements to place in collections, arrays, etc. */ public static final int SIZE = 20; @@ -1184,17 +1174,17 @@ void checkEmpty(BlockingQueue q) { assertFalse(q.iterator().hasNext()); try { q.element(); - shouldThrow(); + fail("Should throw exception"); } catch (NoSuchElementException success) { } try { q.iterator().next(); - shouldThrow(); + fail("Should throw exception"); } catch (NoSuchElementException success) { } try { q.remove(); - shouldThrow(); + fail("Should throw exception"); } catch (NoSuchElementException success) { } } catch (InterruptedException ie) {