xref: /openbmc/pldm/common/test/mocked_utils.hpp (revision fe6f0d40)
1 #include "common/utils.hpp"
2 
3 #include <gmock/gmock.h>
4 #include <gtest/gtest.h>
5 
6 namespace pldm
7 {
8 namespace utils
9 {
10 
11 /** @brief helper function for parameter matching
12  *  @param[in] lhs - left-hand side value
13  *  @param[in] rhs - right-hand side value
14  *  @return true if it matches
15  */
16 inline bool operator==(const DBusMapping& lhs, const DBusMapping& rhs)
17 {
18     return lhs.objectPath == rhs.objectPath && lhs.interface == rhs.interface &&
19            lhs.propertyName == rhs.propertyName &&
20            lhs.propertyType == rhs.propertyType;
21 }
22 
23 } // namespace utils
24 } // namespace pldm
25 
26 using namespace pldm::utils;
27 
28 class MockdBusHandler : public DBusHandler
29 {
30   public:
31     MOCK_METHOD(std::string, getService, (const char*, const char*),
32                 (const override));
33 
34     MOCK_METHOD(void, setDbusProperty,
35                 (const DBusMapping&, const PropertyValue&), (const override));
36 
37     MOCK_METHOD(PropertyValue, getDbusPropertyVariant,
38                 (const char*, const char*, const char*), (const override));
39 };
40