Add ReportManager and Report unit tests
Introduced ReportFactory to seperate Report and ReportManager
unit tests. Implemented mocks for Report, ReportManager and
ReportFactory classes. Added tests for DBus Properties and Methods
provided by telemetry service.
Tested:
- Ran unit-tests with success
Change-Id: I1860e280d26ee4becc52de98dd65e5697d26b376
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
diff --git a/tests/src/mocks/report_mock.hpp b/tests/src/mocks/report_mock.hpp
new file mode 100644
index 0000000..4943421
--- /dev/null
+++ b/tests/src/mocks/report_mock.hpp
@@ -0,0 +1,34 @@
+#pragma once
+
+#include "interfaces/report.hpp"
+
+#include <gmock/gmock.h>
+
+class ReportMock : public interfaces::Report
+{
+ public:
+ ReportMock(std::string reportName)
+ {
+ using namespace testing;
+
+ ON_CALL(*this, getName).WillByDefault([reportName] {
+ return reportName;
+ });
+ ON_CALL(*this, getPath).WillByDefault([reportName] {
+ return "/" + reportName;
+ });
+
+ EXPECT_CALL(*this, getPath).Times(AnyNumber());
+ EXPECT_CALL(*this, getName).Times(AnyNumber());
+ EXPECT_CALL(*this, Die).Times(AnyNumber());
+ }
+
+ virtual ~ReportMock()
+ {
+ Die();
+ }
+
+ MOCK_METHOD(std::string, getName, (), (override, const));
+ MOCK_METHOD(std::string, getPath, (), (override, const));
+ MOCK_METHOD(void, Die, ());
+};