IterableRecordReader implements RecordReader<P> { @Override public GenericRecord<P> readRecord() { Header header = new Header(++currentRecordNumber, getDataSourceName(), LocalDateTime.now()); if (iterator.hasNext()) { return new GenericRecord<>(header, iterator.next()); } else { return null; } } IterableRecordReader(final Iterable<P> dataSource); @Override void open(); @Override GenericRecord<P> readRecord();  }
@Test public void testReadRecord() { GenericRecord<String> genericRecord = iterableRecordReader.readRecord(); assertThat(genericRecord).isNotNull(); assertThat(genericRecord.getPayload()).isEqualTo(RECORD); }