### Question:
MBeanServerHelper { public static ObjectName register(MBeanServer server, ObjectName name, Object object) throws JBIException { if (server == null) { throw new JBIException("MBeanServer is null when registering MBean " + name); } try { doUnregister(server, name); LOGGER.debug("Registering MBean {}", name); ObjectInstance instance = doRegister(server, name, object); ObjectName result = instance.getObjectName(); LOGGER.debug("Successfully registered MBean {}", result); return result; } catch (JMException e) { throw new JBIException("Exception occured while registering JMX MBean " + name, e); } }  static ObjectName register(MBeanServer server, ObjectName name, Object object); static void unregister(MBeanServer server, ObjectName name);  }### Answer:
@Test(expected = JBIException.class) public void testRegisterNullServerThrowsJBIException() throws NotCompliantMBeanException, MalformedObjectNameException, JBIException { SampleMBean mbean = new SampleMBeanImpl(); Object object = new StandardMBean(mbean, SampleMBean.class); MBeanServerHelper.register(null, defaultObjectName, object); }