YamlFileRecordReader extends AbstractFileRecordReader<String> { @Override public YamlRecord readRecord() { return yamlRecordReader.readRecord(); } YamlFileRecordReader(final Path yamlFile);  YamlFileRecordReader(final Path yamlFile, final Charset charset); @Override void open(); @Override YamlRecord readRecord(); @Override void close();  }
@Test public void testYamlRecordReading() throws Exception { String expectedDataSourceName = dataSource.toAbsolutePath().toString(); YamlRecord yamlRecord = yamlFileRecordReader.readRecord(); assertThat(yamlRecord.getHeader().getNumber()).isEqualTo(1L); assertThat(yamlRecord.getHeader().getSource()).isEqualTo(expectedDataSourceName); assertThat(yamlRecord.getPayload()).isEqualTo("name: Foo" + LINE_SEPARATOR + "age: 28" + LINE_SEPARATOR); yamlRecord = yamlFileRecordReader.readRecord(); assertThat(yamlRecord.getHeader().getNumber()).isEqualTo(2L); assertThat(yamlRecord.getHeader().getSource()).isEqualTo(expectedDataSourceName); assertThat(yamlRecord.getPayload()).isEqualTo("name: Bar" + LINE_SEPARATOR + "age: 25" + LINE_SEPARATOR); yamlRecord = yamlFileRecordReader.readRecord(); assertThat(yamlRecord.getHeader().getNumber()).isEqualTo(3L); assertThat(yamlRecord.getHeader().getSource()).isEqualTo(expectedDataSourceName); assertThat(yamlRecord.getPayload()).isEqualTo("name: Baz" + LINE_SEPARATOR + "age: 30" + LINE_SEPARATOR); yamlRecord = yamlFileRecordReader.readRecord(); assertThat(yamlRecord).isNull(); }