SimplePathBuilder implements PathBuilder { @Override public void setCurrentDirectory(String currentDirectory) { if (currentDirectory == null) { this.currentFile = null; this.currentURL = null; } else { try { this.currentURL = new URL(currentDirectory); this.currentFile = null; } catch (MalformedURLException exception) { this.currentFile = new File(currentDirectory); this.currentURL = null; } } } SimplePathBuilder();  SimplePathBuilder(String currentDirectory);  SimplePathBuilder(File currentDirectory);  SimplePathBuilder(URL currentDirectory); @Override void setCurrentDirectory(String currentDirectory); @Override void setCurrentDirectory(File currentDirectory); @Override void setCurrentDirectory(URL currentDirectory); @Override File getCurrentDirectoryFile(); @Override URL getCurrentDirectoryURL();  }
@Test public void testGetCurrentDirectoryString() throws Exception { assertEquals(this.userHome.toURI().toURL().toExternalForm(), this.builder.getCurrentDirectoryString()); this.builder.setCurrentDirectory("file:./toto"); assertEquals("file:./toto", this.builder.getCurrentDirectoryString()); this.builder.setCurrentDirectory("http: assertEquals("http: this.builder.setCurrentDirectory("https: assertEquals("https: this.builder.setCurrentDirectory("ftp: assertEquals("ftp: this.builder.setCurrentDirectory("jar:file:test.jar!/toto"); assertEquals("jar:file:test.jar!/toto", this.builder.getCurrentDirectoryString()); this.builder.setCurrentDirectory("./toto"); assertEquals(new File("./toto").toURI().toURL().toExternalForm(), this.builder.getCurrentDirectoryString()); }