10Duke Scale C++ Client
Loading...
Searching...
No Matches
JSONStringMock.h
1#ifndef TENDUKE_TEST_MOCKS_JSONSTRINGMOCK_H
2#define TENDUKE_TEST_MOCKS_JSONSTRINGMOCK_H
3
4#include "json/JSONString.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, asJSON, (), (const, override));
14 MOCK_METHOD(std::string, asString, (), (const, override));
15 MOCK_METHOD(std::string, getValue, (), (const, override));
16
17 static JSONStringMock * create(std::string value)
18 {
19 auto mock = new JSONStringMock();
20 EXPECT_CALL(*mock, getType()).WillRepeatedly(::testing::Return(tenduke::json::JSONElement::Type::STRING));
21 EXPECT_CALL(*mock, getValue()).WillRepeatedly(::testing::Return(value));
22 EXPECT_CALL(*mock, asString()).WillRepeatedly(::testing::Return(value));
23
24 return mock;
25 }
26 static std::unique_ptr<JSONStringMock> createUnique(std::string value)
27 {
28 return std::unique_ptr<JSONStringMock>(create(std::move(value)));
29 }
30 static std::shared_ptr<JSONStringMock> createShared(std::string value)
31 {
32 return std::shared_ptr<JSONStringMock>(create(std::move(value)));
33 }
34};
35
36}}}
37
38#endif //TENDUKE_TEST_MOCKS_JSONSTRINGMOCK_H
virtual enum Type getType() const =0
Returns type of this element.
virtual std::string asString() const =0
Gets the value of the element as a string.
virtual std::string asJSON() const =0
Serializes the element as JSON.
Type
Type of the element.
Definition JSONElement.h:17
JSON string element.
Definition JSONString.h:14
virtual std::string getValue() const =0
Returns the value of this string.
Definition JSONStringMock.h:10
Root for classes, functions and globals of 10Duke C++ Client.
Definition AbstractClientFactory.h:16