10Duke Scale C++ Client
Loading...
Searching...
No Matches
JSONNumberMock.h
1#ifndef TENDUKE_TEST_MOCKS_JSONNUMBERMOCK_H
2#define TENDUKE_TEST_MOCKS_JSONNUMBERMOCK_H
3
4#include "json/JSONNumber.h"
5#include "gmock/gmock.h"
6
7namespace tenduke { namespace test { namespace mocks {
8
10{
11public:
12 MOCK_METHOD(enum Type, getType, (), (const, override));
13 MOCK_METHOD(std::string, asString, (), (const, override));
14 MOCK_METHOD(double, getValue, (), (const, override));
15
16 static JSONNumberMock * create(const double value)
17 {
18 auto mock = new JSONNumberMock();
19 EXPECT_CALL(*mock, getType()).WillRepeatedly(::testing::Return(tenduke::json::JSONElement::Type::NUMBER));
20 EXPECT_CALL(*mock, getValue()).WillRepeatedly(::testing::Return(value));
21 EXPECT_CALL(*mock, asString()).WillRepeatedly(::testing::Return(std::to_string(value)));
22
23 return mock;
24 }
25 static std::unique_ptr<JSONNumberMock> createUnique(const double value)
26 {
27 return std::unique_ptr<JSONNumberMock>(create(value));
28 }
29 static std::shared_ptr<JSONNumberMock> createShared(const double value)
30 {
31 return std::shared_ptr<JSONNumberMock>(create(value));
32 }
33
34};
35
36}}}
37
38#endif //TENDUKE_TEST_MOCKS_JSONNUMBERMOCK_H
virtual enum Type getType() const =0
Returns type of this element.
virtual std::string asString() const =0
Returns string representation of this element.
Type
Type of the element.
Definition JSONElement.h:17
Represents JSON number.
Definition JSONNumber.h:12
virtual double getValue() const =0
Returns the value.
Definition JSONNumberMock.h:10
Root for classes, functions and globals of 10Duke C++ Client.
Definition BackendConfiguration.h:7