Skip to content

Commit 7617154

Browse files
committed
Add diagnostics to test failure
1 parent ce1bacf commit 7617154

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,16 +493,20 @@ public void testConsumerCancel() throws Exception {
493493
Log logger = spy(TestUtils.getPropertyValue(container, "logger", Log.class));
494494
doReturn(false).when(logger).isDebugEnabled();
495495
final CountDownLatch latch = new CountDownLatch(1);
496+
final List<String> messages = new ArrayList<>();
496497
doAnswer(invocation -> {
497498
String message = invocation.getArgument(0);
499+
messages.add(message);
498500
if (message.startsWith("Consumer raised exception")) {
499501
latch.countDown();
500502
}
501503
return invocation.callRealMethod();
502504
}).when(logger).warn(any());
503505
new DirectFieldAccessor(container).setPropertyValue("logger", logger);
504506
consumer.get().handleCancel("foo");
505-
assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue();
507+
assertThat(latch.await(10, TimeUnit.SECONDS))
508+
.as("Expected 'Consumer raised exception' but got %s", messages)
509+
.isTrue();
506510
container.stop();
507511
}
508512

0 commit comments

Comments
 (0)