diff --git a/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java b/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java index f9277e37906..d1715d7c653 100644 --- a/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java +++ b/spring-aspects/src/test/java/org/springframework/scheduling/aspectj/AnnotationAsyncExecutionAspectTests.java @@ -18,6 +18,7 @@ package org.springframework.scheduling.aspectj; import java.lang.reflect.Method; import java.util.concurrent.Callable; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @@ -140,8 +141,11 @@ public class AnnotationAsyncExecutionAspectTests { assertThat(defaultThread.get(), not(Thread.currentThread())); assertThat(defaultThread.get().getName(), not(startsWith("e1-"))); - Future e1Thread = obj.e1Work(); + ListenableFuture e1Thread = obj.e1Work(); assertThat(e1Thread.get().getName(), startsWith("e1-")); + + CompletableFuture e1OtherThread = obj.e1OtherWork(); + assertThat(e1OtherThread.get().getName(), startsWith("e1-")); } @Test @@ -278,6 +282,11 @@ public class AnnotationAsyncExecutionAspectTests { public ListenableFuture e1Work() { return new AsyncResult(Thread.currentThread()); } + + @Async("e1") + public CompletableFuture e1OtherWork() { + return CompletableFuture.completedFuture(Thread.currentThread()); + } }