public Object answer(InvocationOnMock invocation) throws Throwable {
Set<?> consumers = TestUtils.getPropertyValue(container, "consumers", Map.class).keySet();
for (Object consumer : consumers) {
ChannelProxy channel = TestUtils.getPropertyValue(consumer, "channel", ChannelProxy.class);
if (channel != null && channel.getTargetChannel() == mockChannel) {
Consumer rabbitConsumer = TestUtils.getPropertyValue(consumer, "consumer", Consumer.class);
if (cancel) {
rabbitConsumer.handleCancelOk((String) invocation.getArguments()[0]);
}
else {
rabbitConsumer.handleConsumeOk("foo");
}
latch.countDown();
}
}
return null;