blob: 0dcb2b5f7ba499eb012db389ee4b62b9e982b103 [file] [log] [blame]
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +02001#pragma once
2
3#include "interfaces/sensor.hpp"
4#include "utils/generate_unique_mock_id.hpp"
5
6#include <gmock/gmock.h>
7
8class SensorMock : public interfaces::Sensor
9{
10 public:
11 explicit SensorMock(Id sensorId) : mockSensorId(sensorId)
12 {
13 ON_CALL(*this, id()).WillByDefault(testing::Invoke([this] {
14 return this->mockSensorId;
15 }));
16 }
17
18 static Id makeId(std::string_view service, std::string_view path)
19 {
20 return Id("SensorMock", service, path);
21 }
22
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020023 MOCK_METHOD(Id, id, (), (const, override));
24 MOCK_METHOD(void, registerForUpdates,
25 (const std::weak_ptr<interfaces::SensorListener>&), (override));
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020026
27 const uint64_t mockId = generateUniqueMockId();
28
29 Id mockSensorId = Id("SensorMock", "", "");
30};