@Override
    public long read() {
        return gaugeSource.read();
    }
@Test
    public void whenCreatedForDynamicLongMetricWithProvidedValue() {
        SomeObject someObject = new SomeObject();
        someObject.longField = 42;
        metricsRegistry.registerDynamicMetricsProvider((descriptor, context) -> context
                .collect(descriptor.withPrefix("foo"), "longField", INFO, BYTES, 42));
        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());
    }