--- jsr166/src/test/tck/CompletableFutureTest.java 2017/08/16 17:18:34 1.188 +++ jsr166/src/test/tck/CompletableFutureTest.java 2018/05/29 03:42:37 1.194 @@ -41,7 +41,6 @@ import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; -import junit.framework.AssertionFailedError; import junit.framework.Test; import junit.framework.TestSuite; @@ -292,7 +291,7 @@ public class CompletableFutureTest exten } f = new CompletableFuture<>(); - f.completeExceptionally(ex = new CFException()); + f.completeExceptionally(new CFException()); f.obtrudeValue(v1); checkCompletedNormally(f, v1); f.obtrudeException(ex = new CFException()); @@ -330,7 +329,7 @@ public class CompletableFutureTest exten * toString indicates current completion state */ public void testToString_incomplete() { - CompletableFuture f = new CompletableFuture(); + CompletableFuture f = new CompletableFuture<>(); assertTrue(f.toString().matches(".*\\[.*Not completed.*\\]")); if (testImplementationDetails) assertEquals(identityString(f) + "[Not completed]", @@ -338,7 +337,7 @@ public class CompletableFutureTest exten } public void testToString_normal() { - CompletableFuture f = new CompletableFuture(); + CompletableFuture f = new CompletableFuture<>(); assertTrue(f.complete("foo")); assertTrue(f.toString().matches(".*\\[.*Completed normally.*\\]")); if (testImplementationDetails) @@ -347,7 +346,7 @@ public class CompletableFutureTest exten } public void testToString_exception() { - CompletableFuture f = new CompletableFuture(); + CompletableFuture f = new CompletableFuture<>(); assertTrue(f.completeExceptionally(new IndexOutOfBoundsException())); assertTrue(f.toString().matches(".*\\[.*Completed exceptionally.*\\]")); if (testImplementationDetails) @@ -357,7 +356,7 @@ public class CompletableFutureTest exten public void testToString_cancelled() { for (boolean mayInterruptIfRunning : new boolean[] { true, false }) { - CompletableFuture f = new CompletableFuture(); + CompletableFuture f = new CompletableFuture<>(); assertTrue(f.cancel(mayInterruptIfRunning)); assertTrue(f.toString().matches(".*\\[.*Completed exceptionally.*\\]")); if (testImplementationDetails) @@ -4190,7 +4189,7 @@ public class CompletableFutureTest exten static void assertZero(CompletableFuture f) { try { f.getNow(null); - throw new AssertionFailedError("should throw"); + throw new AssertionError("should throw"); } catch (CompletionException success) { assertTrue(success.getCause() instanceof ZeroException); } @@ -4389,7 +4388,7 @@ public class CompletableFutureTest exten f.complete(null); f = new CompletableFuture<>(); - CompletableFuture.anyOf(new CompletableFuture[] { f, incomplete }); + CompletableFuture.anyOf(f, incomplete); f.complete(null); } @@ -4407,7 +4406,7 @@ public class CompletableFutureTest exten f.complete(null); f = new CompletableFuture<>(); - CompletableFuture.anyOf(new CompletableFuture[] { incomplete, f }); + CompletableFuture.anyOf(incomplete, f); f.complete(null); } }