### Question:
SimpleLogListener implements LogListener, XmlConfigurable, Consumer<LogEventWriter> { public synchronized void close() { if (writer != null) { writer.close(); p = null; } if (p != null) { p.close(); p = null; } } SimpleLogListener();  SimpleLogListener(PrintStream p); synchronized void setPrintStream(PrintStream p); synchronized void close(); synchronized LogEvent log(LogEvent ev); @Override void accept(LogEventWriter writer); @Override void setConfiguration(Element e);  }### Answer:
@Test public void testClose() throws Throwable { SimpleLogListener simpleLogListener = new SimpleLogListener(new PrintStream(new ByteArrayOutputStream(), true)); simpleLogListener.close(); assertNull(simpleLogListener.p, "simpleLogListener.p"); }
@Test public void testClose1() throws Throwable { SimpleLogListener simpleLogListener = new SimpleLogListener(null); simpleLogListener.close(); assertNull(simpleLogListener.p, "simpleLogListener.p"); }