JmsTracing { public TopicConnection topicConnection(TopicConnection connection) { if (connection instanceof XATopicConnection) { return xaTopicConnection((XATopicConnection) 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);  }
@Test public void topicConnection_wrapsInput() { assertThat(jmsTracing.topicConnection(mock(TopicConnection.class))) .isInstanceOf(TracingConnection.class); }
@Test public void topicConnection_doesntDoubleWrap() { TopicConnection wrapped = jmsTracing.topicConnection(mock(TopicConnection.class)); assertThat(jmsTracing.topicConnection(wrapped)) .isSameAs(wrapped); }
@Test public void topicConnection_wrapsXaInput() { abstract class Both implements XATopicConnection, TopicConnection { } assertThat(jmsTracing.topicConnection(mock(Both.class))) .isInstanceOf(XATopicConnection.class); }