01: /*
02: * $Id: IMockDatabase.java,v 1.2 2004/10/05 20:13:04 spal Exp $
03: * $Source: /cvsroot/sqlunit/sqlunit/test/java/mock/IMockDatabase.java,v $
04: * SQLUnit - a test harness for unit testing database stored procedures.
05: * Copyright (C) 2003 The SQLUnit Team
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20: */
21: package net.sourceforge.sqlunit.test.mock;
22:
23: import com.mockrunner.mock.jdbc.MockResultSet;
24:
25: /**
26: * Provides a convenient abstraction of what a mock database should look
27: * like for SQLUnit mock testing.
28: * @author Sujit Pal (spal@users.sourceforge.net)
29: * @version $Revision: 1.2 $
30: */
31: public interface IMockDatabase {
32:
33: /**
34: * Returns a MockResultSet given the method name to query and the
35: * resultset id desired. Note that this method is implemented in the
36: * AbstractMockDatabase class. Subclasses will need to provide a
37: * set of private methods that will actually return the mock resultset
38: * object. This method essentially delegates to the named method at
39: * runtime. Named methods must have the following signature:
40: * <code>public MockResultSet method(Integer resultsetId);</code>
41: * @param methodName the name of the private method.
42: * @param resultSetId which resultset to return in case of multiple
43: * resultsets. The index is 1-based, the default for this parameter is 1.
44: * @return a MockResultSet object.
45: * @exception Exception if one is thrown in the delegated method.
46: */
47: MockResultSet getResultSet(String methodName, int resultSetId)
48: throws Exception;
49: }
|