How to mock an ItemReader in a Spring Batch application using Spock and Groovy
问题 I'm trying to write the tests for a Spring Batch application, specifically on the interaction from the following reader when it gets records from a database implementing a simple RowMapper : @Component @StepScope public class RecordItemReader extends JdbcCursorItemReader<FooDto> { @Autowired public RecordItemReader(DataSource dataSource) { this.setDataSource(dataSource); this.setSql(AN_SQL_QUERY); this.setRowMapper(new RecordItemMapper()); } } Here is the step definition from the Batch