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

Comparing jsr166/src/test/tck/PriorityBlockingQueueTest.java (file contents):
Revision 1.58 by jsr166, Sat Jan 17 22:55:06 2015 UTC vs.
Revision 1.59 by jsr166, Sat Feb 28 19:59:23 2015 UTC

# Line 47 | Line 47 | public class PriorityBlockingQueueTest e
47                              new InitialCapacity().testSuite());
48      }
49  
50    private static final int NOCAP = Integer.MAX_VALUE;
51
50      /** Sample Comparator */
51      static class MyReverseComparator implements Comparator {
52          public int compare(Object x, Object y) {
# Line 69 | Line 67 | public class PriorityBlockingQueueTest e
67          for (int i = (n & 1); i < n; i += 2)
68              assertTrue(q.offer(new Integer(i)));
69          assertFalse(q.isEmpty());
70 <        assertEquals(NOCAP, q.remainingCapacity());
70 >        assertEquals(Integer.MAX_VALUE, q.remainingCapacity());
71          assertEquals(n, q.size());
72          return q;
73      }
# Line 78 | Line 76 | public class PriorityBlockingQueueTest e
76       * A new queue has unbounded capacity
77       */
78      public void testConstructor1() {
79 <        assertEquals(NOCAP, new PriorityBlockingQueue(SIZE).remainingCapacity());
79 >        assertEquals(Integer.MAX_VALUE,
80 >                     new PriorityBlockingQueue(SIZE).remainingCapacity());
81      }
82  
83      /**
# Line 159 | Line 158 | public class PriorityBlockingQueueTest e
158      public void testEmpty() {
159          PriorityBlockingQueue q = new PriorityBlockingQueue(2);
160          assertTrue(q.isEmpty());
161 <        assertEquals(NOCAP, q.remainingCapacity());
161 >        assertEquals(Integer.MAX_VALUE, q.remainingCapacity());
162          q.add(one);
163          assertFalse(q.isEmpty());
164          q.add(two);
# Line 169 | Line 168 | public class PriorityBlockingQueueTest e
168      }
169  
170      /**
171 <     * remainingCapacity does not change when elements added or removed,
173 <     * but size does
171 >     * remainingCapacity() always returns Integer.MAX_VALUE
172       */
173      public void testRemainingCapacity() {
174 <        PriorityBlockingQueue q = populatedQueue(SIZE);
174 >        BlockingQueue q = populatedQueue(SIZE);
175          for (int i = 0; i < SIZE; ++i) {
176 <            assertEquals(NOCAP, q.remainingCapacity());
177 <            assertEquals(SIZE-i, q.size());
178 <            q.remove();
176 >            assertEquals(Integer.MAX_VALUE, q.remainingCapacity());
177 >            assertEquals(SIZE - i, q.size());
178 >            assertEquals(i, q.remove());
179          }
180          for (int i = 0; i < SIZE; ++i) {
181 <            assertEquals(NOCAP, q.remainingCapacity());
181 >            assertEquals(Integer.MAX_VALUE, q.remainingCapacity());
182              assertEquals(i, q.size());
183 <            q.add(new Integer(i));
183 >            assertTrue(q.add(i));
184          }
185      }
186  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines