@Test
	public void testContentTypePreserved() throws IOException {
		Message<String> inbound = MessageBuilder.withPayload("{\"foo\":\"foo\"}")
				.copyHeaders(Collections.singletonMap(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.APPLICATION_JSON))
				.build();
		MessageValues convertedValues = messageBus.serializePayloadIfNecessary(
				inbound);

		Message<?> converted = convertedValues.toMessage();

		assertEquals(MimeTypeUtils.TEXT_PLAIN,
				contentTypeResolver.resolve(converted.getHeaders()));
		assertEquals(MimeTypeUtils.APPLICATION_JSON,
				converted.getHeaders().get(XdHeaders.XD_ORIGINAL_CONTENT_TYPE));
		MessageValues reconstructed = messageBus.deserializePayloadIfNecessary(converted);
		assertEquals("{\"foo\":\"foo\"}", reconstructed.getPayload());
		assertEquals(MimeTypeUtils.APPLICATION_JSON, reconstructed.get(MessageHeaders.CONTENT_TYPE));
	}
@author Gary Russell
@author David Turanski
spring-xd-dirt/src/test/java/org/springframework/xd/dirt/integration/bus/MessageBusSupportTests.java