@Test public void dropwizardInstalledIfPresent() { this.context = new AnnotationConfigApplicationContext( MetricsDropwizardAutoConfiguration.class, MetricRepositoryAutoConfiguration.class, AopAutoConfiguration.class); GaugeService gaugeService = this.context.getBean(GaugeService.class); assertThat(gaugeService).isNotNull(); gaugeService.submit("foo", 2.7); DropwizardMetricServices exporter = this.context .getBean(DropwizardMetricServices.class); assertThat(exporter).isEqualTo(gaugeService); MetricRegistry registry = this.context.getBean(MetricRegistry.class); @SuppressWarnings("unchecked") Gauge<Double> gauge = (Gauge<Double>) registry.getMetrics().get("gauge.foo"); assertThat(gauge.getValue()).isEqualTo(new Double(2.7)); }
@Test public void dropwizardInstalledIfPresent() { this.context = new AnnotationConfigApplicationContext( MetricsDropwizardAutoConfiguration.class, MetricRepositoryAutoConfiguration.class, AopAutoConfiguration.class); GaugeService gaugeService = this.context.getBean(GaugeService.class); assertNotNull(gaugeService); gaugeService.submit("foo", 2.7); DropwizardMetricServices exporter = this.context .getBean(DropwizardMetricServices.class); assertEquals(gaugeService, exporter); MetricRegistry registry = this.context.getBean(MetricRegistry.class); @SuppressWarnings("unchecked") Gauge<Double> gauge = (Gauge<Double>) registry.getMetrics().get("gauge.foo"); assertEquals(new Double(2.7), gauge.getValue()); }