### Question:
BundleReporter extends AbstractPollingReporter implements MetricProcessor<String>, AutoCloseable { @Override public void processGauge(MetricName name, Gauge<?> gauge, String x) throws IOException { final Object value = gauge.value(); final Class<?> klass = value.getClass(); if (klass == Integer.class || klass == Long.class) { Number asNumber = (Number) gauge.value(); sendMetricData(sanitizeName(name), create(asNumber.longValue()), "gauge", ""); } else if (klass == Float.class || klass == Double.class) { Number asNumber = (Number) gauge.value(); sendMetricData(sanitizeName(name), create(asNumber.doubleValue()), "gauge", ""); } else { sendMetricData(sanitizeName(name), create(gauge.value().toString()), "gauge", ""); } } @JsonCreator  BundleReporter(@JsonProperty("output") TaskDataOutput output,
                          @JsonProperty("name")   AutoField name,
                          @JsonProperty("value")  AutoField value,
                          @JsonProperty("group")  AutoField group,
                          @JsonProperty("units")  AutoField units,
                          @Time(TimeUnit.NANOSECONDS)
                          @JsonProperty("period") long period);  BundleReporter(TaskDataOutput output,
                          AutoField name,
                          AutoField value,
                          AutoField group,
                          AutoField units,
                          long period,
                          TimeUnit periodUnit,
                          MetricsRegistry metricsRegistry); void start(); @Override void close(); @Override void run(); @Override void processGauge(MetricName name, Gauge<?> gauge, String x); @Override void processCounter(MetricName name, Counter counter, String x); @Override void processMeter(MetricName name, Metered meter, String x); @Override void processHistogram(MetricName name, Histogram histogram, String x); @Override void processTimer(MetricName name, Timer timer, String x);  }### Answer:
@Test public void reportsStringGaugeValues() throws Exception { reporter.processGauge(name("gauge"), gauge("value"), null); verify(output).send(decode("name = t.test.gauge, value = value, group = gauge, units = \"\"")); }
@Test public void escapeSlashesInMetricNames() throws Exception { reporter.processGauge(name("gauge_with\\slashes"), gauge("value"), null); verify(output).send(decode("name = t.test.gauge_with_slashes, value = value, group = gauge, units = \"\"")); }
@Test public void reportsIntegerGaugeValues() throws Exception { reporter.processGauge(name("gauge"), gauge(1), null); verify(output).send(decode("name = t.test.gauge, value = 1, group = gauge, units = \"\"")); }
@Test public void reportsLongGaugeValues() throws Exception { reporter.processGauge(name("gauge"), gauge(1L), null); verify(output).send(decode("name = t.test.gauge, value = 1, group = gauge, units = \"\"")); }
@Test public void reportsDoubleGaugeValues() throws Exception { reporter.processGauge(name("gauge"), gauge(1.1), null); verify(output).send(decode("name = t.test.gauge, value = 1.1, group = gauge, units = \"\"")); }