ObjectName name = new ObjectName("groovy.test:role=TestMBean,type=Dummy");
mbeanServer.registerMBean(new Dummy(), name);
assertEquals("JMX value of Name", "James", mbeanServer.getAttribute(name, "Name"));
GroovyObject object = new GroovyMBean(mbeanServer, name);
Object value = object.getProperty("Name");
assertEquals("Name property", "James", value);
object.setProperty("Name", "Bob");
assertEquals("Name property", "Bob", object.getProperty("Name"));
// now let's look up the name via JMX to check
assertEquals("JMX value of Name", "Bob", mbeanServer.getAttribute(name, "Name"));
}