Clean up after deprecation of AsyncResult

See gh-33809
This commit is contained in:
Sam Brannen
2024-12-15 15:53:33 +01:00
parent 8a8df90a46
commit bf80485cc3
2 changed files with 24 additions and 36 deletions

View File

@@ -82,17 +82,17 @@ class AsyncExecutionTests {
CompletableFuture<String> completableFuture = asyncTest.returnSomethingCompletable(20);
assertThat(completableFuture.get()).isEqualTo("20");
assertThatExceptionOfType(ExecutionException.class).isThrownBy(() ->
asyncTest.returnSomething(0).get())
.withCauseInstanceOf(IllegalArgumentException.class);
assertThatExceptionOfType(ExecutionException.class)
.isThrownBy(() -> asyncTest.returnSomething(0).get())
.withCauseInstanceOf(IllegalArgumentException.class);
assertThatExceptionOfType(ExecutionException.class).isThrownBy(() ->
asyncTest.returnSomething(-1).get())
.withCauseInstanceOf(IOException.class);
assertThatExceptionOfType(ExecutionException.class)
.isThrownBy(() -> asyncTest.returnSomething(-1).get())
.withCauseInstanceOf(IOException.class);
assertThatExceptionOfType(ExecutionException.class).isThrownBy(() ->
asyncTest.returnSomethingCompletable(0).get())
.withCauseInstanceOf(IllegalArgumentException.class);
assertThatExceptionOfType(ExecutionException.class)
.isThrownBy(() -> asyncTest.returnSomethingCompletable(0).get())
.withCauseInstanceOf(IllegalArgumentException.class);
}
@Test
@@ -165,13 +165,13 @@ class AsyncExecutionTests {
CompletableFuture<String> completableFuture = asyncTest.returnSomethingCompletable(20);
assertThat(completableFuture.get()).isEqualTo("20");
assertThatExceptionOfType(ExecutionException.class).isThrownBy(() ->
asyncTest.returnSomething(0).get())
.withCauseInstanceOf(IllegalArgumentException.class);
assertThatExceptionOfType(ExecutionException.class)
.isThrownBy(() -> asyncTest.returnSomething(0).get())
.withCauseInstanceOf(IllegalArgumentException.class);
assertThatExceptionOfType(ExecutionException.class).isThrownBy(() ->
asyncTest.returnSomethingCompletable(0).get())
.withCauseInstanceOf(IllegalArgumentException.class);
assertThatExceptionOfType(ExecutionException.class)
.isThrownBy(() -> asyncTest.returnSomethingCompletable(0).get())
.withCauseInstanceOf(IllegalArgumentException.class);
}
@Test
@@ -390,6 +390,7 @@ class AsyncExecutionTests {
}
@Async
@SuppressWarnings("deprecation")
public Future<String> returnSomething(int i) {
assertThat(Thread.currentThread().getName()).isNotEqualTo(originalThreadName);
if (i == 0) {
@@ -435,12 +436,14 @@ class AsyncExecutionTests {
}
@MyAsync
@SuppressWarnings("deprecation")
public Future<String> returnSomething(int i) {
assertThat(Thread.currentThread().getName()).isNotEqualTo(originalThreadName);
assertThat(Thread.currentThread().getName()).startsWith("e2-");
return new AsyncResult<>(Integer.toString(i));
}
@SuppressWarnings("deprecation")
public Future<String> returnSomething2(int i) {
assertThat(Thread.currentThread().getName()).isNotEqualTo(originalThreadName);
assertThat(Thread.currentThread().getName()).startsWith("e0-");
@@ -467,6 +470,7 @@ class AsyncExecutionTests {
assertThat(Thread.currentThread().getName()).isNotEqualTo(originalThreadName);
}
@SuppressWarnings("deprecation")
public Future<String> returnSomething(int i) {
assertThat(Thread.currentThread().getName()).isNotEqualTo(originalThreadName);
if (i == 0) {
@@ -507,6 +511,7 @@ class AsyncExecutionTests {
}
@Override
@SuppressWarnings("deprecation")
public Future<String> returnSomething(int i) {
assertThat(Thread.currentThread().getName()).isNotEqualTo(originalThreadName);
return new AsyncResult<>(Integer.toString(i));
@@ -531,6 +536,7 @@ class AsyncExecutionTests {
}
@Override
@SuppressWarnings("deprecation")
public Future<String> returnSomething(int i) {
assertThat(Thread.currentThread().getName()).isNotEqualTo(originalThreadName);
return new AsyncResult<>(Integer.toString(i));
@@ -542,6 +548,7 @@ class AsyncExecutionTests {
private final AsyncInterface proxy;
@SuppressWarnings("deprecation")
public DynamicAsyncInterfaceBean() {
ProxyFactory pf = new ProxyFactory(new HashMap<>());
DefaultIntroductionAdvisor advisor = new DefaultIntroductionAdvisor((MethodInterceptor) invocation -> {
@@ -598,6 +605,7 @@ class AsyncExecutionTests {
}
@Override
@SuppressWarnings("deprecation")
public Future<String> returnSomething(int i) {
assertThat(Thread.currentThread().getName()).isNotEqualTo(originalThreadName);
return new AsyncResult<>(Integer.toString(i));
@@ -609,6 +617,7 @@ class AsyncExecutionTests {
private final AsyncMethodsInterface proxy;
@SuppressWarnings("deprecation")
public DynamicAsyncMethodsInterfaceBean() {
ProxyFactory pf = new ProxyFactory(new HashMap<>());
DefaultIntroductionAdvisor advisor = new DefaultIntroductionAdvisor((MethodInterceptor) invocation -> {