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

Comparing jsr166/src/test/tck/DelayQueueTest.java (file contents):
Revision 1.69 by jsr166, Sun Feb 22 04:34:44 2015 UTC vs.
Revision 1.70 by jsr166, Sat Feb 28 19:59:23 2015 UTC

# Line 43 | Line 43 | public class DelayQueueTest extends JSR1
43                              new Generic().testSuite());
44      }
45  
46    private static final int NOCAP = Integer.MAX_VALUE;
47
46      /**
47       * A delayed implementation for testing.
48       * Most tests use Pseudodelays, where delays are all elapsed
# Line 131 | Line 129 | public class DelayQueueTest extends JSR1
129          for (int i = (n & 1); i < n; i += 2)
130              assertTrue(q.offer(new PDelay(i)));
131          assertFalse(q.isEmpty());
132 <        assertEquals(NOCAP, q.remainingCapacity());
132 >        assertEquals(Integer.MAX_VALUE, q.remainingCapacity());
133          assertEquals(n, q.size());
134          return q;
135      }
# Line 140 | Line 138 | public class DelayQueueTest extends JSR1
138       * A new queue has unbounded capacity
139       */
140      public void testConstructor1() {
141 <        assertEquals(NOCAP, new DelayQueue().remainingCapacity());
141 >        assertEquals(Integer.MAX_VALUE, new DelayQueue().remainingCapacity());
142      }
143  
144      /**
# Line 195 | Line 193 | public class DelayQueueTest extends JSR1
193      public void testEmpty() {
194          DelayQueue q = new DelayQueue();
195          assertTrue(q.isEmpty());
196 <        assertEquals(NOCAP, q.remainingCapacity());
196 >        assertEquals(Integer.MAX_VALUE, q.remainingCapacity());
197          q.add(new PDelay(1));
198          assertFalse(q.isEmpty());
199          q.add(new PDelay(2));
# Line 205 | Line 203 | public class DelayQueueTest extends JSR1
203      }
204  
205      /**
206 <     * remainingCapacity does not change when elements added or removed,
209 <     * but size does
206 >     * remainingCapacity() always returns Integer.MAX_VALUE
207       */
208      public void testRemainingCapacity() {
209 <        DelayQueue q = populatedQueue(SIZE);
209 >        BlockingQueue q = populatedQueue(SIZE);
210          for (int i = 0; i < SIZE; ++i) {
211 <            assertEquals(NOCAP, q.remainingCapacity());
211 >            assertEquals(Integer.MAX_VALUE, q.remainingCapacity());
212              assertEquals(SIZE-i, q.size());
213 <            q.remove();
213 >            assertTrue(q.remove() instanceof PDelay);
214          }
215          for (int i = 0; i < SIZE; ++i) {
216 <            assertEquals(NOCAP, q.remainingCapacity());
216 >            assertEquals(Integer.MAX_VALUE, q.remainingCapacity());
217              assertEquals(i, q.size());
218 <            q.add(new PDelay(i));
218 >            assertTrue(q.add(new PDelay(i)));
219          }
220      }
221  
# Line 509 | Line 506 | public class DelayQueueTest extends JSR1
506          q.clear();
507          assertTrue(q.isEmpty());
508          assertEquals(0, q.size());
509 <        assertEquals(NOCAP, q.remainingCapacity());
509 >        assertEquals(Integer.MAX_VALUE, q.remainingCapacity());
510          PDelay x = new PDelay(1);
511          q.add(x);
512          assertFalse(q.isEmpty());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines