public class MBeanExporterOperationsTests extends AbstractMBeanServerTests {
public void testRegisterManagedResourceWithUserSuppliedObjectName() throws Exception {
ObjectName objectName = ObjectNameManager.getInstance("spring:name=Foo");
JmxTestBean bean = new JmxTestBean();
bean.setName("Rob Harrop");
MBeanExporter exporter = new MBeanExporter();
exporter.setServer(getServer());
exporter.registerManagedResource(bean, objectName);
String name = (String) getServer().getAttribute(objectName, "Name");
assertEquals("Incorrect name on MBean", name, bean.getName());
}