@Test public void testLogger() throws Exception { PrintWriter printWriter = createMock(PrintWriter.class); printWriter.println("qwe"); expectNew(PrintWriter.class, new Class[] { Writer.class }, EasyMock.anyObject()).andReturn(printWriter); replayAll(); Logger logger = new Logger(); logger.log("qwe"); verifyAll(); }
public Logger() { try { writer = new PrintWriter(new FileWriter("target/logger.log")); } catch (IOException e) { throw new IllegalStateException(e); } }
Logger { public Logger() { try { writer = new PrintWriter(new FileWriter("target/logger.log")); } catch (IOException e) { throw new IllegalStateException(e); } } }
Logger { public Logger() { try { writer = new PrintWriter(new FileWriter("target/logger.log")); } catch (IOException e) { throw new IllegalStateException(e); } } Logger(); }
Logger { public Logger() { try { writer = new PrintWriter(new FileWriter("target/logger.log")); } catch (IOException e) { throw new IllegalStateException(e); } } Logger(); void log(String message); }
Logger { public Logger() { try { writer = new PrintWriter(new FileWriter("target/logger.log")); } catch (IOException e) { throw new IllegalStateException(e); } } Logger(); void log(String message);  }