@Test public void requireThatFileIsReopened() throws IOException { FileLogTarget logTarget = new FileLogTarget(File.createTempFile("logfile", ".log")); OutputStream out1 = logTarget.open(); assertNotNull(out1); OutputStream out2 = logTarget.open(); assertNotNull(out2); assertNotEquals(out1, out2); }
public synchronized OutputStream open() { try { close(); fileOutputStream = new FileOutputStream(file, true); } catch (FileNotFoundException e) { throw new RuntimeException("Unable to open output stream", e); } return fileOutputStream; }
FileLogTarget implements LogTarget { public synchronized OutputStream open() { try { close(); fileOutputStream = new FileOutputStream(file, true); } catch (FileNotFoundException e) { throw new RuntimeException("Unable to open output stream", e); } return fileOutputStream; } }
FileLogTarget implements LogTarget { public synchronized OutputStream open() { try { close(); fileOutputStream = new FileOutputStream(file, true); } catch (FileNotFoundException e) { throw new RuntimeException("Unable to open output stream", e); } return fileOutputStream; } FileLogTarget(File target); }
FileLogTarget implements LogTarget { public synchronized OutputStream open() { try { close(); fileOutputStream = new FileOutputStream(file, true); } catch (FileNotFoundException e) { throw new RuntimeException("Unable to open output stream", e); } return fileOutputStream; } FileLogTarget(File target); synchronized OutputStream open(); synchronized void close(); @Override String toString(); }
FileLogTarget implements LogTarget { public synchronized OutputStream open() { try { close(); fileOutputStream = new FileOutputStream(file, true); } catch (FileNotFoundException e) { throw new RuntimeException("Unable to open output stream", e); } return fileOutputStream; } FileLogTarget(File target); synchronized OutputStream open(); synchronized void close(); @Override String toString();  }