use of com.google.cloud.bigtable.grpc.BigtableInstanceName in project simple-bigtable by spotify.
the class BigtableMock method getMock.
public static BigtableMock getMock() {
final BigtableDataClient dataClient = Mockito.mock(BigtableDataClient.class);
final BigtableTableAdminClient tableAdminClient = Mockito.mock(BigtableTableAdminClient.class);
final BigtableSession session = Mockito.mock(BigtableSession.class);
final BigtableOptions options = Mockito.mock(BigtableOptions.class);
try {
Mockito.when(session.getDataClient()).thenReturn(dataClient);
Mockito.when(session.getTableAdminClient()).thenReturn(tableAdminClient);
Mockito.when(session.getOptions()).thenReturn(options);
Mockito.when(options.getInstanceName()).thenReturn(new BigtableInstanceName(PROJECT_ID, INSTANCE_ID));
} catch (IOException e) {
throw new RuntimeException(e);
}
return new BigtableMock(session, PROJECT_ID, INSTANCE_ID);
}
Aggregations