@Override
    public double read() {
        return gaugeSource.read();
    }
@Test
    public void whenNotVisitedWithCachedValueReadsDefault() {
        DynamicMetricsProvider concreteProvider = (descriptor, context) ->
                context.collect(descriptor.withPrefix("foo"), "doubleField", INFO, COUNT, 42.42D);
        metricsRegistry.registerDynamicMetricsProvider(concreteProvider);
        DoubleGauge doubleGauge = metricsRegistry.newDoubleGauge("foo.doubleField");

        // needed to collect dynamic metrics and update the gauge created from them
        metricsRegistry.collect(mock(MetricsCollector.class));
        assertEquals(42.42D, doubleGauge.read(), 10E-6);

        // clears the cached metric source
        metricsRegistry.deregisterDynamicMetricsProvider(concreteProvider);
        metricsRegistry.collect(mock(MetricsCollector.class));

        assertEquals(DoubleGaugeImpl.DEFAULT_VALUE, doubleGauge.read(), 10E-6);
    }