### Question:
DirScanner { public static DirScanner create(File dir) { return new DirScanner(dir); } private  DirScanner(File dir); static DirScanner create(File dir); DirScanner textFiles(boolean textFilesOnly); DirScanner excludeDirs(Predicate<File> dirExclusion); DirScanner excludeFiles(Predicate<File> fileExclusion); void scan(Consumer<File> fileProcessor);  }### Answer:
@Test public void createWhenNullThenIllegalArgumentException() { assertThatCode(() -> DirScanner.create(null)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("dir cannot be null"); }
@Test public void createWhenNotDirThenIllegalArgumentException() throws IOException { File file = this.temp.newFile(); assertThatCode(() -> DirScanner.create(file)) .isInstanceOf(IllegalArgumentException.class) .hasMessage(file + " is not a directory"); }
@Test public void scanWhenNotDirThenIllegalArgumentException() throws IOException { File file = this.temp.newFile(); assertThatCode(() -> DirScanner.create(file)) .isInstanceOf(IllegalArgumentException.class) .hasMessage(file + " is not a directory"); }