HtmlFormatter extends AbstractFormatter { public static String toString(final Datenpaket datenpaket) { StringWriter swriter = new StringWriter(); HtmlFormatter formatter = new HtmlFormatter(swriter); try { formatter.write(datenpaket); } catch (IOException shouldnothappen) { throw new ShitHappenedException("can't convert " + datenpaket + " to String", shouldnothappen); } IOUtils.closeQuietly(swriter); return swriter.toString(); } HtmlFormatter();  HtmlFormatter(final OutputStream ostream);  HtmlFormatter(final Writer writer); void setTitle(final String title); @Override void write(final Satz satz); static String toString(final Datenpaket datenpaket);  }
@Test public void testWriteDatenpaket() throws XMLStreamException, SAXException, IOException { Datenpaket datenpaket = new Datenpaket(); String htmlString = HtmlFormatter.toString(datenpaket); LOG.debug(datenpaket + " as HTML:\n" + htmlString); XmlFormatterTest.checkXML(htmlString); assertTrue("no <html> inside", htmlString.contains("<html")); assertTrue("no </html> inside", htmlString.contains("</html")); }