ApiServlet extends HttpServlet implements UserContext { public void registerMBeans() { registerMBeans(ManagementFactory.getPlatformMBeanServer()); } ApiServlet();  ApiServlet(Object controller); ApiControllerContext getContext(); @Override boolean isUserLoggedIn(ApiHttpExchange exchange); @Override boolean isUserInRole(ApiHttpExchange exchange, String role); void registerController(Object controller); void registerControllers(Object... controllers); void registerControllerList(List<Object> controllers); @Override void init(ServletConfig config); void registerMBeans(); void registerMBeans(MBeanServer mBeanServer); @Override TimerRegistry getTimerRegistry(); void setTimerRegistry(TimerRegistry timerRegistry);  }
@Test public void shouldCreateMBeans() throws MalformedObjectNameException { MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); servlet.registerMBeans(mbeanServer); assertThat(mbeanServer.queryMBeans(new ObjectName("org.actioncontroller:controller=" + ExampleController.class.getName() + ",action=one"), null)) .anySatisfy(a -> assertThat(a.getClassName()).contains("ApiControllerActionMXBeanAdaptor")); }