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

Comparing jsr166/src/test/tck/ForkJoinPoolTest.java (file contents):
Revision 1.8 by jsr166, Tue Aug 4 21:10:19 2009 UTC vs.
Revision 1.10 by jsr166, Sat Nov 21 10:25:05 2009 UTC

# Line 170 | Line 170 | public class ForkJoinPoolTest extends JS
170          try {
171              new ForkJoinPool(-1);
172              shouldThrow();
173 <        }
174 <        catch (IllegalArgumentException success) {}
173 >        } catch (IllegalArgumentException success) {}
174      }
175  
176      /**
# Line 181 | Line 180 | public class ForkJoinPoolTest extends JS
180          try {
181              new ForkJoinPool(1, null);
182              shouldThrow();
183 <        } catch (NullPointerException success) {
185 <        }
183 >        } catch (NullPointerException success) {}
184      }
185  
186  
# Line 606 | Line 604 | public class ForkJoinPoolTest extends JS
604              TrackedShortRunnable task = null;
605              Future<?> future = e.submit(task);
606              shouldThrow();
607 <        } catch (NullPointerException success) {
610 <        }
607 >        } catch (NullPointerException success) {}
608      }
609  
610  
# Line 620 | Line 617 | public class ForkJoinPoolTest extends JS
617              StringTask t = null;
618              Future<String> future = e.submit(t);
619              shouldThrow();
620 <        } catch (NullPointerException success) {
624 <        }
620 >        } catch (NullPointerException success) {}
621      }
622  
623  
# Line 665 | Line 661 | public class ForkJoinPoolTest extends JS
661                      return Boolean.TRUE;
662                  }}).get();
663              shouldThrow();
664 <        } catch (ExecutionException success) {
665 <        }
664 >        } catch (ExecutionException success) {}
665 >
666          joinPool(p);
667      }
668  
# Line 699 | Line 695 | public class ForkJoinPoolTest extends JS
695      }
696  
697      /**
698 <     * invokeAny(c) throws NullPointerException if c has null elements
698 >     * invokeAny(c) throws NullPointerException if c has a single null element
699       */
700      public void testInvokeAny3() throws Throwable {
701          ExecutorService e = new ForkJoinPool(1);
702          try {
703              ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
708            l.add(new StringTask());
704              l.add(null);
705              e.invokeAny(l);
706              shouldThrow();
# Line 716 | Line 711 | public class ForkJoinPoolTest extends JS
711      }
712  
713      /**
714 <     * invokeAny(c) throws ExecutionException if no task in c completes
714 >     * invokeAny(c) throws NullPointerException if c has null elements
715       */
716      public void testInvokeAny4() throws Throwable {
717          ExecutorService e = new ForkJoinPool(1);
718          try {
719              ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
720 +            l.add(new Callable<String>() {
721 +                public String call() {
722 +                    // The delay gives the pool a chance to notice
723 +                    // the null element.
724 +                    sleepTillInterrupted(SMALL_DELAY_MS);
725 +                    return "foo";
726 +                }});
727 +            l.add(null);
728 +            e.invokeAny(l);
729 +            shouldThrow();
730 +        } catch (NullPointerException success) {
731 +        } finally {
732 +            joinPool(e);
733 +        }
734 +    }
735 +
736 +    /**
737 +     * invokeAny(c) throws ExecutionException if no task in c completes
738 +     */
739 +    public void testInvokeAny5() throws Throwable {
740 +        ExecutorService e = new ForkJoinPool(1);
741 +        try {
742 +            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
743              l.add(new NPETask());
744              e.invokeAny(l);
745              shouldThrow();
# Line 734 | Line 752 | public class ForkJoinPoolTest extends JS
752      /**
753       * invokeAny(c) returns result of some task in c if at least one completes
754       */
755 <    public void testInvokeAny5() throws Throwable {
755 >    public void testInvokeAny6() throws Throwable {
756          ExecutorService e = new ForkJoinPool(1);
757          try {
758              ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines