### Question:
RPCQueueMessageHandlerAdapter implements MessageListener { @Override public void onMessage(final Message message) { final String replyPayload = messageHandler.handleMessage(message.getBody()); final String replyTo = message.getMessageProperties().getReplyTo(); if (StringUtils.isNoneBlank(replyTo)) { reply(replyTo, replyPayload, message.getMessageProperties().getCorrelationId()); } } RPCQueueMessageHandlerAdapter(final RPCQueueMessageHandler messageHandler, final RabbitOperations rabbitOperations); @Override void onMessage(final Message message);  }### Answer:
@Test public void onMessageWithoutReplyTo() { final MessageProperties props = new MessageProperties(); final byte[] payload = UUID.randomUUID().toString().getBytes(); final Message message = new Message(payload, props); expect(messageHandler.handleMessage(aryEq(payload))).andReturn("{\"id\":1}"); replayAll(); rpcQueueMessageHandlerAdapter.onMessage(message); verifyAll(); }
@Test public void onMessageWithReplyTo() { final MessageProperties props = new MessageProperties(); final String replyTo = UUID.randomUUID().toString(); props.setReplyTo(replyTo); final byte[] payload = UUID.randomUUID().toString().getBytes(); final Message message = new Message(payload, props); final String handleMessageResult = "{\"id\":1}"; expect(messageHandler.handleMessage(aryEq(payload))).andReturn(handleMessageResult); rabbitOperations.send(eq(replyTo), isA(Message.class)); expectLastCall().andAnswer(() -> { final Message replyToMessage = (Message) getCurrentArguments()[1]; assertThat(replyToMessage.getBody()).isEqualTo(handleMessageResult.getBytes()); return null; }); replayAll(); rpcQueueMessageHandlerAdapter.onMessage(message); verifyAll(); }