Browse Source

Merge pull request #22337 from mhewedy

* pr/22337:
  Polish "Fix use CompletableFuture in DeferredResultReturnValueHandlerTest"
  Fix use CompletableFuture in DeferredResultReturnValueHandlerTest
pull/22392/head
Stephane Nicoll 6 years ago
parent
commit
99da6e9723
  1. 10
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/DeferredResultReturnValueHandlerTests.java

10
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/DeferredResultReturnValueHandlerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -96,8 +96,8 @@ public class DeferredResultReturnValueHandlerTests { @@ -96,8 +96,8 @@ public class DeferredResultReturnValueHandlerTests {
@Test
public void completableFuture() throws Exception {
SettableListenableFuture<String> future = new SettableListenableFuture<>();
testHandle(future, CompletableFuture.class, () -> future.set("foo"), "foo");
CompletableFuture<String> future = new CompletableFuture<>();
testHandle(future, CompletableFuture.class, () -> future.complete("foo"), "foo");
}
@Test
@ -115,9 +115,9 @@ public class DeferredResultReturnValueHandlerTests { @@ -115,9 +115,9 @@ public class DeferredResultReturnValueHandlerTests {
@Test
public void completableFutureWithError() throws Exception {
SettableListenableFuture<String> future = new SettableListenableFuture<>();
CompletableFuture<String> future = new CompletableFuture<>();
IllegalStateException ex = new IllegalStateException();
testHandle(future, CompletableFuture.class, () -> future.setException(ex), ex);
testHandle(future, CompletableFuture.class, () -> future.completeExceptionally(ex), ex);
}

Loading…
Cancel
Save