### Question:
JmsTracing { public QueueConnection queueConnection(QueueConnection connection) { if (connection instanceof XAQueueConnection) { return xaQueueConnection((XAQueueConnection) connection); } return TracingConnection.create(connection, this); } JmsTracing(Builder builder); static JmsTracing create(Tracing tracing); static JmsTracing create(MessagingTracing messagingTracing); static Builder newBuilder(Tracing tracing); static Builder newBuilder(MessagingTracing messagingTracing); Connection connection(Connection connection); QueueConnection queueConnection(QueueConnection connection); TopicConnection topicConnection(TopicConnection connection); XAConnection xaConnection(XAConnection xaConnection); XAQueueConnection xaQueueConnection(XAQueueConnection connection); XATopicConnection xaTopicConnection(XATopicConnection connection); ConnectionFactory connectionFactory(ConnectionFactory connectionFactory); XAConnectionFactory xaConnectionFactory(XAConnectionFactory xaConnectionFactory); MessageListener messageListener(MessageListener messageListener, boolean addConsumerSpan); Span nextSpan(Message message);  }### Answer:
@Test public void queueConnection_wrapsInput() { assertThat(jmsTracing.queueConnection(mock(QueueConnection.class))) .isInstanceOf(TracingConnection.class); }
@Test public void queueConnection_doesntDoubleWrap() { QueueConnection wrapped = jmsTracing.queueConnection(mock(QueueConnection.class)); assertThat(jmsTracing.queueConnection(wrapped)) .isSameAs(wrapped); }
@Test public void queueConnection_wrapsXaInput() { abstract class Both implements XAQueueConnection, QueueConnection { } assertThat(jmsTracing.queueConnection(mock(Both.class))) .isInstanceOf(XAQueueConnection.class); }