ConfigURIFactory { URI newURI(String spec) throws URISyntaxException { String expanded = expand(spec); String fixed = fixBackslashesToSlashes(expanded); if (fixed.startsWith(CLASSPATH_PROTOCOL)) { String path = fixed.substring(CLASSPATH_PROTOCOL.length()); URL url = classLoader.getResource(path); if (url == null) return null; return url.toURI(); } else if (fixed.startsWith(FILE_PROTOCOL)) { if ( fixed.equals(FILE_PROTOCOL) ) { return new URI(""); } else { String path = fixSpacesToPercentTwenty(fixed); return new URI(path); } } else { return new URI(fixed); } } ConfigURIFactory(ClassLoader classLoader, VariablesExpander expander);   }
@Test public void shouldReturnAnURI() throws URISyntaxException { ConfigURIFactory h = new ConfigURIFactory(this.getClass().getClassLoader(), new VariablesExpander(new Properties())); URI uri = h.newURI("classpath:test.properties"); assertNotNull(uri); }
@Test public void shouldReturnAUriWithEmptyFilePath() throws URISyntaxException { ConfigURIFactory h = new ConfigURIFactory(this.getClass().getClassLoader(), new VariablesExpander(new Properties())); URI uri = h.newURI("file:"); assertNotNull(uri); }