Package com.mockobjects.sql
Class MockResultSetMetaData
- java.lang.Object
-
- com.mockobjects.MockObject
-
- com.mockobjects.sql.MockResultSetMetaData
-
- All Implemented Interfaces:
Verifiable,java.sql.ResultSetMetaData,java.sql.Wrapper
public class MockResultSetMetaData extends MockObject
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:
- javax.sql.ResultSetMetaData.
-
-
Constructor Summary
Constructors Constructor Description MockResultSetMetaData()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExpectedColumnClassNameIndex(int aColumnIndex)Adds an expectation for a column index to be passed to getColumnClassNamevoidaddExpectedColumnNameIndex(int aColumnIndex)Adds an expectation for a column index to be passed to getColumnNamevoidaddExpectedColumnTypeIndex(int aColumnIndex)Adds an expectation for a column index to be passed to getColumnTypejava.lang.StringgetCatalogName(int arg0)Calls notImplemented.java.lang.StringgetColumnClassName(int aColumnIndex)Returns the column class name.intgetColumnCount()Returns value passed to setupGetColumnCount.intgetColumnDisplaySize(int arg0)Calls notImplemented.java.lang.StringgetColumnLabel(int arg0)Calls notImplemented.java.lang.StringgetColumnName(int aColumnIndex)Returns the column name.intgetColumnType(int aColumnIndex)Returns the column SQL type.java.lang.StringgetColumnTypeName(int arg0)Calls notImplemented.intgetPrecision(int arg0)Calls notImplemented.intgetScale(int arg0)Calls notImplemented.java.lang.StringgetSchemaName(int arg0)Calls notImplemented.java.lang.StringgetTableName(int arg0)Calls notImplemented.booleanisAutoIncrement(int arg0)Calls notImplemented.booleanisCaseSensitive(int arg0)Calls notImplemented.booleanisCurrency(int arg0)Calls notImplemented.booleanisDefinitelyWritable(int arg0)Calls notImplemented.intisNullable(int arg0)Calls notImplemented.booleanisReadOnly(int arg0)Calls notImplemented.booleanisSearchable(int arg0)Calls notImplemented.booleanisSigned(int arg0)Calls notImplemented.booleanisWritable(int arg0)Calls notImplemented.voidsetupAddColumnClassName(java.lang.String aName)The next column class name in the resultSet.voidsetupAddColumnClassNames(java.lang.String[] allNames)An array of column class names in the order they appear in the resultSet.voidsetupAddColumnName(java.lang.String aName)The next column name in the resultSet.voidsetupAddColumnNames(java.lang.String[] allNames)An array of column names in the order they appear in the resultSet.voidsetupAddColumnType(int aType)The next column's SQL type in the resultSet as an int.voidsetupAddColumnTypes(int[] allTypes)An array of column SQL types in the order they appear in the resultSet.voidsetupGetColumnCount(int aColumnCount)Value to return from getColumnCount.-
Methods inherited from class com.mockobjects.MockObject
notImplemented, notYetImplemented, verify
-
-
-
-
Method Detail
-
setupGetColumnCount
public void setupGetColumnCount(int aColumnCount)
Value to return from getColumnCount.
-
setupAddColumnNames
public void setupAddColumnNames(java.lang.String[] allNames)
An array of column names in the order they appear in the resultSet.
-
setupAddColumnName
public void setupAddColumnName(java.lang.String aName)
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
public int getColumnCount() throws java.sql.SQLExceptionReturns value passed to setupGetColumnCount.- Specified by:
getColumnCountin interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.getColumnCount()
-
getColumnName
public java.lang.String getColumnName(int aColumnIndex) throws java.sql.SQLExceptionReturns 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:
getColumnNamein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.getColumnName(int)
-
addExpectedColumnNameIndex
public void addExpectedColumnNameIndex(int aColumnIndex)
Adds an expectation for a column index to be passed to getColumnName- See Also:
ResultSetMetaData.getColumnName(int)
-
getColumnType
public int getColumnType(int aColumnIndex) throws java.sql.SQLExceptionReturns 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:
getColumnTypein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.getColumnType(int)
-
addExpectedColumnTypeIndex
public void addExpectedColumnTypeIndex(int aColumnIndex)
Adds an expectation for a column index to be passed to getColumnType- See Also:
ResultSetMetaData.getColumnType(int)
-
isAutoIncrement
public boolean isAutoIncrement(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns false.- Specified by:
isAutoIncrementin interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.isAutoIncrement(int)
-
isCaseSensitive
public boolean isCaseSensitive(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns false.- Specified by:
isCaseSensitivein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.isCaseSensitive(int)
-
isSearchable
public boolean isSearchable(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns false.- Specified by:
isSearchablein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.isSearchable(int)
-
isCurrency
public boolean isCurrency(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns false.- Specified by:
isCurrencyin interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.isCurrency(int)
-
isNullable
public int isNullable(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns false.- Specified by:
isNullablein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.isNullable(int)
-
isSigned
public boolean isSigned(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns false.- Specified by:
isSignedin interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.isSigned(int)
-
getColumnDisplaySize
public int getColumnDisplaySize(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns 0.- Specified by:
getColumnDisplaySizein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.getColumnDisplaySize(int)
-
getColumnLabel
public java.lang.String getColumnLabel(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns null.- Specified by:
getColumnLabelin interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.getColumnLabel(int)
-
getColumnTypeName
public java.lang.String getColumnTypeName(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns null.- Specified by:
getColumnTypeNamein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.getColumnTypeName(int)
-
getSchemaName
public java.lang.String getSchemaName(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns null.- Specified by:
getSchemaNamein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.getSchemaName(int)
-
getPrecision
public int getPrecision(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns 0.- Specified by:
getPrecisionin interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.getPrecision(int)
-
getScale
public int getScale(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns 0.- Specified by:
getScalein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.getScale(int)
-
getTableName
public java.lang.String getTableName(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns null.- Specified by:
getTableNamein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.getTableName(int)
-
getCatalogName
public java.lang.String getCatalogName(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns null.- Specified by:
getCatalogNamein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.getCatalogName(int)
-
isReadOnly
public boolean isReadOnly(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns false.- Specified by:
isReadOnlyin interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.isReadOnly(int)
-
isWritable
public boolean isWritable(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns false.- Specified by:
isWritablein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.isWritable(int)
-
isDefinitelyWritable
public boolean isDefinitelyWritable(int arg0) throws java.sql.SQLExceptionCalls notImplemented. Returns false.- Specified by:
isDefinitelyWritablein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.isDefinitelyWritable(int)
-
setupAddColumnClassNames
public void setupAddColumnClassNames(java.lang.String[] allNames)
An array of column class names in the order they appear in the resultSet.
-
setupAddColumnClassName
public void setupAddColumnClassName(java.lang.String aName)
The next column class name in the resultSet.
-
getColumnClassName
public java.lang.String getColumnClassName(int aColumnIndex) throws java.sql.SQLExceptionReturns 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:
getColumnClassNamein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- See Also:
ResultSetMetaData.getColumnClassName(int)
-
addExpectedColumnClassNameIndex
public void addExpectedColumnClassNameIndex(int aColumnIndex)
Adds an expectation for a column index to be passed to getColumnClassName- See Also:
ResultSetMetaData.getColumnClassName(int)
-
-