/** * Tests <code>ResourceLoader#getResourceAsURL</code> methods. * * @throws IOException should not happen */ @Test public void testResourceAsURL() throws IOException { assertReadable(ResourceLoader.getResourceAsURL(getExistingResourcePath())); assertReadable(ResourceLoader.getResourceAsURL("/"+getExistingResourcePath())); assert ResourceLoader.getResourceAsURL(getNonExistingResourcePath()) == null; assertReadable(ResourceLoader.getResourceAsURL(getExistingResourcePath(), getThisClassLoader(), getRootPackageFile())); assertReadable(ResourceLoader.getResourceAsURL("/"+getExistingResourcePath(), getThisClassLoader(), getRootPackageFile())); assert ResourceLoader.getResourceAsURL(getNonExistingResourcePath(), getThisClassLoader(), getRootPackageFile()) == null; }
/** * Tests <code>ResourceLoader#getResourceAsStream</code> methods. * * @throws IOException should not happen */ @Test public void testResourceAsStream() throws IOException { assertReadable(ResourceLoader.getResourceAsStream(getExistingResourcePath())); assertReadable(ResourceLoader.getResourceAsStream("/"+getExistingResourcePath())); assert ResourceLoader.getResourceAsStream(getNonExistingResourcePath()) == null; assertReadable(ResourceLoader.getResourceAsStream(getExistingResourcePath(), getThisClassLoader(), getRootPackageFile())); assertReadable(ResourceLoader.getResourceAsStream("/"+getExistingResourcePath(), getThisClassLoader(), getRootPackageFile())); assert ResourceLoader.getResourceAsStream(getNonExistingResourcePath(), getThisClassLoader(), getRootPackageFile()) == null; }
/** * Tests <code>ResourceLoader#getResourceAsFile</code> methods. * * @throws IOException should not happen */ @Test public void testResourceAsFile() throws IOException { assertReadable(ResourceLoader.getResourceAsFile(getExistingResourcePath())); assertReadable(ResourceLoader.getResourceAsFile("/"+getExistingResourcePath())); assert ResourceLoader.getResourceAsFile(getNonExistingResourcePath()) == null; assertReadable(ResourceLoader.getResourceAsFile(getExistingResourcePath(), getThisClassLoader(), getRootPackageFile())); assertReadable(ResourceLoader.getResourceAsFile("/"+getExistingResourcePath(), getThisClassLoader(), getRootPackageFile())); assert ResourceLoader.getResourceAsFile(getNonExistingResourcePath(), getThisClassLoader(), getRootPackageFile()) == null; }