xref: /openbmc/pldm/common/test/mocked_utils.hpp (revision 21f128d8)
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 /** @brief helper function for parameter matching
11  *  @param[in] lhs - left-hand side value
12  *  @param[in] rhs - right-hand side value
13  *  @return true if it matches
14  */
15 inline bool operator==(const DBusMapping& lhs, const DBusMapping& rhs)
16 {
17     return lhs.objectPath == rhs.objectPath && lhs.interface == rhs.interface &&
18            lhs.propertyName == rhs.propertyName &&
19            lhs.propertyType == rhs.propertyType;
20 }
21 
22 } // namespace utils
23 } // namespace pldm
24 
25 class MockdBusHandler : public pldm::utils::DBusHandler
26 {
27   public:
28     MOCK_METHOD(std::string, getService, (const char*, const char*),
29                 (const override));
30 
31     MOCK_METHOD(void, setDbusProperty,
32                 (const pldm::utils::DBusMapping&,
33                  const pldm::utils::PropertyValue&),
34                 (const override));
35 
36     MOCK_METHOD(pldm::utils::PropertyValue, getDbusPropertyVariant,
37                 (const char*, const char*, const char*), (const override));
38 
39     MOCK_METHOD(pldm::utils::GetSubTreeResponse, getSubtree,
40                 (const std::string&, int, const std::vector<std::string>&),
41                 (const override));
42 };
43