@Test
	public void testBadDynamic() throws Exception {
		MessageBus messageBus = getMessageBus();
		// Natively partitioned buses can specify a partitioning key on any output
		if (!getMessageBus().isCapable(Capability.NATIVE_PARTITIONING)) {
			Properties properties = new Properties();
			properties.setProperty(BusProperties.PARTITION_KEY_EXPRESSION, "'foo'");
			try {
				messageBus.bindDynamicProducer("queue:foo", properties);
				fail("Exception expected");
			} catch (MessageBusException mbe) {
				assertEquals("Failed to bind dynamic channel 'queue:foo' with properties {partitionKeyExpression='foo'}",
						mbe.getMessage());
				if (messageBus instanceof AbstractTestMessageBus) {
					messageBus = ((AbstractTestMessageBus) messageBus).getCoreMessageBus();
				}
				assertFalse(((MessageBusSupport) messageBus).getApplicationContext().containsBean("queue:foo"));
			}
		}
		else {
			try {
				Properties properties = new Properties();
				properties.setProperty(BusProperties.MAX_ATTEMPTS, "'foo'");
				messageBus.bindDynamicProducer("queue:foo", properties);
				fail("Exception expected");
			} catch (MessageBusException mbe) {
				assertEquals("Failed to bind dynamic channel 'queue:foo' with properties {maxAttempts='foo'}",
						mbe.getMessage());
				if (messageBus instanceof AbstractTestMessageBus) {
					messageBus = ((AbstractTestMessageBus) messageBus).getCoreMessageBus();
				}
				assertFalse(((MessageBusSupport) messageBus).getApplicationContext().containsBean("queue:foo"));
			}
		}
	}
@author Gary Russell
@author Ilayaperumal Gopinathan
@author David Turanski
spring-xd-dirt/src/test/java/org/springframework/xd/dirt/integration/bus/AbstractMessageBusTests.java