### Question:
FileLogger implements Logger { @Override public void log(String message) { try { ensureWriterInitialized(); writer.write(message + "\n"); writer.flush(); } catch (IOException e) { } } FileLogger(File file); @Override void log(String message);  }### Answer:
@Test public void writeMessage() throws Exception { testee.log("message"); testee.log("message"); assertEquals( "message\nmessage\n", readFileToString(FILE, Charset.defaultCharset()) ); }
@Test public void ignoreExceptions() throws Exception { FileLogger logger = new FileLogger(new File("/")); logger.log("message"); }