NullFormatter extends AbstractFormatter { @Override public void write(Satz satz) throws IOException { satz.export(this.getWriter()); this.getWriter().flush(); } NullFormatter();  NullFormatter(final Writer writer); @Override void write(Satz satz);  }
@Test public void testWriteDatenpaketToStdout() throws IOException { Datenpaket datenpaket = new Datenpaket(); NullFormatter formatter = new NullFormatter(); formatter.write(datenpaket); }
@IntegrationTest @Test public void testWriteDatenpaketToFile() throws IOException { File output = File.createTempFile("output", ".txt"); Writer writer = new OutputStreamWriter(new FileOutputStream(output), "ISO-8859-1"); NullFormatter formatter = new NullFormatter(writer); Datenpaket datenpaket = new Datenpaket(); try { datenpaket.importFrom(MUSTERDATEI, "ISO-8859-1"); formatter.write(datenpaket); writer.close(); FileTester.assertContentEquals(MUSTERDATEI, output, "ISO-8859-1"); } finally { LOG.info(output + " was " + (output.delete() ? "successful" : "not") + " deleted"); } }