@Test
public void shouldHandleMBeanAttributeNotFound() throws Exception {

    // given
    GaugeConfig gaugeConfig = ImmutableGaugeConfig.builder()
            .mbeanObjectName("xyz:aaa=bbb")
            .addMbeanAttributes(ImmutableMBeanAttribute.of("ccc", false))
            .addMbeanAttributes(ImmutableMBeanAttribute.of("ddd", false))
            .build();
    when(lazyPlatformMBeanServer.getAttribute(any(ObjectName.class), anyString(),
            anyMBeanServerList())).thenThrow(AttributeNotFoundException.class);
    // when
    collectGaugeValues(gaugeConfig);
    collectGaugeValues(gaugeConfig);
    collectGaugeValues(gaugeConfig);
    collectGaugeValues(gaugeConfig);
    collectGaugeValues(gaugeConfig);
    // then
    verify(logger, times(10)).debug(nullable(String.class), any(Exception.class));
    verify(logger).warn("mbean attribute {} not found in {}", "ccc", "xyz:aaa=bbb");
    verify(logger).warn("mbean attribute {} not found in {}", "ddd", "xyz:aaa=bbb");
}