Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "interfaces/metric.hpp" |
| 4 | |
| 5 | #include <gmock/gmock.h> |
| 6 | |
| 7 | class MetricMock : public interfaces::Metric |
| 8 | { |
| 9 | public: |
| 10 | MetricMock() |
| 11 | { |
| 12 | using namespace testing; |
| 13 | |
Krzysztof Grobelny | 9e8da54 | 2022-02-17 10:40:16 +0100 | [diff] [blame^] | 14 | ON_CALL(*this, getUpdatedReadings()) |
| 15 | .WillByDefault(ReturnRefOfCopy(std::vector<MetricValue>())); |
Krzysztof Grobelny | f7ea299 | 2022-01-27 11:04:58 +0100 | [diff] [blame] | 16 | ON_CALL(*this, sensorCount).WillByDefault(InvokeWithoutArgs([this] { |
Krzysztof Grobelny | 9e8da54 | 2022-02-17 10:40:16 +0100 | [diff] [blame^] | 17 | return getUpdatedReadings().size(); |
Krzysztof Grobelny | f7ea299 | 2022-01-27 11:04:58 +0100 | [diff] [blame] | 18 | })); |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 19 | } |
| 20 | |
Krzysztof Grobelny | 6ccfcbf | 2020-11-04 09:31:36 +0100 | [diff] [blame] | 21 | MOCK_METHOD(void, initialize, (), (override)); |
Lukasz Kazmierczak | 7e098e9 | 2021-09-16 15:59:56 +0200 | [diff] [blame] | 22 | MOCK_METHOD(void, deinitialize, (), (override)); |
Krzysztof Grobelny | 9e8da54 | 2022-02-17 10:40:16 +0100 | [diff] [blame^] | 23 | MOCK_METHOD(const std::vector<MetricValue>&, getUpdatedReadings, (), |
| 24 | (override)); |
Krzysztof Grobelny | d223819 | 2020-12-02 09:27:28 +0000 | [diff] [blame] | 25 | MOCK_METHOD(LabeledMetricParameters, dumpConfiguration, (), |
| 26 | (const, override)); |
Krzysztof Grobelny | f7ea299 | 2022-01-27 11:04:58 +0100 | [diff] [blame] | 27 | MOCK_METHOD(uint64_t, sensorCount, (), (const, override)); |
| 28 | MOCK_METHOD(void, registerForUpdates, (interfaces::MetricListener&), |
| 29 | (override)); |
| 30 | MOCK_METHOD(void, unregisterFromUpdates, (interfaces::MetricListener&), |
| 31 | (override)); |
| 32 | MOCK_METHOD(void, updateReadings, (Milliseconds), (override)); |
| 33 | MOCK_METHOD(bool, isTimerRequired, (), (const, override)); |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 34 | }; |