ElasticMetricsReporter implements Consumer<MetricsDump> { @Override public void accept(MetricsDump metricsDump) { accept(metricsDump, defaultExceptionHandler); } ElasticMetricsReporter(String indexName, String ... elasticServers);  ElasticMetricsReporter(String indexName, boolean createDailyIndices, String ... elasticServers);  ElasticMetricsReporter(String indexName, HttpHost ... elasticServers);  ElasticMetricsReporter(String indexName, boolean createDailyIndices, HttpHost ... elasticServers); @Override void accept(MetricsDump metricsDump); void accept(MetricsDump metricsDump, Consumer<Throwable> exceptionHandler); void accept(SerializableMetricsDump metricsDump); void accept(SerializableMetricsDump metricsDump, Consumer<Throwable> exceptionHandler); void startup(); void shutdown();  }
@Test void transmittingThrowsIfNotStartedYet() { Metrics metrics = new Metrics(); metrics.getCounter("test", "counter1"); metrics.getMeter("test", "meter1"); metrics.register(new MyMetric(), "test", "myMetric1"); MetricsDump dump = metrics.dump(); IllegalStateException ex = Assertions.assertThrows(IllegalStateException.class, () -> sut.accept(dump) ); assertThat(ex.getMessage(), is("not started yet")); }