MetricsCollector { public void subscriptionDestroyed (Object destination) { metrics.getCounter(identifierPrefix, "subscriptions", String.valueOf(destination)).dec(); totalNumberOfSubscriptions.dec(); } 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 subscriptionDestroyed() { sut.subscriptionDestroyed("destination3"); assertThat(metrics.getCounter("test", "messageReceiver", "subscriptions", "total").getCount(), is(-1L)); assertThat(metrics.getCounter("test", "messageReceiver", "subscriptions", "destination3").getCount(), is(-1L)); }
@Test void subscriptionDestroyedCanBeInvokedWithNull() { sut.subscriptionDestroyed(null); assertThat(metrics.getCounter("test", "messageReceiver", "subscriptions", "total").getCount(), is(-1L)); assertThat(metrics.getCounter("test", "messageReceiver", "subscriptions", "null").getCount(), is(-1L)); }