FileRecordReader implements RecordReader<Path> { @Override public void open() throws Exception { checkDirectory(); Stream<Path> pathStream = recursive ? Files.walk(directory) : Files.list(directory); iterator = pathStream.filter(Files::isRegularFile).iterator(); currentRecordNumber = 0; } FileRecordReader(final Path path);  FileRecordReader(final Path path, final boolean recursive); @Override void open(); @Override FileRecord readRecord();  }
@Test(expected = IllegalArgumentException.class) public void whenDirectoryDoesNotExist_thenShouldThrowAnIllegalArgumentException() throws Exception { fileRecordReader = new FileRecordReader(Paths.get("src/test/resources/ImSureThisDirectoryDoesNotExist")); fileRecordReader.open(); }