ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/PriorityQueueTest.java
(Generate patch)

Comparing jsr166/src/test/tck/PriorityQueueTest.java (file contents):
Revision 1.36 by jsr166, Sun May 24 01:42:14 2015 UTC vs.
Revision 1.40 by jsr166, Wed Jan 4 06:09:58 2017 UTC

# Line 22 | Line 22 | public class PriorityQueueTest extends J
22          main(suite(), args);
23      }
24      public static Test suite() {
25 <        return new TestSuite(PriorityQueueTest.class);
25 >        class Implementation implements CollectionImplementation {
26 >            public Class<?> klazz() { return PriorityQueue.class; }
27 >            public Collection emptyCollection() { return new PriorityQueue(); }
28 >            public Object makeElement(int i) { return i; }
29 >            public boolean isConcurrent() { return false; }
30 >            public boolean permitsNulls() { return false; }
31 >        }
32 >        return newTestSuite(PriorityQueueTest.class,
33 >                            CollectionTest.testSuite(new Implementation()));
34      }
35  
36      static class MyReverseComparator implements Comparator {
# Line 33 | Line 41 | public class PriorityQueueTest extends J
41  
42      /**
43       * Returns a new queue of given size containing consecutive
44 <     * Integers 0 ... n.
44 >     * Integers 0 ... n - 1.
45       */
46      private PriorityQueue<Integer> populatedQueue(int n) {
47 <        PriorityQueue<Integer> q = new PriorityQueue<Integer>(n);
47 >        PriorityQueue<Integer> q = new PriorityQueue<>(n);
48          assertTrue(q.isEmpty());
49          for (int i = n - 1; i >= 0; i -= 2)
50              assertTrue(q.offer(new Integer(i)));
# Line 44 | Line 52 | public class PriorityQueueTest extends J
52              assertTrue(q.offer(new Integer(i)));
53          assertFalse(q.isEmpty());
54          assertEquals(n, q.size());
55 +        assertEquals((Integer) 0, q.peek());
56          return q;
57      }
58  
# Line 191 | Line 200 | public class PriorityQueueTest extends J
200          PriorityQueue q = new PriorityQueue(1);
201          try {
202              q.offer(new Object());
194            q.offer(new Object());
203              shouldThrow();
204 <        } catch (ClassCastException success) {}
204 >        } catch (ClassCastException success) {
205 >            assertTrue(q.isEmpty());
206 >            assertEquals(0, q.size());
207 >            assertNull(q.poll());
208 >        }
209      }
210  
211      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines