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