Fixed NPE in integration test

This commit is contained in:
Michael Minella
2015-05-20 22:31:30 -05:00
parent 6b688fa2b5
commit 7be035cd3d

View File

@@ -84,19 +84,13 @@ public class JdbcPagingItemReaderAsyncTests {
@Before
public void init() {
System.out.println("********* dataSource = " + dataSource);
System.out.println("********* maxId = " + maxId);
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
System.out.println("********* jdbcTemplate = " + jdbcTemplate);
maxId = jdbcTemplate.queryForObject("SELECT MAX(ID) from T_FOOS", Integer.class);
System.out.println("********* maxId after = " + maxId);
Integer tempMaxId = jdbcTemplate.queryForObject("SELECT MAX(ID) from T_FOOS", Integer.class);
maxId = tempMaxId != null? tempMaxId : 0;
for (int i = ITEM_COUNT; i > maxId; i--) {
System.out.println("********* inserting a foo");
jdbcTemplate.update("INSERT into T_FOOS (ID,NAME,VALUE) values (?, ?, ?)", i, "foo" + i, i);
System.out.println("********* a foo was inserted");
}
assertEquals(ITEM_COUNT, JdbcTestUtils.countRowsInTable(jdbcTemplate, "T_FOOS"));
System.out.println("******** init is complete");
}
@After