Package com.mockobjects.sql
Class MockResultSetMetaData
java.lang.Object
com.mockobjects.MockObject
com.mockobjects.sql.MockResultSetMetaData
- All Implemented Interfaces:
Verifiable
,ResultSetMetaData
,Wrapper
Minimal implementation of ResultSetMetaData for testing.
Supports column count, column names, and column sql types.
- Version:
- $Revision: 1.2 $
- Author:
- Jeff Martin, Ted Husted
- See Also:
-
Field Summary
Fields inherited from interface java.sql.ResultSetMetaData
columnNoNulls, columnNullable, columnNullableUnknown
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addExpectedColumnClassNameIndex
(int aColumnIndex) Adds an expectation for a column index to be passed to getColumnClassNamevoid
addExpectedColumnNameIndex
(int aColumnIndex) Adds an expectation for a column index to be passed to getColumnNamevoid
addExpectedColumnTypeIndex
(int aColumnIndex) Adds an expectation for a column index to be passed to getColumnTypegetCatalogName
(int arg0) Calls notImplemented.getColumnClassName
(int aColumnIndex) Returns the column class name.int
Returns value passed to setupGetColumnCount.int
getColumnDisplaySize
(int arg0) Calls notImplemented.getColumnLabel
(int arg0) Calls notImplemented.getColumnName
(int aColumnIndex) Returns the column name.int
getColumnType
(int aColumnIndex) Returns the column SQL type.getColumnTypeName
(int arg0) Calls notImplemented.int
getPrecision
(int arg0) Calls notImplemented.int
getScale
(int arg0) Calls notImplemented.getSchemaName
(int arg0) Calls notImplemented.getTableName
(int arg0) Calls notImplemented.boolean
isAutoIncrement
(int arg0) Calls notImplemented.boolean
isCaseSensitive
(int arg0) Calls notImplemented.boolean
isCurrency
(int arg0) Calls notImplemented.boolean
isDefinitelyWritable
(int arg0) Calls notImplemented.int
isNullable
(int arg0) Calls notImplemented.boolean
isReadOnly
(int arg0) Calls notImplemented.boolean
isSearchable
(int arg0) Calls notImplemented.boolean
isSigned
(int arg0) Calls notImplemented.boolean
isWritable
(int arg0) Calls notImplemented.void
setupAddColumnClassName
(String aName) The next column class name in the resultSet.void
setupAddColumnClassNames
(String[] allNames) An array of column class names in the order they appear in the resultSet.void
setupAddColumnName
(String aName) The next column name in the resultSet.void
setupAddColumnNames
(String[] allNames) An array of column names in the order they appear in the resultSet.void
setupAddColumnType
(int aType) The next column's SQL type in the resultSet as an int.void
setupAddColumnTypes
(int[] allTypes) An array of column SQL types in the order they appear in the resultSet.void
setupGetColumnCount
(int aColumnCount) Value to return from getColumnCount.Methods inherited from class com.mockobjects.MockObject
notImplemented, notYetImplemented, verify
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Constructor Details
-
MockResultSetMetaData
public MockResultSetMetaData()
-
-
Method Details
-
setupGetColumnCount
public void setupGetColumnCount(int aColumnCount) Value to return from getColumnCount. -
setupAddColumnNames
An array of column names in the order they appear in the resultSet. -
setupAddColumnName
The next column name in the resultSet. -
setupAddColumnTypes
public void setupAddColumnTypes(int[] allTypes) An array of column SQL types in the order they appear in the resultSet. -
setupAddColumnType
public void setupAddColumnType(int aType) The next column's SQL type in the resultSet as an int. -
getColumnCount
Returns value passed to setupGetColumnCount.- Specified by:
getColumnCount
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
getColumnName
Returns the column name. DOES NOT SUPPORT THE aColumnIndex PARAMETER. You must call getColumnName in order, first to last. Column names may be added with setupAddColumnName. or setupAddColumnNames.- Specified by:
getColumnName
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
addExpectedColumnNameIndex
public void addExpectedColumnNameIndex(int aColumnIndex) Adds an expectation for a column index to be passed to getColumnName- See Also:
-
getColumnType
Returns the column SQL type. DOES NOT SUPPORT THE aColumnIndex PARAMETER. You must call getColumnType in order, first to last. Column SQL types may be added with setupAddColumnType.- Specified by:
getColumnType
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
addExpectedColumnTypeIndex
public void addExpectedColumnTypeIndex(int aColumnIndex) Adds an expectation for a column index to be passed to getColumnType- See Also:
-
isAutoIncrement
Calls notImplemented. Returns false.- Specified by:
isAutoIncrement
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
isCaseSensitive
Calls notImplemented. Returns false.- Specified by:
isCaseSensitive
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
isSearchable
Calls notImplemented. Returns false.- Specified by:
isSearchable
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
isCurrency
Calls notImplemented. Returns false.- Specified by:
isCurrency
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
isNullable
Calls notImplemented. Returns false.- Specified by:
isNullable
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
isSigned
Calls notImplemented. Returns false.- Specified by:
isSigned
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
getColumnDisplaySize
Calls notImplemented. Returns 0.- Specified by:
getColumnDisplaySize
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
getColumnLabel
Calls notImplemented. Returns null.- Specified by:
getColumnLabel
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
getColumnTypeName
Calls notImplemented. Returns null.- Specified by:
getColumnTypeName
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
getSchemaName
Calls notImplemented. Returns null.- Specified by:
getSchemaName
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
getPrecision
Calls notImplemented. Returns 0.- Specified by:
getPrecision
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
getScale
Calls notImplemented. Returns 0.- Specified by:
getScale
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
getTableName
Calls notImplemented. Returns null.- Specified by:
getTableName
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
getCatalogName
Calls notImplemented. Returns null.- Specified by:
getCatalogName
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
isReadOnly
Calls notImplemented. Returns false.- Specified by:
isReadOnly
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
isWritable
Calls notImplemented. Returns false.- Specified by:
isWritable
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
isDefinitelyWritable
Calls notImplemented. Returns false.- Specified by:
isDefinitelyWritable
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
setupAddColumnClassNames
An array of column class names in the order they appear in the resultSet. -
setupAddColumnClassName
The next column class name in the resultSet. -
getColumnClassName
Returns the column class name. DOES NOT SUPPORT THE aColumnIndex PARAMETER. You must call getColumnClassName in order, first to last. Column class names may be added with setupAddColumnClassName. or setupAddColumnClassNames.- Specified by:
getColumnClassName
in interfaceResultSetMetaData
- Throws:
SQLException
- See Also:
-
addExpectedColumnClassNameIndex
public void addExpectedColumnClassNameIndex(int aColumnIndex) Adds an expectation for a column index to be passed to getColumnClassName- See Also:
-