CollectorRegistryProvider implements Provider<CollectorRegistry> { @Override public CollectorRegistry get() { final CollectorRegistry collectorRegistry = new CollectorRegistry(); collectorRegistry.register(dropwizardExports); return collectorRegistry; } @Inject  CollectorRegistryProvider(DropwizardExports dropwizardExports); @Override CollectorRegistry get();  }
@Test public void getReturnsCollectorRegistryWithDropwizardMetrics() throws Exception { final MetricRegistry registry = new MetricRegistry(); final Counter counter = registry.counter("test.counter"); counter.inc(42L); final DropwizardExports dropwizardExports = new DropwizardExports(registry); final CollectorRegistryProvider provider = new CollectorRegistryProvider(dropwizardExports); final CollectorRegistry collectorRegistry = provider.get(); assertEquals(new Double(42.0d), collectorRegistry.getSampleValue("test_counter")); }