@Test
public void shouldHandleMBeanInstanceNotFoundBeforeLoggingDelay() throws Exception {

    // given
    GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder()
            .mbeanObjectName("xyz:aaa=bbb")
            .addMbeanAttributes(ImmutableMBeanAttribute.of("ccc", false))
            .addMbeanAttributes(ImmutableMBeanAttribute.of("ddd", false))
            .build();
    when(clock.currentTimeMillis()).thenReturn(59999L);
    when(lazyPlatformMBeanServer.getAttribute(any(ObjectName.class), anyString(),
            anyMBeanServerList())).thenThrow(InstanceNotFoundException.class);
    // when
    List<GaugeValue> gaugeValues =
            collectGaugeValues(gaugeConfig);
    // then
    assertThat(gaugeValues).isEmpty();
    verify(logger).debug(nullable(String.class), any(Exception.class));
}