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

# Line 183 | Line 183 | public class LinkedBlockingQueueTest ext
183              }
184              assertEquals(0, q.remainingCapacity());
185              q.add(new Integer(SIZE));
186 <        } catch (IllegalStateException success){
186 >        } catch (IllegalStateException success) {
187          }
188      }
189  
# Line 279 | Line 279 | public class LinkedBlockingQueueTest ext
279              q.put(null);
280              shouldThrow();
281          }
282 <        catch (NullPointerException success){
282 >        catch (NullPointerException success) {
283          }
284          catch (InterruptedException ie) {
285              unexpectedException();
# Line 319 | Line 319 | public class LinkedBlockingQueueTest ext
319                          }
320                          q.put(new Integer(SIZE));
321                          threadShouldThrow();
322 <                    } catch (InterruptedException ie){
322 >                    } catch (InterruptedException ie) {
323                          threadAssertEquals(added, SIZE);
324                      }
325                  }});
# Line 352 | Line 352 | public class LinkedBlockingQueueTest ext
352                          q.put(new Object());
353                          ++added;
354                          threadShouldThrow();
355 <                    } catch (InterruptedException e){
355 >                    } catch (InterruptedException e) {
356                          threadAssertTrue(added >= 2);
357                      }
358                  }
# Line 363 | Line 363 | public class LinkedBlockingQueueTest ext
363              q.take();
364              t.interrupt();
365              t.join();
366 <        } catch (Exception e){
366 >        } catch (Exception e) {
367              unexpectedException();
368          }
369      }
# Line 381 | Line 381 | public class LinkedBlockingQueueTest ext
381                          threadAssertFalse(q.offer(new Object(), SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
382                          q.offer(new Object(), LONG_DELAY_MS, TimeUnit.MILLISECONDS);
383                          threadShouldThrow();
384 <                    } catch (InterruptedException success){}
384 >                    } catch (InterruptedException success) {}
385                  }
386              });
387  
# Line 390 | Line 390 | public class LinkedBlockingQueueTest ext
390              Thread.sleep(SMALL_DELAY_MS);
391              t.interrupt();
392              t.join();
393 <        } catch (Exception e){
393 >        } catch (Exception e) {
394              unexpectedException();
395          }
396      }
# Line 404 | Line 404 | public class LinkedBlockingQueueTest ext
404              for (int i = 0; i < SIZE; ++i) {
405                  assertEquals(i, ((Integer)q.take()).intValue());
406              }
407 <        } catch (InterruptedException e){
407 >        } catch (InterruptedException e) {
408              unexpectedException();
409          }
410      }
# Line 419 | Line 419 | public class LinkedBlockingQueueTest ext
419                      try {
420                          q.take();
421                          threadShouldThrow();
422 <                    } catch (InterruptedException success){ }
422 >                    } catch (InterruptedException success) { }
423                  }
424              });
425          try {
# Line 427 | Line 427 | public class LinkedBlockingQueueTest ext
427              Thread.sleep(SHORT_DELAY_MS);
428              t.interrupt();
429              t.join();
430 <        } catch (Exception e){
430 >        } catch (Exception e) {
431              unexpectedException();
432          }
433      }
# Line 445 | Line 445 | public class LinkedBlockingQueueTest ext
445                          }
446                          q.take();
447                          threadShouldThrow();
448 <                    } catch (InterruptedException success){
448 >                    } catch (InterruptedException success) {
449                      }
450                  }});
451          t.start();
# Line 481 | Line 481 | public class LinkedBlockingQueueTest ext
481                  assertEquals(i, ((Integer)q.poll(0, TimeUnit.MILLISECONDS)).intValue());
482              }
483              assertNull(q.poll(0, TimeUnit.MILLISECONDS));
484 <        } catch (InterruptedException e){
484 >        } catch (InterruptedException e) {
485              unexpectedException();
486          }
487      }
# Line 496 | Line 496 | public class LinkedBlockingQueueTest ext
496                  assertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)).intValue());
497              }
498              assertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
499 <        } catch (InterruptedException e){
499 >        } catch (InterruptedException e) {
500              unexpectedException();
501          }
502      }
# Line 514 | Line 514 | public class LinkedBlockingQueueTest ext
514                              threadAssertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS)).intValue());
515                          }
516                          threadAssertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
517 <                    } catch (InterruptedException success){
517 >                    } catch (InterruptedException success) {
518                      }
519                  }});
520          t.start();
# Line 550 | Line 550 | public class LinkedBlockingQueueTest ext
550              assertTrue(q.offer(zero, SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
551              t.interrupt();
552              t.join();
553 <        } catch (Exception e){
553 >        } catch (Exception e) {
554              unexpectedException();
555          }
556      }
# Line 596 | Line 596 | public class LinkedBlockingQueueTest ext
596          try {
597              q.remove();
598              shouldThrow();
599 <        } catch (NoSuchElementException success){
599 >        } catch (NoSuchElementException success) {
600          }
601      }
602  
# Line 627 | Line 627 | public class LinkedBlockingQueueTest ext
627              assertTrue(q.remove(new Integer(2)));
628              assertTrue(q.add(new Integer(3)));
629              assertTrue(q.take() != null);
630 <        } catch (Exception e){
630 >        } catch (Exception e) {
631              unexpectedException();
632          }
633      }
# Line 718 | Line 718 | public class LinkedBlockingQueueTest ext
718          try {
719          for (int i = 0; i < o.length; i++)
720              assertEquals(o[i], q.take());
721 <        } catch (InterruptedException e){
721 >        } catch (InterruptedException e) {
722              unexpectedException();
723          }
724      }
# Line 733 | Line 733 | public class LinkedBlockingQueueTest ext
733          try {
734              for (int i = 0; i < ints.length; i++)
735                  assertEquals(ints[i], q.take());
736 <        } catch (InterruptedException e){
736 >        } catch (InterruptedException e) {
737              unexpectedException();
738          }
739      }
# Line 746 | Line 746 | public class LinkedBlockingQueueTest ext
746              LinkedBlockingQueue q = populatedQueue(SIZE);
747              Object o[] = q.toArray(null);
748              shouldThrow();
749 <        } catch (NullPointerException success){}
749 >        } catch (NullPointerException success) {}
750      }
751  
752      /**
# Line 757 | Line 757 | public class LinkedBlockingQueueTest ext
757              LinkedBlockingQueue q = populatedQueue(SIZE);
758              Object o[] = q.toArray(new String[10] );
759              shouldThrow();
760 <        } catch (ArrayStoreException  success){}
760 >        } catch (ArrayStoreException  success) {}
761      }
762  
763  
# Line 768 | Line 768 | public class LinkedBlockingQueueTest ext
768          LinkedBlockingQueue q = populatedQueue(SIZE);
769          Iterator it = q.iterator();
770          try {
771 <            while (it.hasNext()){
771 >            while (it.hasNext()) {
772                  assertEquals(it.next(), q.take());
773              }
774 <        } catch (InterruptedException e){
774 >        } catch (InterruptedException e) {
775              unexpectedException();
776          }
777      }
# Line 934 | Line 934 | public class LinkedBlockingQueueTest ext
934              assertEquals(q.size(), r.size());
935              while (!q.isEmpty())
936                  assertEquals(q.remove(), r.remove());
937 <        } catch (Exception e){
937 >        } catch (Exception e) {
938              unexpectedException();
939          }
940      }
# Line 996 | Line 996 | public class LinkedBlockingQueueTest ext
996                  public void run() {
997                      try {
998                          q.put(new Integer(SIZE+1));
999 <                    } catch (InterruptedException ie){
999 >                    } catch (InterruptedException ie) {
1000                          threadUnexpectedException();
1001                      }
1002                  }
# Line 1010 | Line 1010 | public class LinkedBlockingQueueTest ext
1010                  assertEquals(l.get(i), new Integer(i));
1011              t.join();
1012              assertTrue(q.size() + l.size() >= SIZE);
1013 <        } catch (Exception e){
1013 >        } catch (Exception e) {
1014              unexpectedException();
1015          }
1016      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines