DefaultDatenpaketService implements DatenpaketService { @Override public String format(URI uri, MimeType mimeType) throws IOException { Datenpaket datenpaket = new Datenpaket(); datenpaket.importFrom(uri); return format(datenpaket, mimeType); }  @Override List<Model> validate(URI uri); @Override List<Model> validate(String text); @Override String format(URI uri, MimeType mimeType); @Override String format(String text, MimeType mimeType); static List<Model> asModelList(Exception ex);  }
@Test public void testFormatUri() throws IOException { assertTrue(TEST_FILE + " does not exist", TEST_FILE.exists()); String html = service.format(TEST_FILE.toURI(), MimeTypeUtils.TEXT_HTML); assertThat(html, containsString("<html")); assertThat(html, containsString("</html>")); }
@Test public void testFormatText() throws IOException { String text = FileUtils.readFileToString(TEST_FILE, StandardCharsets.ISO_8859_1); String formatted = service.format(text, MimeTypeUtils.TEXT_PLAIN); assertThat(text, equalToIgnoringWhiteSpace(formatted)); }