JsonFileRecordReader extends AbstractFileRecordReader<String> { @Override public JsonRecord readRecord() { return jsonRecordReader.readRecord(); } JsonFileRecordReader(final Path jsonFile);  JsonFileRecordReader(final Path jsonFile, final Charset charset); @Override void open(); @Override JsonRecord readRecord(); @Override void close();  }
@Test public void testJsonRecordReading() { String expectedDataSourceName = dataSource.toAbsolutePath().toString(); JsonRecord jsonRecord = jsonFileRecordReader.readRecord(); assertThat(jsonRecord.getHeader().getNumber()).isEqualTo(1L); assertThat(jsonRecord.getHeader().getSource()).isEqualTo(expectedDataSourceName); assertThat(jsonRecord.getPayload()).isEqualTo("{\"id\":1,\"name\":\"foo\"}"); jsonRecord = jsonFileRecordReader.readRecord(); assertThat(jsonRecord.getHeader().getNumber()).isEqualTo(2L); assertThat(jsonRecord.getHeader().getSource()).isEqualTo(expectedDataSourceName); assertThat(jsonRecord.getPayload()).isEqualTo("{\"id\":2,\"name\":\"bar\"}"); jsonRecord = jsonFileRecordReader.readRecord(); assertThat(jsonRecord.getHeader().getNumber()).isEqualTo(3L); assertThat(jsonRecord.getHeader().getSource()).isEqualTo(expectedDataSourceName); assertThat(jsonRecord.getPayload()).isEqualTo("{\"id\":3,\"name\":\"toto\"}"); jsonRecord = jsonFileRecordReader.readRecord(); assertThat(jsonRecord).isNull(); }