### Question:
DirectoryStoreFile implements StoreLoader { @Override public void load(final Path directory) throws IOException { if (!Files.isDirectory(directory)) { throw new IllegalArgumentException(directory.toString() + " doesn't exist or is not a directory"); } this.fileListIterator = Files.list(directory).iterator(); }  @Override void load(final Path directory); @Override DataEntry nextEntry();  }### Answer:
@Test public void loadOnNondirectory() throws IOException { final Path randomFile = Files.createTempFile("other", ".txt"); final Throwable throwable = catchThrowable(() -> loader.load(randomFile)); assertThat(throwable) .isNotNull() .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("doesn't exist or is not a directory"); }
@Test public void loadOnNonexistentFolder() throws IOException { final Path randomFile = Files.createTempFile("other", ".txt").getParent().resolve("unknown/other").getParent(); final Throwable throwable = catchThrowable(() -> loader.load(randomFile)); assertThat(throwable) .isNotNull() .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("doesn't exist or is not a directory"); }
@Test public void loadProperDatabaseHasNoError() throws URISyntaxException { final Path directory = Paths.get(getClass().getResource("/dir/").toURI()); final Throwable throwable = catchThrowable(() -> loader.load(directory)); assertThat(throwable).isNull(); }