### Question:
HandlerLoader implements LoginListener { public void onLogin(Registry configSystemRegistry, LoginEvent loginEvent) { try { if (initializedTenants.contains(loginEvent.getTenantId())) { return; } initializedTenants.add(loginEvent.getTenantId()); PrivilegedCarbonContext.startTenantFlow(); try { PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(loginEvent.getTenantDomain()); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(loginEvent.getTenantId()); PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(loginEvent.getUsername()); CommonUtil.addDefaultHandlersIfNotAvailable(configSystemRegistry); } finally { PrivilegedCarbonContext.endTenantFlow(); } } catch (Exception e) { String msg = "Error in adding the default handlers"; log.error(msg, e); } }  void onLogin(Registry configSystemRegistry, LoginEvent loginEvent);  }### Answer:
@Test public void onLogin() throws Exception { CommonUtil.addHandler(configRegistry, handlerConfiguration); LoginEvent loginEvent = new LoginEvent(); loginEvent.setUsername("admin"); loginEvent.setTenantDomain("carbon.super"); loginEvent.setTenantId(-1234); HandlerLoader handlerLoader = new HandlerLoader(); handlerLoader.onLogin(configRegistry, loginEvent); String[] handlers = CommonUtil.getHandlerList(configRegistry); assertNotNull(handlers); assertEquals(1, handlers.length); assertEquals(handlerName, handlers[0]); CommonUtil.deleteHandler(configRegistry, handlerName); }