@SuppressWarnings("unchecked")
private JsonObject fetchResult(Capture<RowMapper<JsonObject>> mapper,
Capture<PreparedStatementCreator> creator, Map<String, String[]> parameters) {
List<Number> countRes = new ArrayList<Number>();
countRes.add(10);
UIProviderImpl provider = new UIProviderImpl();
JdbcTemplate template = EasyMock.createMock(JdbcTemplate.class);
provider.setJdbcTemplate(template);
provider.setDialect(new DerbyDialect());
// Expectations
EasyMock.expect(template.query(EasyMock.anyObject(PreparedStatementCreator.class), EasyMock.anyObject(RowMapper.class)))
.andReturn(countRes);
EasyMock.expect(
template.query(EasyMock.capture(creator),
EasyMock.capture(mapper))).andReturn(
objects);
// Test
EasyMock.replay(template);
JsonObject result = provider.getEvents(0, "base", new CriteriaAdapter(0, 100,
parameters));
EasyMock.verify(template);
return result;
}