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

Comparing jsr166/src/test/tck/LinkedBlockingQueueTest.java (file contents):
Revision 1.15 by jsr166, Sat Nov 21 02:07:26 2009 UTC vs.
Revision 1.16 by jsr166, Sat Nov 21 02:33:20 2009 UTC

# Line 9 | Line 9
9   import junit.framework.*;
10   import java.util.*;
11   import java.util.concurrent.*;
12 + import static java.util.concurrent.TimeUnit.MILLISECONDS;
13   import java.io.*;
14  
15   public class LinkedBlockingQueueTest extends JSR166TestCase {
# Line 378 | Line 379 | public class LinkedBlockingQueueTest ext
379                      try {
380                          q.put(new Object());
381                          q.put(new Object());
382 <                        threadAssertFalse(q.offer(new Object(), SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
383 <                        q.offer(new Object(), LONG_DELAY_MS, TimeUnit.MILLISECONDS);
382 >                        threadAssertFalse(q.offer(new Object(), SHORT_DELAY_MS, MILLISECONDS));
383 >                        q.offer(new Object(), LONG_DELAY_MS, MILLISECONDS);
384                          threadShouldThrow();
385                      } catch (InterruptedException success) {}
386                  }
# Line 478 | Line 479 | public class LinkedBlockingQueueTest ext
479          try {
480              LinkedBlockingQueue q = populatedQueue(SIZE);
481              for (int i = 0; i < SIZE; ++i) {
482 <                assertEquals(i, ((Integer)q.poll(0, TimeUnit.MILLISECONDS)).intValue());
482 >                assertEquals(i, ((Integer)q.poll(0, MILLISECONDS)).intValue());
483              }
484 <            assertNull(q.poll(0, TimeUnit.MILLISECONDS));
484 >            assertNull(q.poll(0, MILLISECONDS));
485          } catch (InterruptedException e) {
486              unexpectedException();
487          }
# Line 493 | Line 494 | public class LinkedBlockingQueueTest ext
494          try {
495              LinkedBlockingQueue q = populatedQueue(SIZE);
496              for (int i = 0; i < SIZE; ++i) {
497 <                assertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)).intValue());
497 >                assertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, MILLISECONDS)).intValue());
498              }
499 <            assertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
499 >            assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS));
500          } catch (InterruptedException e) {
501              unexpectedException();
502          }
# Line 511 | Line 512 | public class LinkedBlockingQueueTest ext
512                      try {
513                          LinkedBlockingQueue q = populatedQueue(SIZE);
514                          for (int i = 0; i < SIZE; ++i) {
515 <                            threadAssertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)).intValue());
515 >                            threadAssertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, MILLISECONDS)).intValue());
516                          }
517 <                        threadAssertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
517 >                        threadAssertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS));
518                      } catch (InterruptedException success) {
519                      }
520                  }});
# Line 537 | Line 538 | public class LinkedBlockingQueueTest ext
538          Thread t = new Thread(new Runnable() {
539                  public void run() {
540                      try {
541 <                        threadAssertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
542 <                        q.poll(LONG_DELAY_MS, TimeUnit.MILLISECONDS);
543 <                        q.poll(LONG_DELAY_MS, TimeUnit.MILLISECONDS);
541 >                        threadAssertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS));
542 >                        q.poll(LONG_DELAY_MS, MILLISECONDS);
543 >                        q.poll(LONG_DELAY_MS, MILLISECONDS);
544                          threadShouldThrow();
545                      } catch (InterruptedException success) { }
546                  }
# Line 547 | Line 548 | public class LinkedBlockingQueueTest ext
548          try {
549              t.start();
550              Thread.sleep(SMALL_DELAY_MS);
551 <            assertTrue(q.offer(zero, SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
551 >            assertTrue(q.offer(zero, SHORT_DELAY_MS, MILLISECONDS));
552              t.interrupt();
553              t.join();
554          } catch (Exception e) {
# Line 858 | Line 859 | public class LinkedBlockingQueueTest ext
859              public void run() {
860                  threadAssertFalse(q.offer(three));
861                  try {
862 <                    threadAssertTrue(q.offer(three, MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS));
862 >                    threadAssertTrue(q.offer(three, MEDIUM_DELAY_MS, MILLISECONDS));
863                      threadAssertEquals(0, q.remainingCapacity());
864                  }
865                  catch (InterruptedException e) {
# Line 892 | Line 893 | public class LinkedBlockingQueueTest ext
893              public void run() {
894                  threadAssertNull(q.poll());
895                  try {
896 <                    threadAssertTrue(null != q.poll(MEDIUM_DELAY_MS, TimeUnit.MILLISECONDS));
896 >                    threadAssertTrue(null != q.poll(MEDIUM_DELAY_MS, MILLISECONDS));
897                      threadAssertTrue(q.isEmpty());
898                  }
899                  catch (InterruptedException e) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines