@Test
	public void resolveTopicChannel() {
		MessageChannel registered = resolver.resolveDestination("topic:bar");
		PublishSubscribeChannel[] testChannels = {
			new PublishSubscribeChannel(), new PublishSubscribeChannel(), new PublishSubscribeChannel()
		};
		final CountDownLatch latch = new CountDownLatch(testChannels.length);
		final List<Message<?>> received = new ArrayList<Message<?>>();
		for (PublishSubscribeChannel testChannel : testChannels) {
			testChannel.subscribe(new MessageHandler() {

				@Override
				public void handleMessage(Message<?> message) throws MessagingException {
					received.add(message);
					latch.countDown();
				}
			});
			bus.bindPubSubConsumer("topic:bar", testChannel, null);
		}
		assertEquals(0, received.size());
		registered.send(MessageBuilder.withPayload("hello").build());
		try {
			assertTrue("latch timed out", latch.await(1, TimeUnit.SECONDS));
		}
		catch (InterruptedException e) {
			Thread.currentThread().interrupt();
			fail("interrupted while awaiting latch");
		}
		assertEquals(3, received.size());
		assertEquals("hello", received.get(0).getPayload());
		assertEquals("hello", received.get(1).getPayload());
		assertEquals("hello", received.get(2).getPayload());
		context.close();
	}
@author Mark Fisher
@author Gary Russell
spring-xd-dirt/src/test/java/org/springframework/xd/dirt/integration/bus/MessageBusAwareChannelResolverTests.java