@Test public void shouldCreateInputStreamWhenPathIsADirectory(@TempDir Path tempDir) throws Exception { assertThat(loader.load(tempDir.toAbsolutePath().toString())).isNotEmpty(); assertThatThrownBy(() -> loader.loadBytes(tempDir.toAbsolutePath().toString())) .isInstanceOf(IOException.class); }
@Override public Optional<InputStream> load(final String source) throws IOException { final Path path = Path.of(source); if (!path.toFile().exists()) { return Optional.empty(); } return Optional.of(Files.newInputStream(path)); }
FileResourceLoader implements ResourceLoader { @Override public Optional<InputStream> load(final String source) throws IOException { final Path path = Path.of(source); if (!path.toFile().exists()) { return Optional.empty(); } return Optional.of(Files.newInputStream(path)); } }
FileResourceLoader implements ResourceLoader { @Override public Optional<InputStream> load(final String source) throws IOException { final Path path = Path.of(source); if (!path.toFile().exists()) { return Optional.empty(); } return Optional.of(Files.newInputStream(path)); }  }
FileResourceLoader implements ResourceLoader { @Override public Optional<InputStream> load(final String source) throws IOException { final Path path = Path.of(source); if (!path.toFile().exists()) { return Optional.empty(); } return Optional.of(Files.newInputStream(path)); }  @Override Optional<InputStream> load(final String source); }
FileResourceLoader implements ResourceLoader { @Override public Optional<InputStream> load(final String source) throws IOException { final Path path = Path.of(source); if (!path.toFile().exists()) { return Optional.empty(); } return Optional.of(Files.newInputStream(path)); }  @Override Optional<InputStream> load(final String source);  }