XmppAppender extends AppenderBase<ILoggingEvent> { @Override public void stop() { try { this.xmpp.disconnect(); } catch(final Exception ignored) { System.err.println("Ignored exception:"); ignored.printStackTrace(System.err); } finally { super.stop(); } }  @Override void start(); @Override void stop(); void setServer(final String server); void setPort(final int port); void setUser(final String user); void setPassword(final String password); void setResource(final String resource); void setBotName(final String botName); void setChatName(final String chatName);  }
@Test public void testAppender() throws Exception { final XmppManager.Callback callback = mock(XmppManager.Callback.class); this.serverStart.await(); try { final XmppManager asserter = x(callback); final LoggerContext ctx = (LoggerContext)LoggerFactory.getILoggerFactory(); final XmppAppender appender = configureAppender(ctx); ctx.reset(); ctx.getLogger(getClass()).addAppender(appender); ctx.getLogger(getClass()).error("test"); Thread.sleep(1000); ctx.stop(); asserter.disconnect(); } finally { this.serverTermination.countDown(); } verify(callback, times(1)).invoke(any(Message.class)); }