Source:
<code>private void sendAndReceiveFastGuts(boolean tempQueue) { try { this.template.execute(new ChannelCallback<Void>() { @Override public Void doInRabbit(Channel channel) throws Exception { channel.queueDeclarePassive(Address.AMQ_RABBITMQ_REPLY_TO); return null; } }); SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setConnectionFactory(this.template.getConnectionFactory()); container.setQueueNames(ROUTE); final AtomicReference<String> replyToWas = new AtomicReference<String>(); MessageListenerAdapter messageListenerAdapter = new MessageListenerAdapter(new Object() { @SuppressWarnings("unused") public Message handleMessage(Message message) { replyToWas.set(message.getMessageProperties().getReplyTo()); return new Message(new String(message.getBody()).toUpperCase().getBytes(), message.getMessageProperties()); } }); messageListenerAdapter.setMessageConverter(null); container.setMessageListener(messageListenerAdapter); container.start(); this.template.setQueue(ROUTE); this.template.setRoutingKey(ROUTE); Object result = this.template.convertSendAndReceive("foo"); container.stop(); assertEquals("FOO", result); <START> if (tempQueue) { <END> assertThat(replyToWas.get(), not(startsWith(Address.AMQ_RABBITMQ_REPLY_TO))); } else { assertThat(replyToWas.get(), startsWith(Address.AMQ_RABBITMQ_REPLY_TO)); } } catch (Exception e) { e.printStackTrace(); assertThat(e.getCause().getCause().getMessage(), containsString("404")); logger.info("Broker does not support fast replies; test skipped " + e.getMessage()); } }</code><technical_language>Assertion moved testSendAndReceiveNeverFastt test method a 2 tests test tempQueue = false tempQueue = true</technical_language>

Target:
private void sendAndReceiveFastGuts(boolean tempQueue) { try { this.template.execute(new ChannelCallback<Void>() { @Override public Void doInRabbit(Channel channel) throws Exception { channel.queueDeclarePassive(Address.AMQ_RABBITMQ_REPLY_TO); return null; } }); SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setConnectionFactory(this.template.getConnectionFactory()); container.setQueueNames(ROUTE); final AtomicReference<String> replyToWas = new AtomicReference<String>(); MessageListenerAdapter messageListenerAdapter = new MessageListenerAdapter(new Object() { @SuppressWarnings("unused") public Message handleMessage(Message message) { replyToWas.set(message.getMessageProperties().getReplyTo()); return new Message(new String(message.getBody()).toUpperCase().getBytes(), message.getMessageProperties()); } }); messageListenerAdapter.setMessageConverter(null); container.setMessageListener(messageListenerAdapter); container.start(); this.template.setQueue(ROUTE); this.template.setRoutingKey(ROUTE); Object result = this.template.convertSendAndReceive("foo"); container.stop(); assertEquals("FOO", result); if (tempQueue) { assertThat(replyToWas.get(), not(startsWith(Address.AMQ_RABBITMQ_REPLY_TO))); } else { assertThat(replyToWas.get(), startsWith(Address.AMQ_RABBITMQ_REPLY_TO)); } } catch (Exception e) { assertThat(e.getCause().getCause().getMessage(), containsString("404")); logger.info("Broker does not support fast replies; test skipped " + e.getMessage()); } }