ScraperItemReader implements ItemReader<T>, InitializingBean { @Override public T read() throws Exception { return retryTemplate.execute(context -> { T result = null; if (request != null) { LOGGER.debug("Requesting Railtime for {}", request); waitRandomly(); result = parser.parse(streamer.stream(request)); request = null; } return result; }); }  @Override void afterPropertiesSet(); @Override T read(); void setRetryPolicy(RetryPolicy retryPolicy); void setBackOffPolicy(BackOffPolicy backOffPolicy); void setStreamer(RequestStreamer<R> streamer); void setParser(StreamParser<T, R> parser); void setRequest(R request);  }
@Test public void testRead() throws Exception { Assert.assertTrue(reader.read().allMatch(line -> "test".equals(line))); }