Skip to content

Commit 47ad785

Browse files
committed
DirectMessageListenerContainerMockTests: Fix race
1 parent c582e1a commit 47ad785

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

spring-rabbit/src/test/java/org/springframework/amqp/rabbit/listener/DirectMessageListenerContainerMockTests.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,21 @@ public void testRemoveQueuesWhileNotConnected() throws Exception {
218218
anyMap(), any(Consumer.class))).willReturn("consumerTag");
219219

220220
final CountDownLatch latch1 = new CountDownLatch(2);
221-
final CountDownLatch latch3 = new CountDownLatch(3);
222221
final AtomicInteger qos = new AtomicInteger();
223222
willAnswer(i -> {
224223
qos.set(i.getArgument(0));
225224
latch1.countDown();
226-
latch3.countDown();
227225
return null;
228226
}).given(channel).basicQos(anyInt());
227+
228+
final CountDownLatch latch3 = new CountDownLatch(3);
229+
willAnswer(i -> {
230+
latch3.countDown();
231+
return "consumerTag";
232+
}).given(channel)
233+
.basicConsume(anyString(), anyBoolean(), anyString(), anyBoolean(), anyBoolean(),
234+
anyMap(), any(Consumer.class));
235+
229236
final CountDownLatch latch2 = new CountDownLatch(2);
230237
willAnswer(i -> {
231238
latch2.countDown();

0 commit comments

Comments
 (0)