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.23 by jsr166, Sun Nov 22 18:57:17 2009 UTC vs.
Revision 1.27 by jsr166, Wed Aug 25 01:44:48 2010 UTC

# Line 15 | Line 15 | import java.io.*;
15   public class LinkedBlockingQueueTest extends JSR166TestCase {
16  
17      public static void main(String[] args) {
18 <        junit.textui.TestRunner.run (suite());
18 >        junit.textui.TestRunner.run(suite());
19      }
20  
21      public static Test suite() {
# Line 214 | Line 214 | public class LinkedBlockingQueueTest ext
214              shouldThrow();
215          } catch (NullPointerException success) {}
216      }
217 +
218      /**
219       * addAll of a collection with any null elements throws NPE after
220       * possibly adding some elements
# Line 228 | Line 229 | public class LinkedBlockingQueueTest ext
229              shouldThrow();
230          } catch (NullPointerException success) {}
231      }
232 +
233      /**
234       * addAll throws ISE if not enough room
235       */
# Line 241 | Line 243 | public class LinkedBlockingQueueTest ext
243              shouldThrow();
244          } catch (IllegalStateException success) {}
245      }
246 +
247      /**
248       * Queue contains all elements, in traversal order, of successful addAll
249       */
# Line 686 | Line 689 | public class LinkedBlockingQueueTest ext
689      /**
690       * iterator.remove removes current element
691       */
692 <    public void testIteratorRemove () {
692 >    public void testIteratorRemove() {
693          final LinkedBlockingQueue q = new LinkedBlockingQueue(3);
694          q.add(two);
695          q.add(one);
# Line 697 | Line 700 | public class LinkedBlockingQueueTest ext
700          it.remove();
701  
702          it = q.iterator();
703 <        assertEquals(it.next(), one);
704 <        assertEquals(it.next(), three);
703 >        assertSame(it.next(), one);
704 >        assertSame(it.next(), three);
705          assertFalse(it.hasNext());
706      }
707  
# Line 722 | Line 725 | public class LinkedBlockingQueueTest ext
725      /**
726       * Modifications do not cause iterators to fail
727       */
728 <    public void testWeaklyConsistentIteration () {
728 >    public void testWeaklyConsistentIteration() {
729          final LinkedBlockingQueue q = new LinkedBlockingQueue(3);
730          q.add(one);
731          q.add(two);
# Line 757 | Line 760 | public class LinkedBlockingQueueTest ext
760          ExecutorService executor = Executors.newFixedThreadPool(2);
761          executor.execute(new CheckedRunnable() {
762              public void realRun() throws InterruptedException {
763 <                threadAssertFalse(q.offer(three));
764 <                threadAssertTrue(q.offer(three, MEDIUM_DELAY_MS, MILLISECONDS));
765 <                threadAssertEquals(0, q.remainingCapacity());
763 >                assertFalse(q.offer(three));
764 >                assertTrue(q.offer(three, MEDIUM_DELAY_MS, MILLISECONDS));
765 >                assertEquals(0, q.remainingCapacity());
766              }});
767  
768          executor.execute(new CheckedRunnable() {
769              public void realRun() throws InterruptedException {
770                  Thread.sleep(SMALL_DELAY_MS);
771 <                threadAssertEquals(one, q.take());
771 >                assertSame(one, q.take());
772              }});
773  
774          joinPool(executor);
# Line 779 | Line 782 | public class LinkedBlockingQueueTest ext
782          ExecutorService executor = Executors.newFixedThreadPool(2);
783          executor.execute(new CheckedRunnable() {
784              public void realRun() throws InterruptedException {
785 <                threadAssertNull(q.poll());
786 <                threadAssertTrue(null != q.poll(MEDIUM_DELAY_MS, MILLISECONDS));
787 <                threadAssertTrue(q.isEmpty());
785 >                assertNull(q.poll());
786 >                assertSame(one, q.poll(MEDIUM_DELAY_MS, MILLISECONDS));
787 >                assertTrue(q.isEmpty());
788              }});
789  
790          executor.execute(new CheckedRunnable() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines