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.13 by jsr166, Mon Nov 16 04:57:09 2009 UTC vs.
Revision 1.14 by jsr166, Mon Nov 16 05:30:07 2009 UTC

# Line 193 | Line 193 | public class ArrayBlockingQueueTest exte
193              }
194              assertEquals(0, q.remainingCapacity());
195              q.add(new Integer(SIZE));
196 <        } catch (IllegalStateException success){
196 >        } catch (IllegalStateException success) {
197          }
198      }
199  
# Line 290 | Line 290 | public class ArrayBlockingQueueTest exte
290              q.put(null);
291              shouldThrow();
292          }
293 <        catch (NullPointerException success){
293 >        catch (NullPointerException success) {
294          }
295          catch (InterruptedException ie) {
296              unexpectedException();
# Line 330 | Line 330 | public class ArrayBlockingQueueTest exte
330                          }
331                          q.put(new Integer(SIZE));
332                          threadShouldThrow();
333 <                    } catch (InterruptedException ie){
333 >                    } catch (InterruptedException ie) {
334                          threadAssertEquals(added, SIZE);
335                      }
336                  }});
# Line 363 | Line 363 | public class ArrayBlockingQueueTest exte
363                          q.put(new Object());
364                          ++added;
365                          threadShouldThrow();
366 <                    } catch (InterruptedException e){
366 >                    } catch (InterruptedException e) {
367                          threadAssertTrue(added >= 2);
368                      }
369                  }
# Line 374 | Line 374 | public class ArrayBlockingQueueTest exte
374              q.take();
375              t.interrupt();
376              t.join();
377 <        } catch (Exception e){
377 >        } catch (Exception e) {
378              unexpectedException();
379          }
380      }
# Line 392 | Line 392 | public class ArrayBlockingQueueTest exte
392                          threadAssertFalse(q.offer(new Object(), SHORT_DELAY_MS/2, TimeUnit.MILLISECONDS));
393                          q.offer(new Object(), LONG_DELAY_MS, TimeUnit.MILLISECONDS);
394                          threadShouldThrow();
395 <                    } catch (InterruptedException success){}
395 >                    } catch (InterruptedException success) {}
396                  }
397              });
398  
# Line 401 | Line 401 | public class ArrayBlockingQueueTest exte
401              Thread.sleep(SHORT_DELAY_MS);
402              t.interrupt();
403              t.join();
404 <        } catch (Exception e){
404 >        } catch (Exception e) {
405              unexpectedException();
406          }
407      }
# Line 415 | Line 415 | public class ArrayBlockingQueueTest exte
415              for (int i = 0; i < SIZE; ++i) {
416                  assertEquals(i, ((Integer)q.take()).intValue());
417              }
418 <        } catch (InterruptedException e){
418 >        } catch (InterruptedException e) {
419              unexpectedException();
420          }
421      }
# Line 430 | Line 430 | public class ArrayBlockingQueueTest exte
430                      try {
431                          q.take();
432                          threadShouldThrow();
433 <                    } catch (InterruptedException success){ }
433 >                    } catch (InterruptedException success) { }
434                  }
435              });
436          try {
# Line 438 | Line 438 | public class ArrayBlockingQueueTest exte
438              Thread.sleep(SHORT_DELAY_MS);
439              t.interrupt();
440              t.join();
441 <        } catch (Exception e){
441 >        } catch (Exception e) {
442              unexpectedException();
443          }
444      }
# Line 456 | Line 456 | public class ArrayBlockingQueueTest exte
456                          }
457                          q.take();
458                          threadShouldThrow();
459 <                    } catch (InterruptedException success){
459 >                    } catch (InterruptedException success) {
460                      }
461                  }});
462          try {
# Line 492 | Line 492 | public class ArrayBlockingQueueTest exte
492                  assertEquals(i, ((Integer)q.poll(0, TimeUnit.MILLISECONDS)).intValue());
493              }
494              assertNull(q.poll(0, TimeUnit.MILLISECONDS));
495 <        } catch (InterruptedException e){
495 >        } catch (InterruptedException e) {
496              unexpectedException();
497          }
498      }
# Line 507 | Line 507 | public class ArrayBlockingQueueTest exte
507                  assertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)).intValue());
508              }
509              assertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
510 <        } catch (InterruptedException e){
510 >        } catch (InterruptedException e) {
511              unexpectedException();
512          }
513      }
# Line 525 | Line 525 | public class ArrayBlockingQueueTest exte
525                              threadAssertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)).intValue());
526                          }
527                          threadAssertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
528 <                    } catch (InterruptedException success){
528 >                    } catch (InterruptedException success) {
529                      }
530                  }});
531          try {
# Line 561 | Line 561 | public class ArrayBlockingQueueTest exte
561              assertTrue(q.offer(zero, SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
562              t.interrupt();
563              t.join();
564 <        } catch (Exception e){
564 >        } catch (Exception e) {
565              unexpectedException();
566          }
567      }
# Line 608 | Line 608 | public class ArrayBlockingQueueTest exte
608          try {
609              q.remove();
610              shouldThrow();
611 <        } catch (NoSuchElementException success){
611 >        } catch (NoSuchElementException success) {
612          }
613      }
614  
# Line 713 | Line 713 | public class ArrayBlockingQueueTest exte
713          try {
714          for (int i = 0; i < o.length; i++)
715              assertEquals(o[i], q.take());
716 <        } catch (InterruptedException e){
716 >        } catch (InterruptedException e) {
717              unexpectedException();
718          }
719      }
# Line 728 | Line 728 | public class ArrayBlockingQueueTest exte
728          try {
729              for (int i = 0; i < ints.length; i++)
730                  assertEquals(ints[i], q.take());
731 <        } catch (InterruptedException e){
731 >        } catch (InterruptedException e) {
732              unexpectedException();
733          }
734      }
# Line 741 | Line 741 | public class ArrayBlockingQueueTest exte
741              ArrayBlockingQueue q = populatedQueue(SIZE);
742              Object o[] = q.toArray(null);
743              shouldThrow();
744 <        } catch (NullPointerException success){}
744 >        } catch (NullPointerException success) {}
745      }
746  
747      /**
# Line 752 | Line 752 | public class ArrayBlockingQueueTest exte
752              ArrayBlockingQueue q = populatedQueue(SIZE);
753              Object o[] = q.toArray(new String[10] );
754              shouldThrow();
755 <        } catch (ArrayStoreException  success){}
755 >        } catch (ArrayStoreException  success) {}
756      }
757  
758  
# Line 763 | Line 763 | public class ArrayBlockingQueueTest exte
763          ArrayBlockingQueue q = populatedQueue(SIZE);
764          Iterator it = q.iterator();
765          try {
766 <            while (it.hasNext()){
766 >            while (it.hasNext()) {
767                  assertEquals(it.next(), q.take());
768              }
769 <        } catch (InterruptedException e){
769 >        } catch (InterruptedException e) {
770              unexpectedException();
771          }
772      }
# Line 931 | Line 931 | public class ArrayBlockingQueueTest exte
931              assertEquals(q.size(), r.size());
932              while (!q.isEmpty())
933                  assertEquals(q.remove(), r.remove());
934 <        } catch (Exception e){
934 >        } catch (Exception e) {
935              unexpectedException();
936          }
937      }
# Line 993 | Line 993 | public class ArrayBlockingQueueTest exte
993                  public void run() {
994                      try {
995                          q.put(new Integer(SIZE+1));
996 <                    } catch (InterruptedException ie){
996 >                    } catch (InterruptedException ie) {
997                          threadUnexpectedException();
998                      }
999                  }
# Line 1007 | Line 1007 | public class ArrayBlockingQueueTest exte
1007                  assertEquals(l.get(i), new Integer(i));
1008              t.join();
1009              assertTrue(q.size() + l.size() >= SIZE);
1010 <        } catch (Exception e){
1010 >        } catch (Exception e) {
1011              unexpectedException();
1012          }
1013      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines