1 /*
2 *
3 * The DbUnit Database Testing Framework
4 * Copyright (C)2002-2004, DbUnit.org
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21 package org.dbunit.database;
22
23 import com.mockobjects.ExpectationCounter;
24 import com.mockobjects.Verifiable;
25 import org.dbunit.dataset.Column;
26 import org.dbunit.dataset.DataSetException;
27 import org.dbunit.dataset.DefaultTableMetaData;
28 import org.dbunit.dataset.ITableMetaData;
29
30 /**
31 * @author Manuel Laflamme
32 * @since Apr 12, 2003
33 * @version $Revision: 421 $
34 */
35 public class MockResultSetTable implements IResultSetTable, Verifiable
36 {
37 private final ExpectationCounter _closeCalls =
38 new ExpectationCounter("MockResultSetTable.close");
39 private ITableMetaData _metaData;
40
41 public void setupTableMetaData(String tableName)
42 {
43 _metaData = new DefaultTableMetaData(tableName, new Column[0]);
44 }
45
46 public void setExpectedCloseCalls(int callsCount)
47 {
48 _closeCalls.setExpected(callsCount);
49 }
50
51 ///////////////////////////////////////////////////////////////////////////
52 // Verifiable interface
53
54 public void verify()
55 {
56 _closeCalls.verify();
57 }
58
59 ////////////////////////////////////////////////////////////////////////////
60 // IResultSetTable interface
61
62 public Object getValue(int row, String column) throws DataSetException
63 {
64 return null;
65 }
66
67 public int getRowCount()
68 {
69 return 0;
70 }
71
72 public ITableMetaData getTableMetaData()
73 {
74 return _metaData;
75 }
76
77 public void close() throws DataSetException
78 {
79 _closeCalls.inc();
80 }
81 }