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

Comparing jsr166/src/test/tck/ThreadPoolExecutorTest.java (file contents):
Revision 1.6 by dl, Thu Sep 25 11:02:41 2003 UTC vs.
Revision 1.7 by dl, Fri Sep 26 15:33:14 2003 UTC

# Line 17 | Line 17 | public class ThreadPoolExecutorTest exte
17          return new TestSuite(ThreadPoolExecutorTest.class);
18      }
19      
20    /**
21     * For use as ThreadFactory in constructors
22     */
23    static class MyThreadFactory implements ThreadFactory{
24        public Thread newThread(Runnable r){
25            return new Thread(r);
26        }  
27    }
20  
21      /**
30     * For use as RejectedExecutionHandler in constructors
31     */
32    static class MyREHandler implements RejectedExecutionHandler{
33        public void rejectedExecution(Runnable r, ThreadPoolExecutor executor){}
34    }
35
36    /**
22       *   execute successfully executes a runnable
23       */
24      public void testExecute() {
# Line 328 | Line 313 | public class ThreadPoolExecutorTest exte
313       */
314      public void testConstructor6() {
315          try {
316 <            new ThreadPoolExecutor(-1,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyThreadFactory());
316 >            new ThreadPoolExecutor(-1,1,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
317              shouldThrow();
318          } catch (IllegalArgumentException success){}
319      }
# Line 338 | Line 323 | public class ThreadPoolExecutorTest exte
323       */
324      public void testConstructor7() {
325          try {
326 <            new ThreadPoolExecutor(1,-1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyThreadFactory());
326 >            new ThreadPoolExecutor(1,-1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
327              shouldThrow();
328          }
329          catch (IllegalArgumentException success){}
# Line 349 | Line 334 | public class ThreadPoolExecutorTest exte
334       */
335      public void testConstructor8() {
336          try {
337 <            new ThreadPoolExecutor(1,0,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyThreadFactory());
337 >            new ThreadPoolExecutor(1,0,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
338              shouldThrow();
339          }
340          catch (IllegalArgumentException success){}
# Line 360 | Line 345 | public class ThreadPoolExecutorTest exte
345       */
346      public void testConstructor9() {
347          try {
348 <            new ThreadPoolExecutor(1,2,-1L,TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyThreadFactory());
348 >            new ThreadPoolExecutor(1,2,-1L,TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
349              shouldThrow();
350          }
351          catch (IllegalArgumentException success){}
# Line 371 | Line 356 | public class ThreadPoolExecutorTest exte
356       */
357      public void testConstructor10() {
358          try {
359 <            new ThreadPoolExecutor(2,1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyThreadFactory());
359 >            new ThreadPoolExecutor(2,1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory());
360              shouldThrow();
361          }
362          catch (IllegalArgumentException success){}
# Line 382 | Line 367 | public class ThreadPoolExecutorTest exte
367       */
368      public void testNullPointerException2() {
369          try {
370 <            new ThreadPoolExecutor(1,2,SHORT_DELAY_MS, TimeUnit.MILLISECONDS,null,new MyThreadFactory());
370 >            new ThreadPoolExecutor(1,2,SHORT_DELAY_MS, TimeUnit.MILLISECONDS,null,new SimpleThreadFactory());
371              shouldThrow();
372          }
373          catch (NullPointerException success){}  
# Line 406 | Line 391 | public class ThreadPoolExecutorTest exte
391       */
392      public void testConstructor11() {
393          try {
394 <            new ThreadPoolExecutor(-1,1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyREHandler());
394 >            new ThreadPoolExecutor(-1,1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
395              shouldThrow();
396          }
397          catch (IllegalArgumentException success){}
# Line 417 | Line 402 | public class ThreadPoolExecutorTest exte
402       */
403      public void testConstructor12() {
404          try {
405 <            new ThreadPoolExecutor(1,-1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyREHandler());
405 >            new ThreadPoolExecutor(1,-1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
406              shouldThrow();
407          }
408          catch (IllegalArgumentException success){}
# Line 428 | Line 413 | public class ThreadPoolExecutorTest exte
413       */
414      public void testConstructor13() {
415          try {
416 <            new ThreadPoolExecutor(1,0,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyREHandler());
416 >            new ThreadPoolExecutor(1,0,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
417              shouldThrow();
418          }
419          catch (IllegalArgumentException success){}
# Line 439 | Line 424 | public class ThreadPoolExecutorTest exte
424       */
425      public void testConstructor14() {
426          try {
427 <            new ThreadPoolExecutor(1,2,-1L,TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyREHandler());
427 >            new ThreadPoolExecutor(1,2,-1L,TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
428              shouldThrow();
429          }
430          catch (IllegalArgumentException success){}
# Line 450 | Line 435 | public class ThreadPoolExecutorTest exte
435       */
436      public void testConstructor15() {
437          try {
438 <            new ThreadPoolExecutor(2,1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyREHandler());
438 >            new ThreadPoolExecutor(2,1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler());
439              shouldThrow();
440          }
441          catch (IllegalArgumentException success){}
# Line 461 | Line 446 | public class ThreadPoolExecutorTest exte
446       */
447      public void testNullPointerException4() {
448          try {
449 <            new ThreadPoolExecutor(1,2,SHORT_DELAY_MS, TimeUnit.MILLISECONDS,null,new MyREHandler());
449 >            new ThreadPoolExecutor(1,2,SHORT_DELAY_MS, TimeUnit.MILLISECONDS,null,new NoOpREHandler());
450              shouldThrow();
451          }
452          catch (NullPointerException success){}  
# Line 485 | Line 470 | public class ThreadPoolExecutorTest exte
470       */
471      public void testConstructor16() {
472          try {
473 <            new ThreadPoolExecutor(-1,1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyThreadFactory(),new MyREHandler());
473 >            new ThreadPoolExecutor(-1,1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
474              shouldThrow();
475          }
476          catch (IllegalArgumentException success){}
# Line 496 | Line 481 | public class ThreadPoolExecutorTest exte
481       */
482      public void testConstructor17() {
483          try {
484 <            new ThreadPoolExecutor(1,-1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyThreadFactory(),new MyREHandler());
484 >            new ThreadPoolExecutor(1,-1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
485              shouldThrow();
486          }
487          catch (IllegalArgumentException success){}
# Line 507 | Line 492 | public class ThreadPoolExecutorTest exte
492       */
493      public void testConstructor18() {
494          try {
495 <            new ThreadPoolExecutor(1,0,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyThreadFactory(),new MyREHandler());
495 >            new ThreadPoolExecutor(1,0,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
496              shouldThrow();
497          }
498          catch (IllegalArgumentException success){}
# Line 518 | Line 503 | public class ThreadPoolExecutorTest exte
503       */
504      public void testConstructor19() {
505          try {
506 <            new ThreadPoolExecutor(1,2,-1L,TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyThreadFactory(),new MyREHandler());
506 >            new ThreadPoolExecutor(1,2,-1L,TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
507              shouldThrow();
508          }
509          catch (IllegalArgumentException success){}
# Line 529 | Line 514 | public class ThreadPoolExecutorTest exte
514       */
515      public void testConstructor20() {
516          try {
517 <            new ThreadPoolExecutor(2,1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new MyThreadFactory(),new MyREHandler());
517 >            new ThreadPoolExecutor(2,1,SHORT_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler());
518              shouldThrow();
519          }
520          catch (IllegalArgumentException success){}
# Line 540 | Line 525 | public class ThreadPoolExecutorTest exte
525       */
526      public void testNullPointerException6() {
527          try {
528 <            new ThreadPoolExecutor(1,2,SHORT_DELAY_MS, TimeUnit.MILLISECONDS,null,new MyThreadFactory(),new MyREHandler());
528 >            new ThreadPoolExecutor(1,2,SHORT_DELAY_MS, TimeUnit.MILLISECONDS,null,new SimpleThreadFactory(),new NoOpREHandler());
529              shouldThrow();
530          }
531          catch (NullPointerException success){}  
# Line 552 | Line 537 | public class ThreadPoolExecutorTest exte
537      public void testNullPointerException7() {
538          try {
539              RejectedExecutionHandler r = null;
540 <            new ThreadPoolExecutor(1,2,SHORT_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),new MyThreadFactory(),r);
540 >            new ThreadPoolExecutor(1,2,SHORT_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),r);
541              shouldThrow();
542          }
543          catch (NullPointerException success){}  
# Line 564 | Line 549 | public class ThreadPoolExecutorTest exte
549      public void testNullPointerException8() {
550          try {
551              ThreadFactory f = null;
552 <            new ThreadPoolExecutor(1,2,SHORT_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),f,new MyREHandler());
552 >            new ThreadPoolExecutor(1,2,SHORT_DELAY_MS, TimeUnit.MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),f,new NoOpREHandler());
553              shouldThrow();
554          }
555          catch (NullPointerException successdn8){}  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines