when(statement.executeQuery(sqlText)).thenReturn(resultSet);
StatementFactory statementFactory = mock(StatementFactory.class);
DbConnection connection = mock(DbConnection.class);
ResultSetHandler resultHandler = mock(ResultSetHandler.class);
List<Object> processedResult = new ArrayList<Object>();
when(resultHandler.processResultSet(connection, resultSet)).thenReturn(processedResult);
SelectExecutor selectExecutor = new SelectExecutor(statementFactory, resultHandler);
QueryTemplate queryTemplate = new QueryTemplate(sqlText, QueryType.SELECT, Collections.<QueryParam>emptyList());
Mockito.when(statementFactory.create(connection, queryTemplate)).thenReturn(statement);