xref: /openbmc/telemetry/tests/src/mocks/report_mock.hpp (revision 5ade2b1d0ccb71a3de23396dea77c375bedc0362)
1 #pragma once
2 
3 #include "interfaces/report.hpp"
4 
5 #include <gmock/gmock.h>
6 
7 class ReportMock : public interfaces::Report
8 {
9   public:
10     ReportMock(std::string reportName)
11     {
12         using namespace testing;
13 
14         ON_CALL(*this, getName).WillByDefault([reportName] {
15             return reportName;
16         });
17         ON_CALL(*this, getPath).WillByDefault([reportName] {
18             return "/" + reportName;
19         });
20 
21         EXPECT_CALL(*this, getPath).Times(AnyNumber());
22         EXPECT_CALL(*this, getName).Times(AnyNumber());
23         EXPECT_CALL(*this, Die).Times(AnyNumber());
24     }
25 
26     virtual ~ReportMock()
27     {
28         Die();
29     }
30 
31     MOCK_METHOD(std::string, getName, (), (override, const));
32     MOCK_METHOD(std::string, getPath, (), (override, const));
33     MOCK_METHOD(void, Die, ());
34 };
35