• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 Huawei Device Co., Ltd.
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  *     http://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 
16 #ifndef DATASHARE_RESULT_SET_MOCK_H
17 #define DATASHARE_RESULT_SET_MOCK_H
18 #include <gmock/gmock.h>
19 #include "datashare_result_set.h"
20 
21 namespace OHOS {
22 namespace Telephony {
23 using namespace DataShare;
24 class DataShareResultSetMock : public DataShareResultSet {
25 public:
26     MOCK_METHOD(int, GetRowCount, (int &count), (override));
27     MOCK_METHOD(int, GetAllColumnNames, (std::vector<std::string> &columnNames), (override));
28     MOCK_METHOD(int, GetBlob, (int columnIndex, std::vector<uint8_t> &blob), (override));
29     MOCK_METHOD(int, GetString, (int columnIndex, std::string &value), (override));
30     MOCK_METHOD(int, GetInt, (int columnIndex, int &value), (override));
31     MOCK_METHOD(int, GetLong, (int columnIndex, int64_t &value), (override));
32     MOCK_METHOD(int, GetDouble, (int columnIndex, double &value), (override));
33     MOCK_METHOD(int, IsColumnNull, (int columnIndex, bool &isNull), (override));
34     MOCK_METHOD(int, GoToRow, (int position), (override));
35     MOCK_METHOD(int, GetDataType, (int columnIndex, DataType &dataType), (override));
36     MOCK_METHOD(int, GetRowIndex, (int &position), (const override));
37     MOCK_METHOD(int, GoTo, (int offset), (override));
38     MOCK_METHOD(int, GoToFirstRow, (), (override));
39     MOCK_METHOD(int, GoToLastRow, (), (override));
40     MOCK_METHOD(int, GoToNextRow, (), (override));
41     MOCK_METHOD(int, GoToPreviousRow, (), (override));
42     MOCK_METHOD(int, IsAtFirstRow, (bool &result), (const override));
43     MOCK_METHOD(int, IsAtLastRow, (bool &result), (override));
44     MOCK_METHOD(int, IsStarted, (bool &result), (const override));
45     MOCK_METHOD(int, IsEnded, (bool &result), (override));
46     MOCK_METHOD(int, GetColumnCount, (int &count), (override));
47     MOCK_METHOD(int, GetColumnIndex, (const std::string &columnName, int &columnIndex), (override));
48     MOCK_METHOD(int, GetColumnName, (int columnIndex, std::string &columnName), (override));
49     MOCK_METHOD(bool, IsClosed, (), (const override));
50     MOCK_METHOD(int, Close, (), (override));
51     MOCK_METHOD(std::shared_ptr<AppDataFwk::SharedBlock>, GetBlock, (), (override));
52     MOCK_METHOD(bool, OnGo, (int startRowIndex, int targetRowIndex, int *cachedIndex), (override));
53     MOCK_METHOD(void, FillBlock, (int startRowIndex, AppDataFwk::SharedBlock *block), (override));
54     MOCK_METHOD(void, SetBlock, (AppDataFwk::SharedBlock *block), (override));
55     MOCK_METHOD(void, Finalize, (), (override));
56 };
57 } // Telephony
58 } // OHOS
59 #endif