### Question:
UrlUriLocator extends WildcardUriLocatorSupport { public InputStream locate(final String uri) throws IOException { notNull(uri, "uri cannot be NULL!"); if (getWildcardStreamLocator().hasWildcard(uri)) { final String fullPath = FilenameUtils.getFullPath(uri); final URL url = new URL(fullPath); return getWildcardStreamLocator().locateStream(uri, new File(URLDecoder.decode(url.getFile(), "UTF-8"))); } final URL url = new URL(uri); final URLConnection connection = url.openConnection(); connection.setUseCaches(false); connection.setConnectTimeout(timeout); connection.setReadTimeout(timeout); return new BufferedInputStream(connection.getInputStream()); }  boolean accept(final String uri); static boolean isValid(final String uri); InputStream locate(final String uri); void setTimeout(int timeout); static final String ALIAS; }### Answer:
@Test(expected = NullPointerException.class) public void cannotAcceptNullUri() throws IOException { victim.locate(null); }
@Test(expected = MalformedURLException.class) public void cannotLocateMalformedUrl() throws IOException { victim.locate("/someInvalidUri.html"); }
@Test public void testValidUrl() throws IOException { victim.locate("http: }
@Test(expected = IOException.class) public void testWildcardInexistentResources() throws IOException { victim.locate(createUri("*.NOTEXIST")); }
@Test public void shouldLocateWildcard1Resources() throws IOException { victim.locate(createUri("*.css")); }
@Test public void shouldLocateWildcard2Resources() throws IOException { victim.locate(createUri("*.cs?")); }
@Test public void shouldLocateWildcard3Resources() throws IOException { victim.locate(createUri("*.???")); }
@Test public void shouldLocateRecursiveWildcardResources() throws IOException { victim.locate(createUri("**.css")); }
@Test(expected = IOException.class) public void testWildcardUsingInvalidResource() throws IOException { victim.locate(createUri("http: }
@Test public void shouldFindWildcardResourcesForFolderContainingSpaces() throws IOException { victim.locate(createUri("/folder with spaces/**.css", "test")); }