### Question:
MetricsListener implements TableReplicationListener, CopierListener { @Override public void tableReplicationFailure(EventTableReplication tableReplication, String eventId, Throwable t) { sendMetrics(CompletionCode.FAILURE, tableReplication.getQualifiedReplicaName(), Metrics.NULL_VALUE); } @Autowired  MetricsListener(
      MetricSender metricSender,
      ScheduledReporterFactory runningMetricsReporterFactory,
      @Value("${metrics-reporter.period:1}") long metricsReporterPeriod,
      @Value("${metrics-reporter.time-unit:MINUTES}") TimeUnit metricsReporterTimeUnit); @Override void tableReplicationStart(EventTableReplication tableReplication, String eventId); @Override void tableReplicationSuccess(EventTableReplication tableReplication, String eventId); @Override void tableReplicationFailure(EventTableReplication tableReplication, String eventId, Throwable t); @Override void copierEnd(Metrics metrics); @Override void copierStart(String copierImplementation);  }### Answer:
@Test public void failureWithoutStartOrSuccessDoesntThrowException() { Throwable throwable = new Throwable("Test"); listener.tableReplicationFailure(tableReplication, "event-id", throwable); verify(metricSender).send(metricsCaptor.capture()); Map<String, Long> metrics = metricsCaptor.getValue(); assertThat(metrics.size(), is(3)); assertThat(metrics.get("target.replication_time"), is(-1L)); assertThat(metrics.get("target.completion_code"), is(-1L)); assertThat(metrics.get("target.bytes_replicated"), is(0L)); }