test/jdk/java/util/concurrent/tck/CompletableFutureTest.java
changeset 48843 21efc1774302
parent 48541 946e34c2dec9
child 50764 5637aca18f1d
equal deleted inserted replaced
48842:a5a2e4770524 48843:21efc1774302
    66 import java.util.function.Consumer;
    66 import java.util.function.Consumer;
    67 import java.util.function.Function;
    67 import java.util.function.Function;
    68 import java.util.function.Predicate;
    68 import java.util.function.Predicate;
    69 import java.util.function.Supplier;
    69 import java.util.function.Supplier;
    70 
    70 
    71 import junit.framework.AssertionFailedError;
       
    72 import junit.framework.Test;
    71 import junit.framework.Test;
    73 import junit.framework.TestSuite;
    72 import junit.framework.TestSuite;
    74 
    73 
    75 public class CompletableFutureTest extends JSR166TestCase {
    74 public class CompletableFutureTest extends JSR166TestCase {
    76 
    75 
   317             f.obtrudeException(ex = new CFException());
   316             f.obtrudeException(ex = new CFException());
   318             checkCompletedExceptionally(f, ex);
   317             checkCompletedExceptionally(f, ex);
   319         }
   318         }
   320 
   319 
   321         f = new CompletableFuture<>();
   320         f = new CompletableFuture<>();
   322         f.completeExceptionally(ex = new CFException());
   321         f.completeExceptionally(new CFException());
   323         f.obtrudeValue(v1);
   322         f.obtrudeValue(v1);
   324         checkCompletedNormally(f, v1);
   323         checkCompletedNormally(f, v1);
   325         f.obtrudeException(ex = new CFException());
   324         f.obtrudeException(ex = new CFException());
   326         checkCompletedExceptionally(f, ex);
   325         checkCompletedExceptionally(f, ex);
   327         f.completeExceptionally(new CFException());
   326         f.completeExceptionally(new CFException());
  4215         }
  4214         }
  4216 
  4215 
  4217         static void assertZero(CompletableFuture<?> f) {
  4216         static void assertZero(CompletableFuture<?> f) {
  4218             try {
  4217             try {
  4219                 f.getNow(null);
  4218                 f.getNow(null);
  4220                 throw new AssertionFailedError("should throw");
  4219                 throw new AssertionError("should throw");
  4221             } catch (CompletionException success) {
  4220             } catch (CompletionException success) {
  4222                 assertTrue(success.getCause() instanceof ZeroException);
  4221                 assertTrue(success.getCause() instanceof ZeroException);
  4223             }
  4222             }
  4224         }
  4223         }
  4225 
  4224