@Test public void shouldReturnEmptyIfNoLoaderCanLoad() throws Exception { assertThat(fallbackLoader.load(SOURCE)).isEmpty(); }
@Override public Optional<InputStream> load(final String source) throws IOException { for (ResourceLoader loader : loaders) { final Optional<InputStream> resource = loader.load(source); if (resource.isPresent()) { return resource; } } return Optional.empty(); }
FallbackResourceLoader implements ResourceLoader { @Override public Optional<InputStream> load(final String source) throws IOException { for (ResourceLoader loader : loaders) { final Optional<InputStream> resource = loader.load(source); if (resource.isPresent()) { return resource; } } return Optional.empty(); } }
FallbackResourceLoader implements ResourceLoader { @Override public Optional<InputStream> load(final String source) throws IOException { for (ResourceLoader loader : loaders) { final Optional<InputStream> resource = loader.load(source); if (resource.isPresent()) { return resource; } } return Optional.empty(); } FallbackResourceLoader(final ResourceLoader... loaders); }
FallbackResourceLoader implements ResourceLoader { @Override public Optional<InputStream> load(final String source) throws IOException { for (ResourceLoader loader : loaders) { final Optional<InputStream> resource = loader.load(source); if (resource.isPresent()) { return resource; } } return Optional.empty(); } FallbackResourceLoader(final ResourceLoader... loaders); @Override Optional<InputStream> load(final String source); }
FallbackResourceLoader implements ResourceLoader { @Override public Optional<InputStream> load(final String source) throws IOException { for (ResourceLoader loader : loaders) { final Optional<InputStream> resource = loader.load(source); if (resource.isPresent()) { return resource; } } return Optional.empty(); } FallbackResourceLoader(final ResourceLoader... loaders); @Override Optional<InputStream> load(final String source);  }