@Test
public void shouldCaptureCounterGauge() throws Exception {

    // given
    GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder()
            .mbeanObjectName("test:aaa=bbb")
            .addMbeanAttributes(ImmutableMBeanAttribute.of("ccc", true))
            .build();
    when(lazyPlatformMBeanServer.getAttribute(any(ObjectName.class), anyString(),
            anyMBeanServerList())).thenReturn(555, 565);
    when(ticker.read()).thenReturn(SECONDS.toNanos(1), SECONDS.toNanos(3));
    // need to execute run() once in order to initialize internal priorRawCounterValues map
    gaugeCollector.run();
    // when
    collectGaugeValues(gaugeConfig);
    List<GaugeValue> gaugeValues =
            collectGaugeValues(gaugeConfig);
    // then
    assertThat(gaugeValues).hasSize(1);
    assertThat(gaugeValues.get(0).getValue()).isEqualTo(5); // 5 "units" per second
    assertThat(gaugeValues.get(0).getWeight()).isEqualTo(SECONDS.toNanos(2));
}