Source:
public void testMessageChannelStatistics() throws Exception { requests.send(new GenericMessage<String>("foo")); String intermediateChannelName = "" + intermediate; assertThat(messageChannelsMonitor.getChannelSendCount(intermediateChannelName)).isEqualTo(1); double rate = messageChannelsMonitor.getChannelSendRate("" + requests).getMean(); assertThat(rate >= 0).as("No statistics for requests channel").isTrue(); rate = messageChannelsMonitor.getChannelSendRate(intermediateChannelName).getMean(); assertThat(rate >= 0).as("No statistics for intermediate channel").isTrue(); assertThat(intermediate.receive(100L)).isNotNull(); assertThat(messageChannelsMonitor.getChannelReceiveCount(intermediateChannelName)).isEqualTo(1); requests.send(new GenericMessage<String>("foo")); try { requests.send(new GenericMessage<String>("foo")); } catch (@SuppressWarnings("unused") MessageDeliveryException e) { } assertThat(messageChannelsMonitor.getChannelSendCount(intermediateChannelName)).isEqualTo(3); assertThat(messageChannelsMonitor.getChannelSendErrorCount(intermediateChannelName)).isEqualTo(1); assertThat(messageChannelsMonitor.getChannelMetrics(intermediateChannelName)).isSameAs(intermediate); org.springframework.integration.support.management.MessageHandlerMetrics handlerMetrics = messageChannelsMonitor .getHandlerMetrics("bridge"); assertThat(handlerMetrics.getHandleCount()).isEqualTo(3); assertThat(handlerMetrics.getErrorCount()).isEqualTo(1); assertThat(this.sourceChannel.receive(10000)).isNotNull(); assertThat(messageChannelsMonitor.getSourceMessageCount("source") > 0).isTrue(); assertThat(messageChannelsMonitor.getSourceMetrics("source").getMessageCount() > 0).isTrue(); }

Target:
public void testMessageChannelStatistics() throws Exception { requests.send(new GenericMessage<String>("foo")); String intermediateChannelName = "" + intermediate; assertThat(messageChannelsMonitor.getChannelSendCount(intermediateChannelName)).isEqualTo(1); double rate = messageChannelsMonitor.getChannelSendRate("" + requests).getMean(); assertThat(rate >= 0).as("No statistics for requests channel").isTrue(); rate = messageChannelsMonitor.getChannelSendRate(intermediateChannelName).getMean(); assertThat(rate >= 0).as("No statistics for intermediate channel").isTrue(); assertThat(intermediate.receive(100L)).isNotNull(); assertThat(messageChannelsMonitor.getChannelReceiveCount(intermediateChannelName)).isEqualTo(1); requests.send(new GenericMessage<String>("foo")); try { requests.send(new GenericMessage<String>("foo")); } catch (@SuppressWarnings("unused") MessageDeliveryException e) { } assertThat(messageChannelsMonitor.getChannelSendCount(intermediateChannelName)).isEqualTo(3); assertThat(messageChannelsMonitor.getChannelSendErrorCount(intermediateChannelName)).isEqualTo(1); assertThat(messageChannelsMonitor.getChannelMetrics(intermediateChannelName)).isSameAs(intermediate); BaseHandlerMetrics handlerMetrics = messageChannelsMonitor .getHandlerMetrics("bridge"); assertThat(handlerMetrics.handleCount()).isEqualTo(3); assertThat(handlerMetrics.errorCount()).isEqualTo(1); assertThat(this.sourceChannel.receive(10000)).isNotNull(); assertThat(messageChannelsMonitor.getSourceMessageCount("source") > 0).isTrue(); assertThat(messageChannelsMonitor.getSourceMetrics("source").getMessageCount() > 0).isTrue(); }