From 6507b09c7ff3a27474150fc96a715084d1bf78a8 Mon Sep 17 00:00:00 2001 From: Muhammad Hewedy Date: Sun, 3 Feb 2019 23:51:48 +0300 Subject: [PATCH 1/2] Fix use CompletableFuture in DeferredResultReturnValueHandlerTest See gh-22337 --- .../annotation/DeferredResultReturnValueHandlerTests.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/DeferredResultReturnValueHandlerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/DeferredResultReturnValueHandlerTests.java index 872498c6cf..397da63985 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/DeferredResultReturnValueHandlerTests.java +++ b/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 future = new SettableListenableFuture<>(); - testHandle(future, CompletableFuture.class, () -> future.set("foo"), "foo"); + CompletableFuture 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 future = new SettableListenableFuture<>(); + CompletableFuture future = new CompletableFuture<>(); IllegalStateException ex = new IllegalStateException(); - testHandle(future, CompletableFuture.class, () -> future.setException(ex), ex); + testHandle(future, CompletableFuture.class, () -> future.completeExceptionally(ex), ex); } From 7c62d7cfe2d2f7982752ed1c23762bad2ed19816 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 4 Feb 2019 10:31:31 +0100 Subject: [PATCH 2/2] Polish "Fix use CompletableFuture in DeferredResultReturnValueHandlerTest" Closes gh-22337 --- .../annotation/DeferredResultReturnValueHandlerTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/DeferredResultReturnValueHandlerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/DeferredResultReturnValueHandlerTests.java index 397da63985..8853f57429 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/DeferredResultReturnValueHandlerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/DeferredResultReturnValueHandlerTests.java @@ -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.