@Override
    public long read() {
        return gaugeSource.read();
    }
@Test
    public void whenCreatedForDynamicLongMetricWithExtractedValue() {
        SomeObject someObject = new SomeObject();
        someObject.longField = 42;
        metricsRegistry.registerDynamicMetricsProvider(someObject);
        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());

        someObject.longField = 43;
        assertEquals(43, longGauge.read());
    }