@Test
public void shouldHandleMBeanAttributeNotANumber() 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())).thenReturn("not a number");
    // when
    collectGaugeValues(gaugeConfig);
    collectGaugeValues(gaugeConfig);
    collectGaugeValues(gaugeConfig);
    collectGaugeValues(gaugeConfig);
    collectGaugeValues(gaugeConfig);
    // then
    verify(logger).warn("error accessing mbean attribute {} {}: {}", "xyz:aaa=bbb", "ccc",
            "MBean attribute value is not a valid number: \"not a number\"");
    verify(logger).warn("error accessing mbean attribute {} {}: {}", "xyz:aaa=bbb", "ddd",
            "MBean attribute value is not a valid number: \"not a number\"");
}