Package com.mockobjects.sql

# Class MockResultSetMetaData

java.lang.Object
com.mockobjects.MockObject
com.mockobjects.sql.MockResultSetMetaData

All Implemented Interfaces:
  `Verifiable`, `ResultSetMetaData`, `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.

## Field Summary

### Fields inherited from interface java.sql.ResultSetMetaData

`columnNoNulls, columnNullable, columnNullableUnknown`

## Constructor Summary

Constructors
Constructor
Description
`MockResultSetMetaData()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addExpectedColumnClassNameIndex(int aColumnIndex)`
Adds an expectation for a column index to be passed to getColumnClassName
`void`
`addExpectedColumnNameIndex(int aColumnIndex)`
Adds an expectation for a column index to be passed to getColumnName
`void`
`addExpectedColumnTypeIndex(int aColumnIndex)`
Adds an expectation for a column index to be passed to getColumnType
`String`
`getCatalogName(int arg0)`
Calls notImplemented.
`String`
`getColumnClassName(int aColumnIndex)`
Returns the column class name.
`int`
`getColumnCount()`
Returns value passed to setupGetColumnCount.
`int`
`getColumnDisplaySize(int arg0)`
Calls notImplemented.
`String`
`getColumnLabel(int arg0)`
Calls notImplemented.
`String`
`getColumnName(int aColumnIndex)`
Returns the column name.
`int`
`getColumnType(int aColumnIndex)`
Returns the column SQL type.
`String`
`getColumnTypeName(int arg0)`
Calls notImplemented.
`int`
`getPrecision(int arg0)`
Calls notImplemented.
`int`
`getScale(int arg0)`
Calls notImplemented.
`String`
`getSchemaName(int arg0)`
Calls notImplemented.
`String`
`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

public void setupAddColumnNames(String[] allNames)
An array of column names in the order they appear in the resultSet.

### setupAddColumnName

public void setupAddColumnName(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 SQLException
Returns value passed to setupGetColumnCount.

Specified by:
  `getColumnCount` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.getColumnCount()`

### getColumnName

public String getColumnName(int aColumnIndex) throws SQLException
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 interface `ResultSetMetaData`
Throws:
  `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 SQLException
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 interface `ResultSetMetaData`
Throws:
  `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 SQLException
Calls notImplemented. Returns false.

Specified by:
  `isAutoIncrement` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.isAutoIncrement(int)`

### isCaseSensitive

public boolean isCaseSensitive(int arg0) throws SQLException
Calls notImplemented. Returns false.

Specified by:
  `isCaseSensitive` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.isCaseSensitive(int)`

### isSearchable

public boolean isSearchable(int arg0) throws SQLException
Calls notImplemented. Returns false.

Specified by:
  `isSearchable` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.isSearchable(int)`

### isCurrency

public boolean isCurrency(int arg0) throws SQLException
Calls notImplemented. Returns false.

Specified by:
  `isCurrency` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.isCurrency(int)`

### isNullable

public int isNullable(int arg0) throws SQLException
Calls notImplemented. Returns false.

Specified by:
  `isNullable` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.isNullable(int)`

### isSigned

public boolean isSigned(int arg0) throws SQLException
Calls notImplemented. Returns false.

Specified by:
  `isSigned` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.isSigned(int)`

### getColumnDisplaySize

public int getColumnDisplaySize(int arg0) throws SQLException
Calls notImplemented. Returns 0.

Specified by:
  `getColumnDisplaySize` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.getColumnDisplaySize(int)`

### getColumnLabel

public String getColumnLabel(int arg0) throws SQLException
Calls notImplemented. Returns null.

Specified by:
  `getColumnLabel` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.getColumnLabel(int)`

### getColumnTypeName

public String getColumnTypeName(int arg0) throws SQLException
Calls notImplemented. Returns null.

Specified by:
  `getColumnTypeName` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.getColumnTypeName(int)`

### getSchemaName

public String getSchemaName(int arg0) throws SQLException
Calls notImplemented. Returns null.

Specified by:
  `getSchemaName` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.getSchemaName(int)`

### getPrecision

public int getPrecision(int arg0) throws SQLException
Calls notImplemented. Returns 0.

Specified by:
  `getPrecision` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.getPrecision(int)`

### getScale

public int getScale(int arg0) throws SQLException
Calls notImplemented. Returns 0.

Specified by:
  `getScale` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.getScale(int)`

### getTableName

public String getTableName(int arg0) throws SQLException
Calls notImplemented. Returns null.

Specified by:
  `getTableName` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.getTableName(int)`

### getCatalogName

public String getCatalogName(int arg0) throws SQLException
Calls notImplemented. Returns null.

Specified by:
  `getCatalogName` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.getCatalogName(int)`

### isReadOnly

public boolean isReadOnly(int arg0) throws SQLException
Calls notImplemented. Returns false.

Specified by:
  `isReadOnly` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.isReadOnly(int)`

### isWritable

public boolean isWritable(int arg0) throws SQLException
Calls notImplemented. Returns false.

Specified by:
  `isWritable` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.isWritable(int)`

### isDefinitelyWritable

public boolean isDefinitelyWritable(int arg0) throws SQLException
Calls notImplemented. Returns false.

Specified by:
  `isDefinitelyWritable` in interface `ResultSetMetaData`
Throws:
  `SQLException`
See Also:
  - `ResultSetMetaData.isDefinitelyWritable(int)`

### setupAddColumnClassNames

public void setupAddColumnClassNames(String[] allNames)
An array of column class names in the order they appear in the resultSet.

### setupAddColumnClassName

public void setupAddColumnClassName(String aName)
The next column class name in the resultSet.

### getColumnClassName

public String getColumnClassName(int aColumnIndex) throws SQLException
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 interface `ResultSetMetaData`
Throws:
  `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)`