DefaultSourceURI2OutputFilePathFunction implements Function<DocumentMetadata, Path> { @Override public Path apply(DocumentMetadata metaAnno) { String uriStr = metaAnno.getSourceUri(); if (uriStr == null) { return null; } return IoUtils.extractPathFromURI(uriStr); }  @Override Path apply(DocumentMetadata metaAnno);  }
@Test public void testWithScheme() { meta.setSourceUri("file:/some/folder/file.txt"); Path result = func.apply(meta); assertEquals(Paths.get("/some/folder/file.txt"), result); }
@Test public void testRelative() { meta.setSourceUri("someFolder/someFile"); Path result = func.apply(meta); assertEquals(Paths.get("someFolder/someFile"), result); }
@Test(expected = IllegalArgumentException.class) public void testOpaqueURIs() { meta.setSourceUri("file:someFolder/someFile"); func.apply(meta); }