### Question:
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);  }### Answer:
@Test public void shouldReturnEmptyWhenFileDoesNotExist(@TempDir Path tempDir) throws Exception { assertThat(loader.load(tempDir.resolve("test.txt").toAbsolutePath().toString())).isEmpty(); }
@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); }