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.17 by jsr166, Sat Nov 21 02:33:20 2009 UTC vs.
Revision 1.18 by jsr166, Sat Nov 21 09:28:16 2009 UTC

# Line 328 | Line 328 | public class PriorityBlockingQueueTest e
328       */
329      public void testTimedOffer() throws InterruptedException {
330          final PriorityBlockingQueue q = new PriorityBlockingQueue(2);
331 <        Thread t = new Thread(new Runnable() {
332 <                public void run() {
333 <                    try {
334 <                        q.put(new Integer(0));
335 <                        q.put(new Integer(0));
336 <                        threadAssertTrue(q.offer(new Integer(0), SHORT_DELAY_MS, MILLISECONDS));
337 <                        threadAssertTrue(q.offer(new Integer(0), LONG_DELAY_MS, MILLISECONDS));
338 <                    } finally { }
339 <                }
340 <            });
331 >        Thread t = new Thread(new CheckedRunnable() {
332 >            public void realRun() {
333 >                q.put(new Integer(0));
334 >                q.put(new Integer(0));
335 >                threadAssertTrue(q.offer(new Integer(0), SHORT_DELAY_MS, MILLISECONDS));
336 >                threadAssertTrue(q.offer(new Integer(0), LONG_DELAY_MS, MILLISECONDS));
337 >            }});
338  
339          t.start();
340          Thread.sleep(SMALL_DELAY_MS);
# Line 433 | Line 430 | public class PriorityBlockingQueueTest e
430              public void realRun() throws InterruptedException {
431                  PriorityBlockingQueue q = populatedQueue(SIZE);
432                  for (int i = 0; i < SIZE; ++i) {
433 <                    threadAssertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, MILLISECONDS)).intValue());
433 >                    assertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, MILLISECONDS)).intValue());
434                  }
435                  try {
436 <                    q.poll(SMALL_DELAY_MS, MILLISECONDS);
437 <                    threadShouldThrow();
436 >                    q.poll(LONG_DELAY_MS, MILLISECONDS);
437 >                    shouldThrow();
438                  } catch (InterruptedException success) {}
439              }});
440  
# Line 455 | Line 452 | public class PriorityBlockingQueueTest e
452          final PriorityBlockingQueue q = new PriorityBlockingQueue(2);
453          Thread t = new Thread(new CheckedRunnable() {
454              public void realRun() throws InterruptedException {
455 <                threadAssertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS));
456 <                threadAssertEquals(0, q.poll(MEDIUM_DELAY_MS, MILLISECONDS));
455 >                assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS));
456 >                assertEquals(0, q.poll(MEDIUM_DELAY_MS, MILLISECONDS));
457                  try {
458                      q.poll(LONG_DELAY_MS, MILLISECONDS);
459                      threadShouldThrow();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines