### Question:
RotateLogListener extends SimpleLogListener implements Configurable, Destroyable { public synchronized LogEvent log (LogEvent ev) { if (msgCount++ > CHECK_INTERVAL) { checkSize(); msgCount = 0; } return super.log (ev); } RotateLogListener(); void setConfiguration(Configuration cfg); synchronized LogEvent log(LogEvent ev); void logRotate(); synchronized void logRotate(boolean isStartup); void destroy(); static final int CHECK_INTERVAL; static final long DEFAULT_MAXSIZE; }### Answer:
@Test @Disabled("test causes problems, closes stdout") public void testLog() throws Throwable { RotateLogListener dailyLogListener = new DailyLogListener(); dailyLogListener.close(); LogEvent ev = new LogEvent(); LogEvent result = dailyLogListener.log(ev); assertSame(ev, result, "result"); assertNull(((DailyLogListener) dailyLogListener).p, "(DailyLogListener) dailyLogListener.p"); assertEquals(1, ((DailyLogListener) dailyLogListener).msgCount, "(DailyLogListener) dailyLogListener.msgCount"); }
@Test @Disabled("test causes problems, closes stdout") public void testLog1() throws Throwable { RotateLogListener dailyLogListener = new DailyLogListener(); dailyLogListener.close(); LogEvent result = dailyLogListener.log(null); assertNull(result, "result"); assertNull(((DailyLogListener) dailyLogListener).p, "(DailyLogListener) dailyLogListener.p"); assertEquals(1, ((DailyLogListener) dailyLogListener).msgCount, "(DailyLogListener) dailyLogListener.msgCount"); }