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

Comparing jsr166/src/test/tck/CompletableFutureTest.java (file contents):
Revision 1.23 by jsr166, Tue Apr 9 07:50:55 2013 UTC vs.
Revision 1.24 by jsr166, Sun Apr 14 05:45:38 2013 UTC

# Line 2856 | Line 2856 | public class CompletableFutureTest exten
2856       * with the value null
2857       */
2858      public void testAllOf_empty() throws Exception {
2859 <        CompletableFuture<?> f = CompletableFuture.allOf();
2859 >        CompletableFuture<Void> f = CompletableFuture.allOf();
2860          checkCompletedNormally(f, null);
2861      }
2862  
# Line 2871 | Line 2871 | public class CompletableFutureTest exten
2871              CompletableFuture<Void> f = CompletableFuture.allOf(fs);
2872              for (int i = 0; i < k; ++i) {
2873                  checkIncomplete(f);
2874 +                checkIncomplete(CompletableFuture.allOf(fs));
2875                  fs[i].complete(one);
2876              }
2877              checkCompletedNormally(f, null);
2878 +            checkCompletedNormally(CompletableFuture.allOf(fs), null);
2879          }
2880      }
2881  
# Line 2881 | Line 2883 | public class CompletableFutureTest exten
2883       * anyOf(no component futures) returns an incomplete future
2884       */
2885      public void testAnyOf_empty() throws Exception {
2886 <        CompletableFuture<?> f = CompletableFuture.anyOf();
2886 >        CompletableFuture<Object> f = CompletableFuture.anyOf();
2887          checkIncomplete(f);
2888      }
2889  
2890      /**
2891       * anyOf returns a future completed when any components complete
2892       */
2893 <    public void testAnyOf() throws Exception {
2894 <        for (int k = 1; k < 20; ++k) {
2893 >    public void testAnyOf_normal() throws Exception {
2894 >        for (int k = 0; k < 10; ++k) {
2895              CompletableFuture[] fs = new CompletableFuture[k];
2896              for (int i = 0; i < k; ++i)
2897                  fs[i] = new CompletableFuture<>();
# Line 2898 | Line 2900 | public class CompletableFutureTest exten
2900              for (int i = 0; i < k; ++i) {
2901                  fs[i].complete(one);
2902                  checkCompletedNormally(f, one);
2903 +                checkCompletedNormally(CompletableFuture.anyOf(fs), one);
2904 +            }
2905 +        }
2906 +    }
2907 +
2908 +    /**
2909 +     * anyOf result completes exceptionally when any component does.
2910 +     */
2911 +    public void testAnyOf_exceptional() throws Exception {
2912 +        for (int k = 0; k < 10; ++k) {
2913 +            CompletableFuture[] fs = new CompletableFuture[k];
2914 +            for (int i = 0; i < k; ++i)
2915 +                fs[i] = new CompletableFuture<>();
2916 +            CompletableFuture<Object> f = CompletableFuture.anyOf(fs);
2917 +            checkIncomplete(f);
2918 +            for (int i = 0; i < k; ++i) {
2919 +                fs[i].completeExceptionally(new CFException());
2920 +                checkCompletedWithWrappedCFException(f);
2921 +                checkCompletedWithWrappedCFException(CompletableFuture.anyOf(fs));
2922              }
2923          }
2924      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines