DefaultDatenpaketService implements DatenpaketService { @Override public List<Model> validate(URI uri) { Datenpaket datenpaket = new Datenpaket(); try { datenpaket.importFrom(uri); return validate(datenpaket); } catch (IOException | IllegalArgumentException ex) { LOG.warn("Cannot validate '{}':", uri, ex); return asModelList(ex); } }  @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 testValidateUri() { File musterdatei = toFile("../lib/src/test/resources/musterdatei_041222.txt"); List<Model> violations = service.validate(musterdatei.toURI()); assertEquals(0, violations.size()); }
@Test public void testValidateInvalidUri() { URI invalidURI = new File("/invalid/uri").toURI(); List<Model> violations = service.validate(invalidURI); assertEquals(1, violations.size()); LOG.info("violations = {}", violations); }