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 "error_logging.hpp" 19 20 #include <gmock/gmock.h> 21 22 namespace phosphor::power::regulators 23 { 24 25 /** 26 * @class MockErrorLogging 27 * 28 * Mock implementation of the ErrorLogging interface. 29 */ 30 class MockErrorLogging : public ErrorLogging 31 { 32 public: 33 // Specify which compiler-generated methods we want 34 MockErrorLogging() = default; 35 MockErrorLogging(const MockErrorLogging&) = delete; 36 MockErrorLogging(MockErrorLogging&&) = delete; 37 MockErrorLogging& operator=(const MockErrorLogging&) = delete; 38 MockErrorLogging& operator=(MockErrorLogging&&) = delete; 39 virtual ~MockErrorLogging() = default; 40 41 MOCK_METHOD(void, logConfigFileError, 42 (Entry::Level severity, Journal& journal), (override)); 43 44 MOCK_METHOD(void, logDBusError, (Entry::Level severity, Journal& journal), 45 (override)); 46 47 MOCK_METHOD(void, logI2CError, 48 (Entry::Level severity, Journal& journal, 49 const std::string& bus, uint8_t addr, int errorNumber), 50 (override)); 51 52 MOCK_METHOD(void, logInternalError, 53 (Entry::Level severity, Journal& journal), (override)); 54 55 MOCK_METHOD(void, logPMBusError, 56 (Entry::Level severity, Journal& journal, 57 const std::string& inventoryPath), 58 (override)); 59 60 MOCK_METHOD(void, logWriteVerificationError, 61 (Entry::Level severity, Journal& journal, 62 const std::string& inventoryPath), 63 (override)); 64 }; 65 66 } // namespace phosphor::power::regulators 67