URITools { public String validFilename(String name) { if (name == null) throw new NullPointerException(); URI uri; try { uri = new URI(null, null, name, null, null); } catch (URISyntaxException e) { throw new IllegalArgumentException("Invalid name " + name); } String ascii = uri.toASCIIString(); String escaped = ascii.replace("/", "%2f"); escaped = escaped.replace(":", "%3a"); escaped = escaped.replace("=", "%3d"); return escaped; }  URI relativePath(URI base, URI uri); URI relativeUriForBean(WorkflowBean bean, WorkflowBean relativeToBean); WorkflowBean resolveUri(URI uri, WorkflowBundle wfBundle); URI uriForBean(WorkflowBean bean); String validFilename(String name);  }
@Test public void validFileName() { assertEquals( "f%2fsd%5Csdf'asd%20fa%3as&%3F%3dd%20%C6%92%C3%AB%E2%88%9A%C3%A6%E2%80%9A%C3%84%C3%B9%C2%AC%C2%AA%E2%88%9A%C2%B6", uriTools.validFilename("f/sd\\sdf'asd fa:s&?=d \u0192\u00eb\u221a\u00e6\u201a\u00c4\u00f9\u00ac\u00aa\u221a\u00b6")); }
@Test(expected=NullPointerException.class) public void validFileNameNull() { uriTools.validFilename(null); }