Skip to content

Commit ec10698

Browse files
committed
Fix race condition in test
1 parent de9f8d7 commit ec10698

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spring-integration-core/src/test/java/org/springframework/integration/configuration/EnableIntegrationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
import static org.hamcrest.CoreMatchers.not;
2222
import static org.hamcrest.Matchers.containsInAnyOrder;
2323
import static org.hamcrest.Matchers.containsString;
24+
import static org.hamcrest.Matchers.sameInstance;
2425
import static org.junit.Assert.assertEquals;
2526
import static org.junit.Assert.assertFalse;
2627
import static org.junit.Assert.assertNotNull;
27-
import static org.junit.Assert.assertNotSame;
2828
import static org.junit.Assert.assertNull;
2929
import static org.junit.Assert.assertSame;
3030
import static org.junit.Assert.assertThat;
@@ -462,7 +462,7 @@ public void testMessagingGateway() throws InterruptedException {
462462
assertThat(result, containsString("SpelExpression"));
463463
this.testGateway.sendAsync("foo");
464464
assertTrue(this.asyncAnnotationProcessLatch.await(1, TimeUnit.SECONDS));
465-
assertNotSame(Thread.currentThread(), this.asyncAnnotationProcessThread.get());
465+
assertThat(this.asyncAnnotationProcessThread.get(), not(sameInstance(Thread.currentThread())));
466466
}
467467

468468
@Test
@@ -1001,8 +1001,8 @@ public MessageHandler sendAsyncHandler() {
10011001

10021002
@Override
10031003
public void handleMessage(Message<?> message) throws MessagingException {
1004-
asyncAnnotationProcessLatch().countDown();
10051004
asyncAnnotationProcessThread().set(Thread.currentThread());
1005+
asyncAnnotationProcessLatch().countDown();
10061006
}
10071007

10081008
};

0 commit comments

Comments
 (0)