1 /*
2  * Copyright (C) 2023 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 OHOS_CLOUD_DISK_CLOUDDISK_RESULTSET_MOCK_H
17 #define OHOS_CLOUD_DISK_CLOUDDISK_RESULTSET_MOCK_H
18 
19 #include "result_set.h"
20 
21 #include <gmock/gmock.h>
22 #include <gtest/gtest.h>
23 namespace OHOS::FileManagement::CloudDisk::Test {
24 using namespace testing;
25 using namespace testing::ext;
26 using namespace std;
27 using namespace NativeRdb;
28 class ResultSetMock : public ResultSet {
29 public:
~ResultSetMock()30     ~ResultSetMock() {}
31     MOCK_METHOD1(GetAllColumnNames, int(std::vector<std::string> &));
32     MOCK_METHOD1(GetColumnCount, int(int &));
33     MOCK_METHOD2(GetColumnType, int(int, ColumnType &));
34     MOCK_METHOD2(GetColumnIndex, int(const std::string &, int &));
35     MOCK_METHOD2(GetColumnName, int(int, std::string &));
36     MOCK_METHOD1(GetRowCount, int(int &));
37     MOCK_METHOD1(GoTo, int(int));
38     MOCK_METHOD1(GoToRow, int(int));
39     MOCK_METHOD0(GoToFirstRow, int());
40     MOCK_METHOD0(GoToLastRow, int());
41     MOCK_METHOD0(GoToNextRow, int());
42     MOCK_METHOD0(GoToPreviousRow, int());
43     MOCK_METHOD1(IsEnded, int(bool &));
44     MOCK_METHOD1(IsAtLastRow, int(bool &));
45     MOCK_METHOD2(GetBlob, int(int, std::vector<uint8_t> &));
46     MOCK_METHOD2(GetString, int(int, std::string &));
47     MOCK_METHOD2(GetInt, int(int, int &));
48     MOCK_METHOD2(GetLong, int(int, int64_t &));
49     MOCK_METHOD2(GetDouble, int(int, double &));
50     MOCK_METHOD2(IsColumnNull, int(int, bool &));
51     MOCK_METHOD0(Close, int());
52     MOCK_METHOD1(GetRow, int(RowEntity &));
53     MOCK_METHOD2(ResultSetToFileInfo, int(shared_ptr<ResultSet>, CloudDiskFileInfo &));
54     MOCK_METHOD2(ResultSetToFileInfos, int(shared_ptr<ResultSet>, vector<CloudDiskFileInfo> &));
55 
56     MOCK_CONST_METHOD0(IsClosed, bool());
57     MOCK_CONST_METHOD1(GetRowIndex, int(int &));
58     MOCK_CONST_METHOD1(IsStarted, int(bool &));
59     MOCK_CONST_METHOD1(IsAtFirstRow, int(bool &));
60 
61     MOCK_METHOD2(GetAsset, int(int32_t, ValueObject::Asset &));
62     MOCK_METHOD2(GetAssets, int(int32_t, ValueObject::Assets &));
63     MOCK_METHOD2(Get, int(int32_t, ValueObject &));
64     MOCK_METHOD1(GetModifyTime, int(std::string &));
65     MOCK_METHOD2(GetSize, int(int32_t, size_t &));
66 };
67 } // namespace OHOS::FileManagement::CloudSync::Test
68 #endif