Skip to content

Commit ca7736d

Browse files
committed
Fix race condition in AsyncMessagingTemplateTests
1 parent 42b11d2 commit ca7736d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spring-integration-core/src/test/java/org/springframework/integration/core/AsyncMessagingTemplateTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
import static org.assertj.core.api.Assertions.assertThat;
4040
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
41+
import static org.awaitility.Awaitility.await;
4142

4243
/**
4344
* @author Mark Fisher
@@ -401,7 +402,7 @@ public void timeoutException() {
401402
}
402403

403404
@Test
404-
public void executionException() throws Throwable {
405+
public void executionException() {
405406
DirectChannel channel = new DirectChannel();
406407
channel.subscribe(new EchoHandler(-1));
407408
AsyncMessagingTemplate template = new AsyncMessagingTemplate();
@@ -427,7 +428,7 @@ public void cancellationException() throws Throwable {
427428
assertThatExceptionOfType(CancellationException.class)
428429
.isThrownBy(result::get);
429430

430-
assertThat(handler.interrupted).as("handler should have been interrupted").isTrue();
431+
await().until(() -> handler.interrupted);
431432
}
432433

433434

0 commit comments

Comments
 (0)