MockControl wsCtrl = MockControl.createControl(Workspace.class);
Workspace ws = (Workspace) wsCtrl.getMock();
MockControl qmCtrl = MockControl.createControl(QueryManager.class);
QueryManager qm = (QueryManager) qmCtrl.getMock();
MockControl queryCtrl = MockControl.createControl(Query.class);
Query query = (Query) queryCtrl.getMock();
MockControl resultCtrl = MockControl.createControl(QueryResult.class);
QueryResult result = (QueryResult) resultCtrl.getMock();
sessionControl.expectAndReturn(session.getWorkspace(), ws);
wsCtrl.expectAndReturn(ws.getQueryManager(), qm);
qmCtrl.expectAndReturn(qm.createQuery(stmt1, language), query);
qmCtrl.expectAndReturn(qm.createQuery(stmt2, language), query);
queryCtrl.expectAndReturn(query.execute(), result);
queryCtrl.expectAndReturn(query.execute(), result);
sfControl.replay();
sessionControl.replay();