MockControl dsControl = MockControl.createControl(DataSource.class);
DataSource ds = (DataSource) dsControl.getMock();
MockControl conControl = MockControl.createControl(Connection.class);
Connection con = (Connection) conControl.getMock();
MockControl clientControl = MockControl.createControl(SqlMapClient.class);
SqlMapClient client = (SqlMapClient) clientControl.getMock();
MockControl sessionControl = MockControl.createControl(SqlMapSession.class);
SqlMapSession session = (SqlMapSession) sessionControl.getMock();
ds.getConnection();
dsControl.setReturnValue(con, 1);
con.close();
conControl.setVoidCallable(1);
client.getDataSource();
clientControl.setReturnValue(ds, 2);
client.openSession();
clientControl.setReturnValue(session, 1);
session.getCurrentConnection();
sessionControl.setReturnValue(null, 1);
session.setUserConnection(con);
sessionControl.setVoidCallable(1);