10Duke Scale C++ Client
Loading...
Searching...
No Matches
JSONArrayMock.h
1#ifndef TENDUKE_TEST_MOCKS_JSONARRAYMOCK_H
2#define TENDUKE_TEST_MOCKS_JSONARRAYMOCK_H
3
4#include "json/JSONArray.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(bool, isEmpty, (), (const, override));
16 MOCK_METHOD(std::size_t, getSize, (), (const, override));
17 MOCK_METHOD((const std::vector<std::shared_ptr<JSONElement>> &) , getValues, (), (const, override));
18
19 static JSONArrayMock * create()
20 {
21 auto mock = new JSONArrayMock();
22 EXPECT_CALL(*mock, getType()).WillRepeatedly(::testing::Return(tenduke::json::JSONElement::Type::ARRAY));
23
24 return mock;
25 }
26
27 static std::shared_ptr<JSONArrayMock> createShared()
28 {
29 return std::shared_ptr<JSONArrayMock>(create());
30 }
31
32};
33
34}}}
35
36#endif //TENDUKE_TEST_MOCKS_JSONARRAYMOCK_H
A JSON array.
Definition JSONArray.h:16
virtual std::size_t getSize() const =0
Returns number of elements in the array.
virtual bool isEmpty() const =0
Checks if the array is empty.
virtual const std::vector< std::shared_ptr< JSONElement > > & getValues() const =0
Returns the elements of the array.
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
Definition JSONArrayMock.h:10
Root for classes, functions and globals of 10Duke C++ Client.
Definition AbstractClientFactory.h:16