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.188 by jsr166, Wed Aug 16 17:18:34 2017 UTC vs.
Revision 1.194 by jsr166, Tue May 29 03:42:37 2018 UTC

# Line 41 | Line 41 | import java.util.function.Function;
41   import java.util.function.Predicate;
42   import java.util.function.Supplier;
43  
44 import junit.framework.AssertionFailedError;
44   import junit.framework.Test;
45   import junit.framework.TestSuite;
46  
# Line 292 | Line 291 | public class CompletableFutureTest exten
291          }
292  
293          f = new CompletableFuture<>();
294 <        f.completeExceptionally(ex = new CFException());
294 >        f.completeExceptionally(new CFException());
295          f.obtrudeValue(v1);
296          checkCompletedNormally(f, v1);
297          f.obtrudeException(ex = new CFException());
# Line 330 | Line 329 | public class CompletableFutureTest exten
329       * toString indicates current completion state
330       */
331      public void testToString_incomplete() {
332 <        CompletableFuture<String> f = new CompletableFuture<String>();
332 >        CompletableFuture<String> f = new CompletableFuture<>();
333          assertTrue(f.toString().matches(".*\\[.*Not completed.*\\]"));
334          if (testImplementationDetails)
335              assertEquals(identityString(f) + "[Not completed]",
# Line 338 | Line 337 | public class CompletableFutureTest exten
337      }
338  
339      public void testToString_normal() {
340 <        CompletableFuture<String> f = new CompletableFuture<String>();
340 >        CompletableFuture<String> f = new CompletableFuture<>();
341          assertTrue(f.complete("foo"));
342          assertTrue(f.toString().matches(".*\\[.*Completed normally.*\\]"));
343          if (testImplementationDetails)
# Line 347 | Line 346 | public class CompletableFutureTest exten
346      }
347  
348      public void testToString_exception() {
349 <        CompletableFuture<String> f = new CompletableFuture<String>();
349 >        CompletableFuture<String> f = new CompletableFuture<>();
350          assertTrue(f.completeExceptionally(new IndexOutOfBoundsException()));
351          assertTrue(f.toString().matches(".*\\[.*Completed exceptionally.*\\]"));
352          if (testImplementationDetails)
# Line 357 | Line 356 | public class CompletableFutureTest exten
356  
357      public void testToString_cancelled() {
358          for (boolean mayInterruptIfRunning : new boolean[] { true, false }) {
359 <            CompletableFuture<String> f = new CompletableFuture<String>();
359 >            CompletableFuture<String> f = new CompletableFuture<>();
360              assertTrue(f.cancel(mayInterruptIfRunning));
361              assertTrue(f.toString().matches(".*\\[.*Completed exceptionally.*\\]"));
362              if (testImplementationDetails)
# Line 4190 | Line 4189 | public class CompletableFutureTest exten
4189          static void assertZero(CompletableFuture<?> f) {
4190              try {
4191                  f.getNow(null);
4192 <                throw new AssertionFailedError("should throw");
4192 >                throw new AssertionError("should throw");
4193              } catch (CompletionException success) {
4194                  assertTrue(success.getCause() instanceof ZeroException);
4195              }
# Line 4389 | Line 4388 | public class CompletableFutureTest exten
4388              f.complete(null);
4389  
4390              f = new CompletableFuture<>();
4391 <            CompletableFuture.anyOf(new CompletableFuture<?>[] { f, incomplete });
4391 >            CompletableFuture.anyOf(f, incomplete);
4392              f.complete(null);
4393          }
4394  
# Line 4407 | Line 4406 | public class CompletableFutureTest exten
4406              f.complete(null);
4407  
4408              f = new CompletableFuture<>();
4409 <            CompletableFuture.anyOf(new CompletableFuture<?>[] { incomplete, f });
4409 >            CompletableFuture.anyOf(incomplete, f);
4410              f.complete(null);
4411          }
4412      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines