### Question:
StandardJmxSupport implements JmxSupport { @Override public void register(String objectName, Object instance) { try { this.mBeanServer.registerMBean(instance, new ObjectName(objectName)); } catch (JMException e) { throw new IllegalArgumentException(e); } } StandardJmxSupport();   StandardJmxSupport(MBeanServer mBeanServer); @Override void register(String objectName, Object instance); @Override void unregister(String objectName);  }### Answer:
@Test public void register() throws JMException { this.jmxSupport.register("domain:key=value", this.instance); verify(this.mBeanServer).registerMBean(this.instance, new ObjectName("domain:key=value")); }
@Test(expected = IllegalArgumentException.class) public void registerJMException() throws JMException { when(this.mBeanServer.registerMBean(eq(this.instance), any(ObjectName.class))).thenThrow(new InstanceAlreadyExistsException()); this.jmxSupport.register("domain:key=value", this.instance); }