Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * Copyright (c) 2024 Muhammad Nawaz | ||
3 | * Licensed under the MIT License. See LICENSE file for more information. | ||
4 | */ | ||
5 | // [ END OF LICENSE c6bd0f49d040fca8d8a9cb05868e66aa63f0e2e0 ] | ||
6 | |||
7 | #include "validators/body_validator.hpp" | ||
8 | #include <gtest/gtest.h> | ||
9 | |||
10 | class TestBodyValidator: public ::testing::Test | ||
11 | { | ||
12 | protected: | ||
13 | 10 | void SetUp() override | |
14 | { | ||
15 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | schema_doc_.Parse(R"({ |
16 | "$schema": "http://json-schema.org/draft-05/schema#", | ||
17 | "title": "UserProfile", | ||
18 | "description": "A user profile with various attributes", | ||
19 | "type": "object", | ||
20 | "properties": { | ||
21 | "userId": { | ||
22 | "description": "The unique identifier for a user", | ||
23 | "type": "integer", | ||
24 | "minimum": 1 | ||
25 | }, | ||
26 | "username": { | ||
27 | "description": "The user's username", | ||
28 | "type": "string", | ||
29 | "minLength": 3, | ||
30 | "maxLength": 20, | ||
31 | "pattern": "^[a-zA-Z0-9_]+$" | ||
32 | }, | ||
33 | "email": { | ||
34 | "type": "string", | ||
35 | "format": "email" | ||
36 | }, | ||
37 | "age": { | ||
38 | "description": "Age in years which must be a positive integer", | ||
39 | "type": "integer", | ||
40 | "minimum": 18, | ||
41 | "maximum": 100 | ||
42 | }, | ||
43 | "phoneNumber": { | ||
44 | "type": ["string", "null"], | ||
45 | "pattern": "^\\+?[1-9]\\d{1,14}$" | ||
46 | }, | ||
47 | "address": { | ||
48 | "type": "object", | ||
49 | "properties": { | ||
50 | "street": {"type": "string"}, | ||
51 | "city": {"type": "string"}, | ||
52 | "state": {"type": "string"}, | ||
53 | "zipCode": { | ||
54 | "type": "string", | ||
55 | "pattern": "^\\d{5}(-\\d{4})?$" | ||
56 | } | ||
57 | }, | ||
58 | "required": ["street", "city", "state", "zipCode"], | ||
59 | "additionalProperties": false | ||
60 | }, | ||
61 | "subscriptionType": { | ||
62 | "type": "string", | ||
63 | "enum": ["basic", "premium", "gold"] | ||
64 | }, | ||
65 | "preferences": { | ||
66 | "type": "object", | ||
67 | "properties": { | ||
68 | "newsletter": { | ||
69 | "type": "boolean", | ||
70 | "default": false | ||
71 | }, | ||
72 | "themes": { | ||
73 | "type": "array", | ||
74 | "items": { | ||
75 | "type": "string", | ||
76 | "enum": ["light", "dark", "colorful"] | ||
77 | }, | ||
78 | "minItems": 1, | ||
79 | "uniqueItems": true | ||
80 | } | ||
81 | }, | ||
82 | "additionalProperties": false | ||
83 | }, | ||
84 | "createdAt": { | ||
85 | "type": "string", | ||
86 | "format": "date-time" | ||
87 | } | ||
88 | }, | ||
89 | "required": ["userId", "username", "email", "createdAt"], | ||
90 | "additionalProperties": false, | ||
91 | "dependencies": { | ||
92 | "phoneNumber": ["address"] | ||
93 | }, | ||
94 | "allOf": [ | ||
95 | { | ||
96 | "if": { | ||
97 | "properties": {"subscriptionType": {"const": "gold"}} | ||
98 | }, | ||
99 | "then": { | ||
100 | "properties": { | ||
101 | "preferences": { | ||
102 | "properties": { | ||
103 | "themes": { | ||
104 | "minItems": 2 | ||
105 | } | ||
106 | } | ||
107 | } | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | ], | ||
112 | "patternProperties": { | ||
113 | "^S_": { | ||
114 | "type": "string", | ||
115 | "minLength": 3 | ||
116 | } | ||
117 | } | ||
118 | })"); | ||
119 | std::vector<std::string> ref_keys{"paths", "/pets/test", "get", | ||
120 |
5/10✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 10 times.
✗ Branch 7 not taken.
✓ Branch 10 taken 10 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 10 times.
✗ Branch 15 not taken.
✓ Branch 18 taken 10 times.
✗ Branch 19 not taken.
|
70 | "requestBody/content/application%2Fjson/schema"}; |
121 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | validator_ = std::make_unique<BodyValidator>(schema_doc_, ref_keys); |
122 | 10 | } | |
123 | |||
124 | rapidjson::Document schema_doc_; | ||
125 | std::unique_ptr<BodyValidator> validator_; | ||
126 | }; | ||
127 | |||
128 | 8 | TEST_F(TestBodyValidator, ValidJson) | |
129 | { | ||
130 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | std::string json_str = R"({ |
131 | "userId": 12345, | ||
132 | "username": "johndoe_2023", | ||
133 | "email": "john.doe@example.com", | ||
134 | "age": 28, | ||
135 | "phoneNumber": "+12345678901", | ||
136 | "address": { | ||
137 | "street": "123 Main St", | ||
138 | "city": "Anytown", | ||
139 | "state": "CA", | ||
140 | "zipCode": "90210" | ||
141 | }, | ||
142 | "subscriptionType": "gold", | ||
143 | "preferences": { | ||
144 | "newsletter": true, | ||
145 | "themes": ["dark", "light"] | ||
146 | }, | ||
147 | "createdAt": "2023-04-05T08:00:00Z", | ||
148 | "S_example": "This is a pattern property" | ||
149 | })"; | ||
150 | 2 | std::string error_msg; | |
151 |
3/12✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
2 | EXPECT_EQ(validator_->Validate(json_str, error_msg), ValidationError::NONE); |
152 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_TRUE(error_msg.empty()); |
153 | 2 | } | |
154 | |||
155 | 8 | TEST_F(TestBodyValidator, InvalidParsing) | |
156 | { | ||
157 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | std::string json_str = R"({ |
158 | "userId": 12345 | ||
159 | "username": "johndoe_2023", | ||
160 | "email": "john.doe@example.com", | ||
161 | "age": 28, | ||
162 | "phoneNumber": "+12345678901", | ||
163 | "address": { | ||
164 | "street": "123 Main St", | ||
165 | "city": "Anytown", | ||
166 | "state": "CA", | ||
167 | "zipCode": "90210" | ||
168 | }, | ||
169 | "subscriptionType": "gold", | ||
170 | "preferences": { | ||
171 | "newsletter": true, | ||
172 | "themes": ["dark", "light"] | ||
173 | }, | ||
174 | "createdAt": "2023-04-05T08:00:00Z", | ||
175 | "S_example": "This is a pattern property" | ||
176 | })"; | ||
177 | 2 | std::string error_msg; | |
178 |
3/12✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
2 | EXPECT_EQ(validator_->Validate(json_str, error_msg), ValidationError::INVALID_BODY); |
179 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(error_msg.empty()); |
180 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | rapidjson::Document doc; |
181 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | doc.Parse(error_msg.c_str()); |
182 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(doc.HasParseError()); |
183 |
5/16✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
4 | EXPECT_EQ(std::string(doc["errorCode"].GetString()), "INVALID_BODY"); |
184 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["code"].GetString()), "parserError"); |
185 | 2 | } | |
186 | 8 | TEST_F(TestBodyValidator, InvalidIntegerType) | |
187 | { | ||
188 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | std::string json_str = R"({ |
189 | "userId": "not-an-integer", | ||
190 | "username": "johndoe_2023", | ||
191 | "email": "john.doe@example.com", | ||
192 | "age": 28, | ||
193 | "phoneNumber": "+12345678901", | ||
194 | "address": { | ||
195 | "street": "123 Main St", | ||
196 | "city": "Anytown", | ||
197 | "state": "CA", | ||
198 | "zipCode": "90210" | ||
199 | }, | ||
200 | "subscriptionType": "gold", | ||
201 | "preferences": { | ||
202 | "newsletter": true, | ||
203 | "themes": ["dark", "light"] | ||
204 | }, | ||
205 | "createdAt": "2023-04-05T08:00:00Z", | ||
206 | "S_example": "This is a pattern property" | ||
207 | })"; | ||
208 | 2 | std::string error_msg; | |
209 |
3/12✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
2 | EXPECT_EQ(validator_->Validate(json_str, error_msg), ValidationError::INVALID_BODY); |
210 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(error_msg.empty()); |
211 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | rapidjson::Document doc; |
212 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | doc.Parse(error_msg.c_str()); |
213 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(doc.HasParseError()); |
214 |
5/16✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
4 | EXPECT_EQ(std::string(doc["errorCode"].GetString()), "INVALID_BODY"); |
215 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["code"].GetString()), "type"); |
216 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["instance"].GetString()), "#/userId"); |
217 | 2 | } | |
218 | |||
219 | 8 | TEST_F(TestBodyValidator, InvalidStringType) | |
220 | { | ||
221 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | std::string json_str = R"({ |
222 | "userId": 12345, | ||
223 | "username": 123, | ||
224 | "email": "john.doe@example.com", | ||
225 | "age": 28, | ||
226 | "phoneNumber": "+12345678901", | ||
227 | "address": { | ||
228 | "street": "123 Main St", | ||
229 | "city": "Anytown", | ||
230 | "state": "CA", | ||
231 | "zipCode": "90210" | ||
232 | }, | ||
233 | "subscriptionType": "gold", | ||
234 | "preferences": { | ||
235 | "newsletter": true, | ||
236 | "themes": ["dark", "light"] | ||
237 | }, | ||
238 | "createdAt": "2023-04-05T08:00:00Z", | ||
239 | "S_example": "This is a pattern property" | ||
240 | })"; | ||
241 | 2 | std::string error_msg; | |
242 |
3/12✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
2 | EXPECT_EQ(validator_->Validate(json_str, error_msg), ValidationError::INVALID_BODY); |
243 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(error_msg.empty()); |
244 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | rapidjson::Document doc; |
245 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | doc.Parse(error_msg.c_str()); |
246 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(doc.HasParseError()); |
247 |
5/16✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
4 | EXPECT_EQ(std::string(doc["errorCode"].GetString()), "INVALID_BODY"); |
248 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["code"].GetString()), "type"); |
249 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["instance"].GetString()), "#/username"); |
250 | 2 | } | |
251 | |||
252 | 8 | TEST_F(TestBodyValidator, InvalidArrayUniqueItems) | |
253 | { | ||
254 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | std::string json_str = R"({ |
255 | "userId": 12345, | ||
256 | "username": "johndoe_2023", | ||
257 | "email": "john.doe@example.com", | ||
258 | "age": 28, | ||
259 | "phoneNumber": "+12345678901", | ||
260 | "address": { | ||
261 | "street": "123 Main St", | ||
262 | "city": "Anytown", | ||
263 | "state": "CA", | ||
264 | "zipCode": "90210" | ||
265 | }, | ||
266 | "subscriptionType": "gold", | ||
267 | "preferences": { | ||
268 | "newsletter": true, | ||
269 | "themes": ["dark", "dark", "light"] | ||
270 | }, | ||
271 | "createdAt": "2023-04-05T08:00:00Z", | ||
272 | "S_example": "This is a pattern property" | ||
273 | })"; | ||
274 | 2 | std::string error_msg; | |
275 |
3/12✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
2 | EXPECT_EQ(validator_->Validate(json_str, error_msg), ValidationError::INVALID_BODY); |
276 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(error_msg.empty()); |
277 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | rapidjson::Document doc; |
278 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | doc.Parse(error_msg.c_str()); |
279 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(doc.HasParseError()); |
280 |
5/16✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
4 | EXPECT_EQ(std::string(doc["errorCode"].GetString()), "INVALID_BODY"); |
281 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["code"].GetString()), "uniqueItems"); |
282 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["instance"].GetString()), "#/preferences/themes"); |
283 | 2 | } | |
284 | |||
285 | 8 | TEST_F(TestBodyValidator, InvalidIntegerMinimum) | |
286 | { | ||
287 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | std::string json_str = R"({ |
288 | "userId": 12345, | ||
289 | "username": "johndoe_2023", | ||
290 | "email": "john.doe@example.com", | ||
291 | "age": 17, | ||
292 | "phoneNumber": "+12345678901", | ||
293 | "address": { | ||
294 | "street": "123 Main St", | ||
295 | "city": "Anytown", | ||
296 | "state": "CA", | ||
297 | "zipCode": "90210" | ||
298 | }, | ||
299 | "subscriptionType": "gold", | ||
300 | "preferences": { | ||
301 | "newsletter": true, | ||
302 | "themes": ["dark"] | ||
303 | }, | ||
304 | "createdAt": "2023-04-05T08:00:00Z", | ||
305 | "S_example": "This is a pattern property" | ||
306 | })"; | ||
307 | 2 | std::string error_msg; | |
308 |
3/12✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
2 | EXPECT_EQ(validator_->Validate(json_str, error_msg), ValidationError::INVALID_BODY); |
309 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(error_msg.empty()); |
310 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | rapidjson::Document doc; |
311 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | doc.Parse(error_msg.c_str()); |
312 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(doc.HasParseError()); |
313 |
5/16✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
4 | EXPECT_EQ(std::string(doc["errorCode"].GetString()), "INVALID_BODY"); |
314 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["code"].GetString()), "minimum"); |
315 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["instance"].GetString()), "#/age"); |
316 | 2 | } | |
317 | |||
318 | 8 | TEST_F(TestBodyValidator, InvalidIntegerMaximim) | |
319 | { | ||
320 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | std::string json_str = R"({ |
321 | "userId": 12345, | ||
322 | "username": "johndoe_2023", | ||
323 | "email": "john.doe@example.com", | ||
324 | "age": 101, | ||
325 | "phoneNumber": "+12345678901", | ||
326 | "address": { | ||
327 | "street": "123 Main St", | ||
328 | "city": "Anytown", | ||
329 | "state": "CA", | ||
330 | "zipCode": "90210" | ||
331 | }, | ||
332 | "subscriptionType": "gold", | ||
333 | "preferences": { | ||
334 | "newsletter": true, | ||
335 | "themes": ["dark"] | ||
336 | }, | ||
337 | "createdAt": "2023-04-05T08:00:00Z", | ||
338 | "S_example": "This is a pattern property" | ||
339 | })"; | ||
340 | 2 | std::string error_msg; | |
341 |
3/12✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
2 | EXPECT_EQ(validator_->Validate(json_str, error_msg), ValidationError::INVALID_BODY); |
342 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(error_msg.empty()); |
343 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | rapidjson::Document doc; |
344 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | doc.Parse(error_msg.c_str()); |
345 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(doc.HasParseError()); |
346 |
5/16✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
4 | EXPECT_EQ(std::string(doc["errorCode"].GetString()), "INVALID_BODY"); |
347 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["code"].GetString()), "maximum"); |
348 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["instance"].GetString()), "#/age"); |
349 | 2 | } | |
350 | |||
351 | 8 | TEST_F(TestBodyValidator, InvalidRequired) | |
352 | { | ||
353 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | std::string json_str = R"({ |
354 | "userId": 12345, | ||
355 | "username": "johndoe_2023", | ||
356 | "email": "john.doe@example.com", | ||
357 | "age": 28, | ||
358 | "phoneNumber": "+12345678901", | ||
359 | "address": { | ||
360 | "street": "123 Main St", | ||
361 | "zipCode": "90210" | ||
362 | }, | ||
363 | "subscriptionType": "gold", | ||
364 | "preferences": { | ||
365 | "newsletter": true, | ||
366 | "themes": ["dark"] | ||
367 | }, | ||
368 | "createdAt": "2023-04-05T08:00:00Z", | ||
369 | "S_example": "This is a pattern property" | ||
370 | })"; | ||
371 | 2 | std::string error_msg; | |
372 |
3/12✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
2 | EXPECT_EQ(validator_->Validate(json_str, error_msg), ValidationError::INVALID_BODY); |
373 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(error_msg.empty()); |
374 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | rapidjson::Document doc; |
375 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | doc.Parse(error_msg.c_str()); |
376 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(doc.HasParseError()); |
377 |
5/16✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
4 | EXPECT_EQ(std::string(doc["errorCode"].GetString()), "INVALID_BODY"); |
378 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["code"].GetString()), "required"); |
379 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["instance"].GetString()), "#/address"); |
380 | 2 | } | |
381 | |||
382 | 8 | TEST_F(TestBodyValidator, InvalidPatternProp) | |
383 | { | ||
384 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | std::string json_str = R"({ |
385 | "userId": 12345, | ||
386 | "username": "johndoe_2023", | ||
387 | "email": "john.doe@example.com", | ||
388 | "age": 28, | ||
389 | "phoneNumber": "+12345678901", | ||
390 | "address": { | ||
391 | "street": "123 Main St", | ||
392 | "city": "Anytown", | ||
393 | "state": "CA", | ||
394 | "zipCode": "90210" | ||
395 | }, | ||
396 | "subscriptionType": "gold", | ||
397 | "preferences": { | ||
398 | "newsletter": true, | ||
399 | "themes": ["dark"] | ||
400 | }, | ||
401 | "createdAt": "2023-04-01T14:30:00Z", | ||
402 | "S_": "This should be invalid", | ||
403 | "S_example": "Valid pattern property", | ||
404 | "T_example": "Another invalid property" | ||
405 | })"; | ||
406 | 2 | std::string error_msg; | |
407 |
3/12✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
2 | EXPECT_EQ(validator_->Validate(json_str, error_msg), ValidationError::INVALID_BODY); |
408 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(error_msg.empty()); |
409 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | rapidjson::Document doc; |
410 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | doc.Parse(error_msg.c_str()); |
411 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(doc.HasParseError()); |
412 |
5/16✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
4 | EXPECT_EQ(std::string(doc["errorCode"].GetString()), "INVALID_BODY"); |
413 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["code"].GetString()), "additionalProperties"); |
414 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["instance"].GetString()), "#"); |
415 | 2 | } | |
416 | |||
417 | 8 | TEST_F(TestBodyValidator, InvalidEnum) | |
418 | { | ||
419 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | std::string json_str = R"({ |
420 | "userId": 12345, | ||
421 | "username": "johndoe_2023", | ||
422 | "email": "john.doe@example.com", | ||
423 | "age": 28, | ||
424 | "phoneNumber": "+12345678901", | ||
425 | "address": { | ||
426 | "street": "123 Main St", | ||
427 | "city": "Anytown", | ||
428 | "state": "CA", | ||
429 | "zipCode": "90210" | ||
430 | }, | ||
431 | "subscriptionType": "invalid", | ||
432 | "preferences": { | ||
433 | "newsletter": true, | ||
434 | "themes": ["dark"] | ||
435 | }, | ||
436 | "createdAt": "2023-04-01T14:30:00Z", | ||
437 | "S_": "This should be invalid", | ||
438 | "S_example": "Valid pattern property", | ||
439 | "T_example": "Another invalid property" | ||
440 | })"; | ||
441 | 2 | std::string error_msg; | |
442 |
3/12✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
2 | EXPECT_EQ(validator_->Validate(json_str, error_msg), ValidationError::INVALID_BODY); |
443 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(error_msg.empty()); |
444 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | rapidjson::Document doc; |
445 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | doc.Parse(error_msg.c_str()); |
446 |
1/10✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
2 | EXPECT_FALSE(doc.HasParseError()); |
447 |
5/16✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
4 | EXPECT_EQ(std::string(doc["errorCode"].GetString()), "INVALID_BODY"); |
448 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["code"].GetString()), "enum"); |
449 |
6/18✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
|
4 | EXPECT_EQ(std::string(doc["details"]["instance"].GetString()), "#/subscriptionType"); |
450 | 2 | } | |
451 |