@Test void testGetResourceAsStream() { DefaultResourceManager manager = new DefaultResourceManager(); manager.addResource(new DirectoryResource(new File(""))); assertNull(manager.getResourceAsStream("/doesnotexist")); }
@Override public InputStream getResourceAsStream(String location) { InputStream result = null; Iterator<Resource> iterator = resources.iterator(); while (iterator.hasNext()) { Resource resource = iterator.next(); result = resource.getResourceAsStream(location); if (result != null) { break; } } if (result == null) { result = getClass().getResourceAsStream(location); } return result; }
DefaultResourceManager implements ResourceManager { @Override public InputStream getResourceAsStream(String location) { InputStream result = null; Iterator<Resource> iterator = resources.iterator(); while (iterator.hasNext()) { Resource resource = iterator.next(); result = resource.getResourceAsStream(location); if (result != null) { break; } } if (result == null) { result = getClass().getResourceAsStream(location); } return result; } }
DefaultResourceManager implements ResourceManager { @Override public InputStream getResourceAsStream(String location) { InputStream result = null; Iterator<Resource> iterator = resources.iterator(); while (iterator.hasNext()) { Resource resource = iterator.next(); result = resource.getResourceAsStream(location); if (result != null) { break; } } if (result == null) { result = getClass().getResourceAsStream(location); } return result; }  }
DefaultResourceManager implements ResourceManager { @Override public InputStream getResourceAsStream(String location) { InputStream result = null; Iterator<Resource> iterator = resources.iterator(); while (iterator.hasNext()) { Resource resource = iterator.next(); result = resource.getResourceAsStream(location); if (result != null) { break; } } if (result == null) { result = getClass().getResourceAsStream(location); } return result; }  @Override void addResource(Resource resource); @Override URL getResource(String location); @Override Collection<URL> getResources(String location); @Override InputStream getResourceAsStream(String location); @Override Stream<String> getAllLocations(); }
DefaultResourceManager implements ResourceManager { @Override public InputStream getResourceAsStream(String location) { InputStream result = null; Iterator<Resource> iterator = resources.iterator(); while (iterator.hasNext()) { Resource resource = iterator.next(); result = resource.getResourceAsStream(location); if (result != null) { break; } } if (result == null) { result = getClass().getResourceAsStream(location); } return result; }  @Override void addResource(Resource resource); @Override URL getResource(String location); @Override Collection<URL> getResources(String location); @Override InputStream getResourceAsStream(String location); @Override Stream<String> getAllLocations();  }