MessageParser { @Nullable static String channelKind(@Nullable Destination destination) { if (destination == null) return null; return isQueue(destination) ? "queue" : "topic"; }    }
@Test public void channelKind_queueAndTopic_null() { assertThat(MessageParser.channelKind(null)).isNull(); }
@Test public void channelKind_queueAndTopic_queueOnQueueName() throws JMSException { QueueAndTopic destination = mock(QueueAndTopic.class); when(destination.getQueueName()).thenReturn("queue-foo"); assertThat(MessageParser.channelKind(destination)) .isEqualTo("queue"); }
@Test public void channelKind_queueAndTopic_topicOnNoQueueName() throws JMSException { QueueAndTopic destination = mock(QueueAndTopic.class); when(destination.getTopicName()).thenReturn("topic-foo"); assertThat(MessageParser.channelKind(destination)) .isEqualTo("topic"); }