aboutsummaryrefslogtreecommitdiffstats
path: root/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java')
-rw-r--r--guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java51
1 files changed, 9 insertions, 42 deletions
diff --git a/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java b/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java
index 48ebea3..8cc8559 100644
--- a/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java
+++ b/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java
@@ -16,7 +16,7 @@
package com.google.common.collect;
-import static org.truth0.Truth.ASSERT;
+import static org.junit.contrib.truth.Truth.ASSERT;
import com.google.common.collect.testing.IteratorFeature;
import com.google.common.collect.testing.IteratorTester;
@@ -26,7 +26,6 @@ import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
@@ -355,7 +354,7 @@ public class MinMaxPriorityQueueTest extends TestCase {
}
}
assertTrue(q.isIntact());
- ASSERT.that(result).has().allOf(1, 15, 13, 8, 14);
+ ASSERT.that(result).hasContentsAnyOrder(1, 15, 13, 8, 14);
}
/**
@@ -562,18 +561,6 @@ public class MinMaxPriorityQueueTest extends TestCase {
}
}
- public void testRemoveAt_exhaustive() {
- int size = 8;
- List<Integer> expected = createOrderedList(size);
- for (Collection<Integer> perm : Collections2.permutations(expected)) {
- for (int i = 0; i < perm.size(); i++) {
- MinMaxPriorityQueue<Integer> q = MinMaxPriorityQueue.create(perm);
- q.removeAt(i);
- assertTrue("Remove at " + i + " perm " + perm, q.isIntact());
- }
- }
- }
-
/**
* Regression test for bug found.
*/
@@ -690,26 +677,6 @@ public class MinMaxPriorityQueueTest extends TestCase {
assertTrue(q.isEmpty());
}
- public void testExhaustive_pollAndPush() {
- int size = 8;
- List<Integer> expected = createOrderedList(size);
- for (Collection<Integer> perm : Collections2.permutations(expected)) {
- MinMaxPriorityQueue<Integer> q = MinMaxPriorityQueue.create(perm);
- List<Integer> elements = Lists.newArrayListWithCapacity(size);
- while (!q.isEmpty()) {
- Integer next = q.pollFirst();
- for (int i = 0; i <= size; i++) {
- assertTrue(q.add(i));
- assertTrue(q.add(next));
- assertTrue(q.remove(i));
- assertEquals(next, q.poll());
- }
- elements.add(next);
- }
- assertEquals("Started with " + perm, expected, elements);
- }
- }
-
/**
* Regression test for b/4124577
*/
@@ -720,23 +687,23 @@ public class MinMaxPriorityQueueTest extends TestCase {
List<Integer> contents = Lists.newArrayList(expected);
List<Integer> elements = Lists.newArrayListWithCapacity(size);
while (!q.isEmpty()) {
- ASSERT.that(q).has().allFrom(contents);
+ ASSERT.that(q).hasContentsAnyOrder(contents.toArray(new Integer[0]));
Integer next = q.pollFirst();
contents.remove(next);
- ASSERT.that(q).has().allFrom(contents);
+ ASSERT.that(q).hasContentsAnyOrder(contents.toArray(new Integer[0]));
for (int i = 0; i <= size; i++) {
q.add(i);
contents.add(i);
- ASSERT.that(q).has().allFrom(contents);
+ ASSERT.that(q).hasContentsAnyOrder(contents.toArray(new Integer[0]));
q.add(next);
contents.add(next);
- ASSERT.that(q).has().allFrom(contents);
+ ASSERT.that(q).hasContentsAnyOrder(contents.toArray(new Integer[0]));
q.remove(i);
assertTrue(contents.remove(Integer.valueOf(i)));
- ASSERT.that(q).has().allFrom(contents);
+ ASSERT.that(q).hasContentsAnyOrder(contents.toArray(new Integer[0]));
assertEquals(next, q.poll());
contents.remove(next);
- ASSERT.that(q).has().allFrom(contents);
+ ASSERT.that(q).hasContentsAnyOrder(contents.toArray(new Integer[0]));
}
elements.add(next);
}
@@ -819,7 +786,7 @@ public class MinMaxPriorityQueueTest extends TestCase {
}
}
- public void testNullPointers() {
+ public void testNullPointers() throws Exception {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicConstructors(MinMaxPriorityQueue.class);
tester.testAllPublicStaticMethods(MinMaxPriorityQueue.class);