Google Cloud BigQuery C++ Client 2.11.0
A C++ Client Library for Google Cloud BigQuery
Loading...
Searching...
No Matches
mock_dataset_connection.h
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGQUERY_V2_MINIMAL_MOCKS_MOCK_DATASET_CONNECTION_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGQUERY_V2_MINIMAL_MOCKS_MOCK_DATASET_CONNECTION_H
17
18#include "google/cloud/bigquery/v2/minimal/internal/dataset_connection.h"
19#include <gmock/gmock.h>
20
21namespace google {
22namespace cloud {
24GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
25
26/*
27 * A class to mock `DatasetConnection`.
28 *
29 * Application developers may want to test their code with simulated responses,
30 * including errors, from an object of type `DatasetClient`. To do so,
31 * construct an object of type `DatasetClient` with an instance of this
32 * class. Then use the Google Test framework functions to program the behavior
33 * of this mock.
34 */
35// TODO(#11039): Move to "bigquery_v2_minimal_mocks" namespace when api is ready
36// to go public.
37class MockDatasetConnection : public DatasetConnection {
38 public:
39 MOCK_METHOD(Options, options, (), (override));
40
41 MOCK_METHOD(StatusOr<Dataset>, GetDataset, (GetDatasetRequest const& request),
42 (override));
43
44 MOCK_METHOD(StreamRange<ListFormatDataset>, ListDatasets,
45 (ListDatasetsRequest const& request), (override));
46};
47
48GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
49} // namespace bigquery_v2_minimal_internal
50} // namespace cloud
51} // namespace google
52
53#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGQUERY_V2_MINIMAL_MOCKS_MOCK_DATASET_CONNECTION_H
Definition: mock_dataset_connection.h:23