FlatFileRecordReader extends AbstractFileRecordReader<String> { @Override public void open() throws Exception { currentRecordNumber = 0; bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(path.toFile()), charset)); } FlatFileRecordReader(final Path path);  FlatFileRecordReader(final Path path, final Charset charset); @Override StringRecord readRecord(); @Override void open(); @Override void close();  }
@Test(expected = FileNotFoundException.class) public void whenInputFileDoesNotExist_thenOpeningTheReaderShouldThrowFileNotFoundException() throws Exception { flatFileRecordReader = new FlatFileRecordReader(nonExistingDataSource); flatFileRecordReader.open(); }