JmxThrottlingConfiguration implements DynamicMBean { @Override public Object getAttribute(String attrName) throws AttributeNotFoundException, MBeanException, ReflectionException { Assert.notNull(attrName, "attrName must not be null"); String[] parts = StringUtils.split(attrName, ThrottleScope.THROTTLE_SEPARATOR); if (parts.length != 2) { throw new AttributeNotFoundException("attribute name is not in expected format: 'systemName . serviceName'"); } ThrottleScope throttleScope = new ThrottleScope(parts[0], parts[1]); ThrottleProps throttleProps = configuration.getProperties().get(throttleScope); if (throttleProps == null) { throw new AttributeNotFoundException("There is no throttling property for '" + throttleScope + "'"); } return throttleProps.toHumanString(); } @Autowired  JmxThrottlingConfiguration(AbstractThrottlingConfiguration configuration); @Override MBeanInfo getMBeanInfo(); @Override Object getAttribute(String attrName); @Override void setAttribute(Attribute attribute); @Override AttributeList getAttributes(String[] attrNames); @Override AttributeList setAttributes(AttributeList objects); @Override Object invoke(String actionName, Object[] params, String[] signature);  }
@Test public void testGetAttribute() throws MBeanException, AttributeNotFoundException, ReflectionException { Object attribute = jmx.getAttribute("crm.op2"); assertThat(attribute, notNullValue()); assertThat(attribute.toString(), is("10/70")); try { jmx.getAttribute("something"); fail("there is no attribute with specified key"); } catch (AttributeNotFoundException ex) { } }