@Test public void testAppendFailure() { appender.start(); // make sure the append method does not work appender.topicPublisher = null; ILoggingEvent le = createLoggingEvent(); for (int i = 1; i <= 3; i++) { appender.append(le); assertEquals(i, context.getStatusManager().getCount()); assertTrue(appender.isStarted()); } appender.append(le); assertEquals(4, context.getStatusManager().getCount()); assertFalse(appender.isStarted()); }
@Test public void testAppendOk() { appender.start(); ILoggingEvent le = createLoggingEvent(); appender.append(le); MockTopicPublisher tp = (MockTopicPublisher) appender.topicPublisher; assertEquals(1, tp.getMessageList().size()); ObjectMessage message = (ObjectMessage) tp.getMessageList().get(0); try { Serializable witness = pst.transform(le); assertEquals(witness, message.getObject()); } catch (Exception e) { fail(); } }