@Test public void buildMessageWithStandardMessage() throws Exception { Message<String> result = MessageBuilder.withPayload("Response") .setHeader("foo", "bar") .setHeader(AmqpHeaders.TYPE, "msg_type") .setHeader(AmqpHeaders.REPLY_TO, "reply") .build(); Channel session = mock(Channel.class); MessagingMessageListenerAdapter listener = getSimpleInstance("echo", Message.class); org.springframework.amqp.core.Message replyMessage = listener.buildMessage(session, result, null); assertNotNull("reply should never be null", replyMessage); assertEquals("Response", new String(replyMessage.getBody())); assertEquals("type header not copied", "msg_type", replyMessage.getMessageProperties().getType()); assertEquals("replyTo header not copied", "reply", replyMessage.getMessageProperties().getReplyTo()); assertEquals("custom header not copied", "bar", replyMessage.getMessageProperties().getHeaders().get("foo")); }