### Question:
StandaloneServletContextUriLocator extends ServletContextUriLocator { @Override public InputStream locate(final String uri) throws IOException { Exception lastException = null; final String[] contextFolders = standaloneContext.getContextFolders(); for(final String contextFolder : contextFolders) { try { return locateStreamWithContextFolder(uri, contextFolder); } catch(final IOException e) { lastException = e; LOG.debug("Could not locate: {} using contextFolder: {}", uri, contextFolder); } } final String exceptionMessage = String.format("No valid resource '%s' found inside any of contextFolders: %s", uri, Arrays.toString(standaloneContext.getContextFolders())); throw new IOException(exceptionMessage, lastException); } StandaloneServletContextUriLocator(final StandaloneContext standaloneContext); @Override InputStream locate(final String uri);  }### Answer:
@Test(expected = IOException.class) public void cannotLocateInvalidResource() throws Exception { victim.locate("invalid"); }
@Test public void shouldLocateValidResource() throws Exception { final String validResource = TestStandaloneServletContextUriLocator.class.getSimpleName() + ".class"; assertNotNull(victim.locate(validResource)); }
@Test public void shouldLocateValidResourceWhenMultipleContextFoldersProvided() throws Exception { final String defaultContextFolder = standaloneContext.getContextFoldersAsCSV(); standaloneContext.setContextFoldersAsCSV("invalid," + defaultContextFolder); final String validResource = TestStandaloneServletContextUriLocator.class.getSimpleName() + ".class"; assertNotNull(victim.locate(validResource)); }
@Test(expected = IOException.class) public void cannotLocateInvalidResourceWhenMultipleContextFoldersProvided() throws Exception { final String defaultContextFolder = standaloneContext.getContextFoldersAsCSV(); standaloneContext.setContextFoldersAsCSV("invalid," + defaultContextFolder); assertNotNull(victim.locate("invalid")); }