use of nl.topicus.jdbc.statement.CloudSpannerStatement in project spanner-jdbc by olavloite.
the class CloudSpannerResultSetMetaDataTest method setup.
@Before
public void setup() throws SQLException {
connection = mock(CloudSpannerConnection.class);
CloudSpannerStatement statement = mock(CloudSpannerStatement.class);
CloudSpannerResultSet resultSet = getFooTestResultSet(statement);
CloudSpannerDatabaseMetaData metadata = mock(CloudSpannerDatabaseMetaData.class);
when(metadata.getColumns(eq(""), eq(""), eq("FOO"), any())).then(new Answer<CloudSpannerResultSet>() {
@Override
public CloudSpannerResultSet answer(InvocationOnMock invocation) throws Throwable {
return createFooColumnsResultSet(statement, invocation.getArgument(3));
}
});
when(metadata.getPrimaryKeys("", "", "FOO")).then(new Answer<CloudSpannerResultSet>() {
@Override
public CloudSpannerResultSet answer(InvocationOnMock invocation) throws Throwable {
return createFooPrimaryKeysResultSet(statement);
}
});
when(connection.getMetaData()).then(new Returns(metadata));
when(connection.isReportDefaultSchemaAsNull()).thenCallRealMethod();
when(connection.setReportDefaultSchemaAsNull(anyBoolean())).thenCallRealMethod();
when(connection.getSchema()).thenCallRealMethod();
when(connection.getCatalog()).thenCallRealMethod();
when(statement.getConnection()).then(new Returns(connection));
subject = resultSet.getMetaData();
}
Aggregations