NoopMeterRegistry extends MeterRegistry { @Override protected <T> Gauge newGauge(Meter.Id id, @Nullable T obj, ToDoubleFunction<T> valueFunction) { return new NoopGauge(id); } NoopMeterRegistry(); private  NoopMeterRegistry(Clock clock);   }
@Test public void newGauge_createsNoopGauge() { Id expectedId = new Id("name", Tags.of("key", "value"), null, null, GAUGE); Gauge result = noopMeterRegistry.newGauge(expectedId, null, x -> 0.0); assertThat(result) .isInstanceOf(NoopGauge.class); assertThat(result.getId()) .isEqualTo(expectedId); }