MetricsCollector { public void messageReceived(Object destination) { metrics.getMeter(identifierPrefix, "received", String.valueOf(destination)).mark(); totalNumberOfReceivedMessages.mark(); } MetricsCollector(Metrics metrics);   MetricsCollector(String identifier, Metrics metrics); void unparsableMessageReceived(Object destination); void messageReceived(Object destination); void subscriptionCreated(Object destination); void subscriptionDestroyed(Object destination);  }
@Test void messageReceivedCanBeInvokedWithNull() { sut.messageReceived(null); assertThat(metrics.getMeter("test", "messageReceiver", "received","total").getCount(), is(1L)); assertThat(metrics.getMeter("test", "messageReceiver", "received","null").getCount(), is(1L)); }
@Test void messageReceived() { sut.messageReceived("destination1"); assertThat(metrics.getMeter("test", "messageReceiver", "received","total").getCount(), is(1L)); assertThat(metrics.getMeter("test", "messageReceiver", "received","destination1").getCount(), is(1L)); }