### Question:
JMXFactory { public static ObjectName createMBean(String className, String attributes) { log.info("Create the {} MBean within the MBeanServer", className); ObjectName objectName = null; try { StringBuilder objectNameStr = new StringBuilder(domain); objectNameStr.append(":type="); objectNameStr.append(className .substring(className.lastIndexOf(".") + 1)); objectNameStr.append(","); objectNameStr.append(attributes); log.info("ObjectName = {}", objectNameStr); objectName = new ObjectName(objectNameStr.toString()); if (!mbs.isRegistered(objectName)) { mbs.createMBean(className, objectName); } else { log.debug("MBean has already been created: {}", objectName); } } catch (Exception e) { log.error("Could not create the {} MBean. {}", className, e); } return objectName; }  static ObjectName createMBean(String className, String attributes); static ObjectName createObjectName(String... strings); static ObjectName createSimpleMBean(String className,
			String objectNameStr); static String getDefaultDomain(); static MBeanServer getMBeanServer(); @SuppressWarnings("unchecked") static boolean registerNewMBean(String className,
			Class interfaceClass); @SuppressWarnings("unchecked") static boolean registerNewMBean(String className,
			Class interfaceClass, ObjectName name); @SuppressWarnings("unchecked") static boolean registerNewMBean(String className,
			Class interfaceClass, String name); String getDomain(); void setDomain(String domain);  }### Answer:
@Test public void testCreateMBean() { ObjectName objectName = null; try { objectName = JMXFactory.createMBean( "org.red5.server.jmx.JMXFactoryTest", "test=1"); assertNotNull(objectName); objectName = JMXFactory.createMBean( "org.red5.server.jmx.JMXFactoryTest", "test=2"); assertNotNull(objectName); objectName = JMXFactory.createMBean( "org.red5.server.jmx.JMXFactoryTest", "test=1"); assertNotNull(objectName); } catch (Exception e) { fail("Exception occured"); } }