MetricsCollector { public void messageSent(Object destination) { metrics.getMeter(identifierPrefix, "sent", String.valueOf(destination)).mark(); totalNumberOfSentMessages.mark(); } MetricsCollector(String identifier, Metrics metrics); void messageSent(Object destination);  }
@Test void messageSentCanBeInvokedWithNull() { sut.messageSent(null); assertThat(metrics.getMeter("test", "messageSender", "sent", "total").getCount(), is(1L)); assertThat(metrics.getMeter("test", "messageSender", "sent", "null").getCount(), is(1L)); }
@Test void messageSending() { sut.messageSent("destination1"); assertThat(metrics.getMeter("test","messageSender", "sent", "total").getCount(), is(1L)); assertThat(metrics.getMeter("test", "messageSender", "sent", "destination1").getCount(), is(1L)); }