@Override
    public long read() {
        return gaugeSource.read();
    }
@Test
    public void whenNotVisitedWithCachedValueReadsDefault() {
        DynamicMetricsProvider concreteProvider = (descriptor, context) ->
                context.collect(descriptor.withPrefix("foo"), "longField", INFO, COUNT, 42);
        metricsRegistry.registerDynamicMetricsProvider(concreteProvider);
        LongGaugeImpl longGauge = metricsRegistry.newLongGauge("foo.longField");

        // needed to collect dynamic metrics and update the gauge created from them
        metricsRegistry.collect(mock(MetricsCollector.class));
        assertEquals(42, longGauge.read());

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

        assertEquals(LongGaugeImpl.DEFAULT_VALUE, longGauge.read());
    }