LoginModuleStats implements LoginModuleMBean, LoginModuleMonitor { @Override public void loginError() { loginErrors.mark(); } LoginModuleStats(StatisticsProvider statisticsProvider); @Override void loginError(); @Override long getLoginErrors(); @Override CompositeData getLoginErrorsHistory();  }
@Test public void testLoginError() throws Exception { ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); StatisticsProvider sp = new DefaultStatisticsProvider(executor); LoginModuleStats s = new LoginModuleStats(sp); s.loginError(); assertEquals(1, s.getLoginErrors()); assertNotNull(s.getLoginErrorsHistory()); }