### Question:
AbstractDir implements DirInterface { public static String pathFromURI(String path) { if (path.startsWith("file: int charToRemove = 7; if (path.charAt(7) == '/' && path.charAt(9) == ':') { charToRemove++; } path = path.substring(charToRemove); if (path.contains("%")) { try { path = URLDecoder.decode(path, WaarpStringUtils.UTF8.name()); } catch (final UnsupportedEncodingException e) { logger.warn("Cannot convert filename to UTF-8: " + path); } catch (final IllegalArgumentException e) { } } } return path; }  static String normalizePath(final String path); static String pathFromURI(String path); @Override SessionInterface getSession(); @Override String validatePath(final String path); boolean isAbsolute(final String path); @Override boolean isPathInCurrentDir(final String path); @Override String getPwd(); @Override boolean changeParentDirectory(); @Override FileInterface setFile(final String path, final boolean append); @Override void checkIdentify(); @Override void clear(); @Override void initAfterIdentification(); @Override OptsMLSxInterface getOptsMLSx();  }### Answer:
@Test public void testPathFromUri() { assertEquals("single relative filename", "test.dat", AbstractDir.pathFromURI("test.dat")); assertEquals("relative path (unix)", "foo/test.dat", AbstractDir.pathFromURI("foo/test.dat")); assertEquals("absolute path (unix)", "/foo/test.dat", AbstractDir.pathFromURI("/foo/test.dat")); assertEquals("absolute uri (unix)", "/foo/test.dat", AbstractDir.pathFromURI("file: assertEquals("relative uri (unix)", "foo/test.dat", AbstractDir.pathFromURI("file: assertEquals("relative path (win)", "foo/test.dat", AbstractDir.pathFromURI("foo/test.dat")); assertEquals("absolute path (win)", "c:/foo/test.dat", AbstractDir.pathFromURI("c:/foo/test.dat")); assertEquals("absolute uri (win)", "c:/foo/test.dat", AbstractDir.pathFromURI("file: assertEquals("relative uri (win)", "foo/test.dat", AbstractDir.pathFromURI("file: assertEquals("UNC path (win)", " AbstractDir.pathFromURI(" assertEquals("UNC uri (win)", " AbstractDir.pathFromURI("file: assertEquals("url to decode", " .pathFromURI("file: assertEquals("filename with percent sign", "/tmp/100% accuracy.txt", AbstractDir.pathFromURI("file: }