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 14 ON_CALL(*this, getUpdatedReadings()) 15 .WillByDefault(ReturnRefOfCopy(std::vector<MetricValue>())); 16 ON_CALL(*this, sensorCount).WillByDefault(InvokeWithoutArgs([this] { 17 return getUpdatedReadings().size(); 18 })); 19 } 20 21 MOCK_METHOD(void, initialize, (), (override)); 22 MOCK_METHOD(void, deinitialize, (), (override)); 23 MOCK_METHOD(const std::vector<MetricValue>&, getUpdatedReadings, (), 24 (override)); 25 MOCK_METHOD(LabeledMetricParameters, dumpConfiguration, (), 26 (const, override)); 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)); 34 }; 35