### Question:
DropwizardApnsClientMetricsListener implements ApnsClientMetricsListener, MetricSet { @Override public void handleWriteFailure(final ApnsClient apnsClient, final long notificationId) { this.stopTimerForNotification(notificationId); this.writeFailures.mark(); } DropwizardApnsClientMetricsListener(); @Override void handleWriteFailure(final ApnsClient apnsClient, final long notificationId); @Override void handleNotificationSent(final ApnsClient apnsClient, final long notificationId); @Override void handleNotificationAccepted(final ApnsClient apnsClient, final long notificationId); @Override void handleNotificationRejected(final ApnsClient apnsClient, final long notificationId); @Override void handleConnectionAdded(final ApnsClient apnsClient); @Override void handleConnectionRemoved(final ApnsClient apnsClient); @Override void handleConnectionCreationFailed(final ApnsClient apnsClient); @Override Map<String, Metric> getMetrics(); static final String NOTIFICATION_TIMER_NAME; static final String WRITE_FAILURES_METER_NAME; static final String SENT_NOTIFICATIONS_METER_NAME; static final String ACCEPTED_NOTIFICATIONS_METER_NAME; static final String REJECTED_NOTIFICATIONS_METER_NAME; static final String OPEN_CONNECTIONS_GAUGE_NAME; static final String CONNECTION_FAILURES_METER_NAME; }### Answer:
@Test public void testHandleWriteFailure() { final Meter writeFailures = (Meter) this.listener.getMetrics().get(DropwizardApnsClientMetricsListener.WRITE_FAILURES_METER_NAME); assertEquals(0, writeFailures.getCount()); this.listener.handleWriteFailure(null, 1); assertEquals(1, writeFailures.getCount()); }