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

Comparing jsr166/src/test/tck/ArrayBlockingQueueTest.java (file contents):
Revision 1.17 by jsr166, Sat Nov 21 07:10:56 2009 UTC vs.
Revision 1.21 by jsr166, Sat Nov 21 19:11:53 2009 UTC

# Line 44 | Line 44 | public class ArrayBlockingQueueTest exte
44      }
45  
46      /**
47 <     * Constructor throws IAE if  capacity argument nonpositive
47 >     * Constructor throws IAE if capacity argument nonpositive
48       */
49      public void testConstructor2() {
50          try {
# Line 104 | Line 104 | public class ArrayBlockingQueueTest exte
104       * Queue contains all elements of collection used to initialize
105       */
106      public void testConstructor7() {
107 <        try {
108 <            Integer[] ints = new Integer[SIZE];
109 <            for (int i = 0; i < SIZE; ++i)
110 <                ints[i] = new Integer(i);
111 <            ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE, true, Arrays.asList(ints));
112 <            for (int i = 0; i < SIZE; ++i)
113 <                assertEquals(ints[i], q.poll());
114 <        }
115 <        finally {}
107 >        Integer[] ints = new Integer[SIZE];
108 >        for (int i = 0; i < SIZE; ++i)
109 >            ints[i] = new Integer(i);
110 >        ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE, true, Arrays.asList(ints));
111 >        for (int i = 0; i < SIZE; ++i)
112 >            assertEquals(ints[i], q.poll());
113      }
114  
115      /**
# Line 308 | Line 305 | public class ArrayBlockingQueueTest exte
305                      }
306                      q.put(new Integer(SIZE));
307                      threadShouldThrow();
308 <                } catch (InterruptedException ie) {
308 >                } catch (InterruptedException success) {
309                      threadAssertEquals(added, SIZE);
310                  }}});
311  
# Line 336 | Line 333 | public class ArrayBlockingQueueTest exte
333                      q.put(new Object());
334                      ++added;
335                      threadShouldThrow();
336 <                } catch (InterruptedException e) {
336 >                } catch (InterruptedException success) {
337                      threadAssertTrue(added >= 2);
338                  }
339              }});
# Line 451 | Line 448 | public class ArrayBlockingQueueTest exte
448       * returning timeout status
449       */
450      public void testInterruptedTimedPoll() throws InterruptedException {
451 <        Thread t = new ThreadShouldThrow(InterruptedException.class) {
451 >        Thread t = new Thread(new CheckedRunnable() {
452              public void realRun() throws InterruptedException {
453                  ArrayBlockingQueue q = populatedQueue(SIZE);
454                  for (int i = 0; i < SIZE; ++i) {
455 <                    threadAssertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, MILLISECONDS)).intValue());
455 >                    assertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, MILLISECONDS)).intValue());
456                  }
457 <                q.poll(MEDIUM_DELAY_MS, MILLISECONDS);
458 <            }};
457 >                try {
458 >                    q.poll(SMALL_DELAY_MS, MILLISECONDS);
459 >                } catch (InterruptedException success) {}
460 >            }});
461  
462          t.start();
463 <        Thread.sleep(SMALL_DELAY_MS);
463 >        Thread.sleep(SHORT_DELAY_MS);
464          t.interrupt();
465          t.join();
466      }
# Line 662 | Line 661 | public class ArrayBlockingQueueTest exte
661              ArrayBlockingQueue q = populatedQueue(SIZE);
662              Object o[] = q.toArray(new String[10] );
663              shouldThrow();
664 <        } catch (ArrayStoreException  success) {}
664 >        } catch (ArrayStoreException success) {}
665      }
666  
667  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines