Fix use CompletableFuture in DeferredResultReturnValueHandlerTest

See gh-22337
master
Muhammad Hewedy 6 years ago committed by Stephane Nicoll
parent 4560dc2818
commit 6507b09c7f
  1. 8
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/DeferredResultReturnValueHandlerTests.java

@ -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 {
@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