1 /**
2  * Copyright © 2020 IBM Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include "journal.hpp"
19 
20 #include <string>
21 #include <vector>
22 
23 #include <gmock/gmock.h>
24 
25 namespace phosphor::power::regulators
26 {
27 
28 /**
29  * @class MockJournal
30  *
31  * Mock implementation of the Journal interface.
32  */
33 class MockJournal : public Journal
34 {
35   public:
36     // Specify which compiler-generated methods we want
37     MockJournal() = default;
38     MockJournal(const MockJournal&) = delete;
39     MockJournal(MockJournal&&) = delete;
40     MockJournal& operator=(const MockJournal&) = delete;
41     MockJournal& operator=(MockJournal&&) = delete;
42     virtual ~MockJournal() = default;
43 
44     MOCK_METHOD(std::vector<std::string>, getMessages,
45                 (const std::string& field, const std::string& fieldValue,
46                  unsigned int max),
47                 (override));
48     MOCK_METHOD(void, logDebug, (const std::string& message), (override));
49     MOCK_METHOD(void, logDebug, (const std::vector<std::string>& messages),
50                 (override));
51     MOCK_METHOD(void, logError, (const std::string& message), (override));
52     MOCK_METHOD(void, logError, (const std::vector<std::string>& messages),
53                 (override));
54     MOCK_METHOD(void, logInfo, (const std::string& message), (override));
55     MOCK_METHOD(void, logInfo, (const std::vector<std::string>& messages),
56                 (override));
57 };
58 
59 } // namespace phosphor::power::regulators
60