Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: generated/googleapis_beta/test/language/v1beta2_test.dart

Issue 3006323002: Api-Roll 54: 2017-09-11 (Closed)
Patch Set: use 2.0.0-dev.infinity sdk constraint in pubspecs Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 library googleapis_beta.language.v1beta2.test; 1 library googleapis_beta.language.v1beta2.test;
2 2
3 import "dart:core" as core; 3 import "dart:core" as core;
4 import "dart:collection" as collection;
5 import "dart:async" as async; 4 import "dart:async" as async;
6 import "dart:convert" as convert; 5 import "dart:convert" as convert;
7 6
8 import 'package:http/http.dart' as http; 7 import 'package:http/http.dart' as http;
9 import 'package:http/testing.dart' as http_testing;
10 import 'package:test/test.dart' as unittest; 8 import 'package:test/test.dart' as unittest;
11 9
12 import 'package:googleapis_beta/language/v1beta2.dart' as api; 10 import 'package:googleapis_beta/language/v1beta2.dart' as api;
13 11
14 class HttpServerMock extends http.BaseClient { 12 class HttpServerMock extends http.BaseClient {
15 core.Function _callback; 13 core.Function _callback;
16 core.bool _expectJson; 14 core.bool _expectJson;
17 15
18 void register(core.Function callback, core.bool expectJson) { 16 void register(core.Function callback, core.bool expectJson) {
19 _callback = callback; 17 _callback = callback;
20 _expectJson = expectJson; 18 _expectJson = expectJson;
21 } 19 }
22 20
23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { 21 async.Future<http.StreamedResponse> send(http.BaseRequest request) {
24 if (_expectJson) { 22 if (_expectJson) {
25 return request.finalize() 23 return request
24 .finalize()
26 .transform(convert.UTF8.decoder) 25 .transform(convert.UTF8.decoder)
27 .join('') 26 .join('')
28 .then((core.String jsonString) { 27 .then((core.String jsonString) {
29 if (jsonString.isEmpty) { 28 if (jsonString.isEmpty) {
30 return _callback(request, null); 29 return _callback(request, null);
31 } else { 30 } else {
32 return _callback(request, convert.JSON.decode(jsonString)); 31 return _callback(request, convert.JSON.decode(jsonString));
33 } 32 }
34 }); 33 });
35 } else { 34 } else {
36 var stream = request.finalize(); 35 var stream = request.finalize();
37 if (stream == null) { 36 if (stream == null) {
38 return _callback(request, []); 37 return _callback(request, []);
39 } else { 38 } else {
40 return stream.toBytes().then((data) { 39 return stream.toBytes().then((data) {
41 return _callback(request, data); 40 return _callback(request, data);
42 }); 41 });
43 } 42 }
44 } 43 }
45 } 44 }
46 } 45 }
47 46
48 http.StreamedResponse stringResponse( 47 http.StreamedResponse stringResponse(core.int status,
49 core.int status, core.Map<core.String, core.String> headers, core.String bod y) { 48 core.Map<core.String, core.String> headers, core.String body) {
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); 49 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]);
51 return new http.StreamedResponse(stream, status, headers: headers); 50 return new http.StreamedResponse(stream, status, headers: headers);
52 } 51 }
53 52
54 core.int buildCounterAnalyzeEntitiesRequest = 0; 53 core.int buildCounterAnalyzeEntitiesRequest = 0;
55 buildAnalyzeEntitiesRequest() { 54 buildAnalyzeEntitiesRequest() {
56 var o = new api.AnalyzeEntitiesRequest(); 55 var o = new api.AnalyzeEntitiesRequest();
57 buildCounterAnalyzeEntitiesRequest++; 56 buildCounterAnalyzeEntitiesRequest++;
58 if (buildCounterAnalyzeEntitiesRequest < 3) { 57 if (buildCounterAnalyzeEntitiesRequest < 3) {
59 o.document = buildDocument(); 58 o.document = buildDocument();
60 o.encodingType = "foo"; 59 o.encodingType = "foo";
61 } 60 }
62 buildCounterAnalyzeEntitiesRequest--; 61 buildCounterAnalyzeEntitiesRequest--;
63 return o; 62 return o;
64 } 63 }
65 64
66 checkAnalyzeEntitiesRequest(api.AnalyzeEntitiesRequest o) { 65 checkAnalyzeEntitiesRequest(api.AnalyzeEntitiesRequest o) {
67 buildCounterAnalyzeEntitiesRequest++; 66 buildCounterAnalyzeEntitiesRequest++;
68 if (buildCounterAnalyzeEntitiesRequest < 3) { 67 if (buildCounterAnalyzeEntitiesRequest < 3) {
69 checkDocument(o.document); 68 checkDocument(o.document);
70 unittest.expect(o.encodingType, unittest.equals('foo')); 69 unittest.expect(o.encodingType, unittest.equals('foo'));
71 } 70 }
72 buildCounterAnalyzeEntitiesRequest--; 71 buildCounterAnalyzeEntitiesRequest--;
73 } 72 }
74 73
75 buildUnnamed3372() { 74 buildUnnamed3375() {
76 var o = new core.List<api.Entity>(); 75 var o = new core.List<api.Entity>();
77 o.add(buildEntity()); 76 o.add(buildEntity());
78 o.add(buildEntity()); 77 o.add(buildEntity());
79 return o; 78 return o;
80 } 79 }
81 80
82 checkUnnamed3372(core.List<api.Entity> o) { 81 checkUnnamed3375(core.List<api.Entity> o) {
83 unittest.expect(o, unittest.hasLength(2)); 82 unittest.expect(o, unittest.hasLength(2));
84 checkEntity(o[0]); 83 checkEntity(o[0]);
85 checkEntity(o[1]); 84 checkEntity(o[1]);
86 } 85 }
87 86
88 core.int buildCounterAnalyzeEntitiesResponse = 0; 87 core.int buildCounterAnalyzeEntitiesResponse = 0;
89 buildAnalyzeEntitiesResponse() { 88 buildAnalyzeEntitiesResponse() {
90 var o = new api.AnalyzeEntitiesResponse(); 89 var o = new api.AnalyzeEntitiesResponse();
91 buildCounterAnalyzeEntitiesResponse++; 90 buildCounterAnalyzeEntitiesResponse++;
92 if (buildCounterAnalyzeEntitiesResponse < 3) { 91 if (buildCounterAnalyzeEntitiesResponse < 3) {
93 o.entities = buildUnnamed3372(); 92 o.entities = buildUnnamed3375();
94 o.language = "foo"; 93 o.language = "foo";
95 } 94 }
96 buildCounterAnalyzeEntitiesResponse--; 95 buildCounterAnalyzeEntitiesResponse--;
97 return o; 96 return o;
98 } 97 }
99 98
100 checkAnalyzeEntitiesResponse(api.AnalyzeEntitiesResponse o) { 99 checkAnalyzeEntitiesResponse(api.AnalyzeEntitiesResponse o) {
101 buildCounterAnalyzeEntitiesResponse++; 100 buildCounterAnalyzeEntitiesResponse++;
102 if (buildCounterAnalyzeEntitiesResponse < 3) { 101 if (buildCounterAnalyzeEntitiesResponse < 3) {
103 checkUnnamed3372(o.entities); 102 checkUnnamed3375(o.entities);
104 unittest.expect(o.language, unittest.equals('foo')); 103 unittest.expect(o.language, unittest.equals('foo'));
105 } 104 }
106 buildCounterAnalyzeEntitiesResponse--; 105 buildCounterAnalyzeEntitiesResponse--;
107 } 106 }
108 107
109 core.int buildCounterAnalyzeEntitySentimentRequest = 0; 108 core.int buildCounterAnalyzeEntitySentimentRequest = 0;
110 buildAnalyzeEntitySentimentRequest() { 109 buildAnalyzeEntitySentimentRequest() {
111 var o = new api.AnalyzeEntitySentimentRequest(); 110 var o = new api.AnalyzeEntitySentimentRequest();
112 buildCounterAnalyzeEntitySentimentRequest++; 111 buildCounterAnalyzeEntitySentimentRequest++;
113 if (buildCounterAnalyzeEntitySentimentRequest < 3) { 112 if (buildCounterAnalyzeEntitySentimentRequest < 3) {
114 o.document = buildDocument(); 113 o.document = buildDocument();
115 o.encodingType = "foo"; 114 o.encodingType = "foo";
116 } 115 }
117 buildCounterAnalyzeEntitySentimentRequest--; 116 buildCounterAnalyzeEntitySentimentRequest--;
118 return o; 117 return o;
119 } 118 }
120 119
121 checkAnalyzeEntitySentimentRequest(api.AnalyzeEntitySentimentRequest o) { 120 checkAnalyzeEntitySentimentRequest(api.AnalyzeEntitySentimentRequest o) {
122 buildCounterAnalyzeEntitySentimentRequest++; 121 buildCounterAnalyzeEntitySentimentRequest++;
123 if (buildCounterAnalyzeEntitySentimentRequest < 3) { 122 if (buildCounterAnalyzeEntitySentimentRequest < 3) {
124 checkDocument(o.document); 123 checkDocument(o.document);
125 unittest.expect(o.encodingType, unittest.equals('foo')); 124 unittest.expect(o.encodingType, unittest.equals('foo'));
126 } 125 }
127 buildCounterAnalyzeEntitySentimentRequest--; 126 buildCounterAnalyzeEntitySentimentRequest--;
128 } 127 }
129 128
130 buildUnnamed3373() { 129 buildUnnamed3376() {
131 var o = new core.List<api.Entity>(); 130 var o = new core.List<api.Entity>();
132 o.add(buildEntity()); 131 o.add(buildEntity());
133 o.add(buildEntity()); 132 o.add(buildEntity());
134 return o; 133 return o;
135 } 134 }
136 135
137 checkUnnamed3373(core.List<api.Entity> o) { 136 checkUnnamed3376(core.List<api.Entity> o) {
138 unittest.expect(o, unittest.hasLength(2)); 137 unittest.expect(o, unittest.hasLength(2));
139 checkEntity(o[0]); 138 checkEntity(o[0]);
140 checkEntity(o[1]); 139 checkEntity(o[1]);
141 } 140 }
142 141
143 core.int buildCounterAnalyzeEntitySentimentResponse = 0; 142 core.int buildCounterAnalyzeEntitySentimentResponse = 0;
144 buildAnalyzeEntitySentimentResponse() { 143 buildAnalyzeEntitySentimentResponse() {
145 var o = new api.AnalyzeEntitySentimentResponse(); 144 var o = new api.AnalyzeEntitySentimentResponse();
146 buildCounterAnalyzeEntitySentimentResponse++; 145 buildCounterAnalyzeEntitySentimentResponse++;
147 if (buildCounterAnalyzeEntitySentimentResponse < 3) { 146 if (buildCounterAnalyzeEntitySentimentResponse < 3) {
148 o.entities = buildUnnamed3373(); 147 o.entities = buildUnnamed3376();
149 o.language = "foo"; 148 o.language = "foo";
150 } 149 }
151 buildCounterAnalyzeEntitySentimentResponse--; 150 buildCounterAnalyzeEntitySentimentResponse--;
152 return o; 151 return o;
153 } 152 }
154 153
155 checkAnalyzeEntitySentimentResponse(api.AnalyzeEntitySentimentResponse o) { 154 checkAnalyzeEntitySentimentResponse(api.AnalyzeEntitySentimentResponse o) {
156 buildCounterAnalyzeEntitySentimentResponse++; 155 buildCounterAnalyzeEntitySentimentResponse++;
157 if (buildCounterAnalyzeEntitySentimentResponse < 3) { 156 if (buildCounterAnalyzeEntitySentimentResponse < 3) {
158 checkUnnamed3373(o.entities); 157 checkUnnamed3376(o.entities);
159 unittest.expect(o.language, unittest.equals('foo')); 158 unittest.expect(o.language, unittest.equals('foo'));
160 } 159 }
161 buildCounterAnalyzeEntitySentimentResponse--; 160 buildCounterAnalyzeEntitySentimentResponse--;
162 } 161 }
163 162
164 core.int buildCounterAnalyzeSentimentRequest = 0; 163 core.int buildCounterAnalyzeSentimentRequest = 0;
165 buildAnalyzeSentimentRequest() { 164 buildAnalyzeSentimentRequest() {
166 var o = new api.AnalyzeSentimentRequest(); 165 var o = new api.AnalyzeSentimentRequest();
167 buildCounterAnalyzeSentimentRequest++; 166 buildCounterAnalyzeSentimentRequest++;
168 if (buildCounterAnalyzeSentimentRequest < 3) { 167 if (buildCounterAnalyzeSentimentRequest < 3) {
169 o.document = buildDocument(); 168 o.document = buildDocument();
170 o.encodingType = "foo"; 169 o.encodingType = "foo";
171 } 170 }
172 buildCounterAnalyzeSentimentRequest--; 171 buildCounterAnalyzeSentimentRequest--;
173 return o; 172 return o;
174 } 173 }
175 174
176 checkAnalyzeSentimentRequest(api.AnalyzeSentimentRequest o) { 175 checkAnalyzeSentimentRequest(api.AnalyzeSentimentRequest o) {
177 buildCounterAnalyzeSentimentRequest++; 176 buildCounterAnalyzeSentimentRequest++;
178 if (buildCounterAnalyzeSentimentRequest < 3) { 177 if (buildCounterAnalyzeSentimentRequest < 3) {
179 checkDocument(o.document); 178 checkDocument(o.document);
180 unittest.expect(o.encodingType, unittest.equals('foo')); 179 unittest.expect(o.encodingType, unittest.equals('foo'));
181 } 180 }
182 buildCounterAnalyzeSentimentRequest--; 181 buildCounterAnalyzeSentimentRequest--;
183 } 182 }
184 183
185 buildUnnamed3374() { 184 buildUnnamed3377() {
186 var o = new core.List<api.Sentence>(); 185 var o = new core.List<api.Sentence>();
187 o.add(buildSentence()); 186 o.add(buildSentence());
188 o.add(buildSentence()); 187 o.add(buildSentence());
189 return o; 188 return o;
190 } 189 }
191 190
192 checkUnnamed3374(core.List<api.Sentence> o) { 191 checkUnnamed3377(core.List<api.Sentence> o) {
193 unittest.expect(o, unittest.hasLength(2)); 192 unittest.expect(o, unittest.hasLength(2));
194 checkSentence(o[0]); 193 checkSentence(o[0]);
195 checkSentence(o[1]); 194 checkSentence(o[1]);
196 } 195 }
197 196
198 core.int buildCounterAnalyzeSentimentResponse = 0; 197 core.int buildCounterAnalyzeSentimentResponse = 0;
199 buildAnalyzeSentimentResponse() { 198 buildAnalyzeSentimentResponse() {
200 var o = new api.AnalyzeSentimentResponse(); 199 var o = new api.AnalyzeSentimentResponse();
201 buildCounterAnalyzeSentimentResponse++; 200 buildCounterAnalyzeSentimentResponse++;
202 if (buildCounterAnalyzeSentimentResponse < 3) { 201 if (buildCounterAnalyzeSentimentResponse < 3) {
203 o.documentSentiment = buildSentiment(); 202 o.documentSentiment = buildSentiment();
204 o.language = "foo"; 203 o.language = "foo";
205 o.sentences = buildUnnamed3374(); 204 o.sentences = buildUnnamed3377();
206 } 205 }
207 buildCounterAnalyzeSentimentResponse--; 206 buildCounterAnalyzeSentimentResponse--;
208 return o; 207 return o;
209 } 208 }
210 209
211 checkAnalyzeSentimentResponse(api.AnalyzeSentimentResponse o) { 210 checkAnalyzeSentimentResponse(api.AnalyzeSentimentResponse o) {
212 buildCounterAnalyzeSentimentResponse++; 211 buildCounterAnalyzeSentimentResponse++;
213 if (buildCounterAnalyzeSentimentResponse < 3) { 212 if (buildCounterAnalyzeSentimentResponse < 3) {
214 checkSentiment(o.documentSentiment); 213 checkSentiment(o.documentSentiment);
215 unittest.expect(o.language, unittest.equals('foo')); 214 unittest.expect(o.language, unittest.equals('foo'));
216 checkUnnamed3374(o.sentences); 215 checkUnnamed3377(o.sentences);
217 } 216 }
218 buildCounterAnalyzeSentimentResponse--; 217 buildCounterAnalyzeSentimentResponse--;
219 } 218 }
220 219
221 core.int buildCounterAnalyzeSyntaxRequest = 0; 220 core.int buildCounterAnalyzeSyntaxRequest = 0;
222 buildAnalyzeSyntaxRequest() { 221 buildAnalyzeSyntaxRequest() {
223 var o = new api.AnalyzeSyntaxRequest(); 222 var o = new api.AnalyzeSyntaxRequest();
224 buildCounterAnalyzeSyntaxRequest++; 223 buildCounterAnalyzeSyntaxRequest++;
225 if (buildCounterAnalyzeSyntaxRequest < 3) { 224 if (buildCounterAnalyzeSyntaxRequest < 3) {
226 o.document = buildDocument(); 225 o.document = buildDocument();
227 o.encodingType = "foo"; 226 o.encodingType = "foo";
228 } 227 }
229 buildCounterAnalyzeSyntaxRequest--; 228 buildCounterAnalyzeSyntaxRequest--;
230 return o; 229 return o;
231 } 230 }
232 231
233 checkAnalyzeSyntaxRequest(api.AnalyzeSyntaxRequest o) { 232 checkAnalyzeSyntaxRequest(api.AnalyzeSyntaxRequest o) {
234 buildCounterAnalyzeSyntaxRequest++; 233 buildCounterAnalyzeSyntaxRequest++;
235 if (buildCounterAnalyzeSyntaxRequest < 3) { 234 if (buildCounterAnalyzeSyntaxRequest < 3) {
236 checkDocument(o.document); 235 checkDocument(o.document);
237 unittest.expect(o.encodingType, unittest.equals('foo')); 236 unittest.expect(o.encodingType, unittest.equals('foo'));
238 } 237 }
239 buildCounterAnalyzeSyntaxRequest--; 238 buildCounterAnalyzeSyntaxRequest--;
240 } 239 }
241 240
242 buildUnnamed3375() { 241 buildUnnamed3378() {
243 var o = new core.List<api.Sentence>(); 242 var o = new core.List<api.Sentence>();
244 o.add(buildSentence()); 243 o.add(buildSentence());
245 o.add(buildSentence()); 244 o.add(buildSentence());
246 return o; 245 return o;
247 } 246 }
248 247
249 checkUnnamed3375(core.List<api.Sentence> o) { 248 checkUnnamed3378(core.List<api.Sentence> o) {
250 unittest.expect(o, unittest.hasLength(2)); 249 unittest.expect(o, unittest.hasLength(2));
251 checkSentence(o[0]); 250 checkSentence(o[0]);
252 checkSentence(o[1]); 251 checkSentence(o[1]);
253 } 252 }
254 253
255 buildUnnamed3376() { 254 buildUnnamed3379() {
256 var o = new core.List<api.Token>(); 255 var o = new core.List<api.Token>();
257 o.add(buildToken()); 256 o.add(buildToken());
258 o.add(buildToken()); 257 o.add(buildToken());
259 return o; 258 return o;
260 } 259 }
261 260
262 checkUnnamed3376(core.List<api.Token> o) { 261 checkUnnamed3379(core.List<api.Token> o) {
263 unittest.expect(o, unittest.hasLength(2)); 262 unittest.expect(o, unittest.hasLength(2));
264 checkToken(o[0]); 263 checkToken(o[0]);
265 checkToken(o[1]); 264 checkToken(o[1]);
266 } 265 }
267 266
268 core.int buildCounterAnalyzeSyntaxResponse = 0; 267 core.int buildCounterAnalyzeSyntaxResponse = 0;
269 buildAnalyzeSyntaxResponse() { 268 buildAnalyzeSyntaxResponse() {
270 var o = new api.AnalyzeSyntaxResponse(); 269 var o = new api.AnalyzeSyntaxResponse();
271 buildCounterAnalyzeSyntaxResponse++; 270 buildCounterAnalyzeSyntaxResponse++;
272 if (buildCounterAnalyzeSyntaxResponse < 3) { 271 if (buildCounterAnalyzeSyntaxResponse < 3) {
273 o.language = "foo"; 272 o.language = "foo";
274 o.sentences = buildUnnamed3375(); 273 o.sentences = buildUnnamed3378();
275 o.tokens = buildUnnamed3376(); 274 o.tokens = buildUnnamed3379();
276 } 275 }
277 buildCounterAnalyzeSyntaxResponse--; 276 buildCounterAnalyzeSyntaxResponse--;
278 return o; 277 return o;
279 } 278 }
280 279
281 checkAnalyzeSyntaxResponse(api.AnalyzeSyntaxResponse o) { 280 checkAnalyzeSyntaxResponse(api.AnalyzeSyntaxResponse o) {
282 buildCounterAnalyzeSyntaxResponse++; 281 buildCounterAnalyzeSyntaxResponse++;
283 if (buildCounterAnalyzeSyntaxResponse < 3) { 282 if (buildCounterAnalyzeSyntaxResponse < 3) {
284 unittest.expect(o.language, unittest.equals('foo')); 283 unittest.expect(o.language, unittest.equals('foo'));
285 checkUnnamed3375(o.sentences); 284 checkUnnamed3378(o.sentences);
286 checkUnnamed3376(o.tokens); 285 checkUnnamed3379(o.tokens);
287 } 286 }
288 buildCounterAnalyzeSyntaxResponse--; 287 buildCounterAnalyzeSyntaxResponse--;
289 } 288 }
290 289
291 core.int buildCounterAnnotateTextRequest = 0; 290 core.int buildCounterAnnotateTextRequest = 0;
292 buildAnnotateTextRequest() { 291 buildAnnotateTextRequest() {
293 var o = new api.AnnotateTextRequest(); 292 var o = new api.AnnotateTextRequest();
294 buildCounterAnnotateTextRequest++; 293 buildCounterAnnotateTextRequest++;
295 if (buildCounterAnnotateTextRequest < 3) { 294 if (buildCounterAnnotateTextRequest < 3) {
296 o.document = buildDocument(); 295 o.document = buildDocument();
297 o.encodingType = "foo"; 296 o.encodingType = "foo";
298 o.features = buildFeatures(); 297 o.features = buildFeatures();
299 } 298 }
300 buildCounterAnnotateTextRequest--; 299 buildCounterAnnotateTextRequest--;
301 return o; 300 return o;
302 } 301 }
303 302
304 checkAnnotateTextRequest(api.AnnotateTextRequest o) { 303 checkAnnotateTextRequest(api.AnnotateTextRequest o) {
305 buildCounterAnnotateTextRequest++; 304 buildCounterAnnotateTextRequest++;
306 if (buildCounterAnnotateTextRequest < 3) { 305 if (buildCounterAnnotateTextRequest < 3) {
307 checkDocument(o.document); 306 checkDocument(o.document);
308 unittest.expect(o.encodingType, unittest.equals('foo')); 307 unittest.expect(o.encodingType, unittest.equals('foo'));
309 checkFeatures(o.features); 308 checkFeatures(o.features);
310 } 309 }
311 buildCounterAnnotateTextRequest--; 310 buildCounterAnnotateTextRequest--;
312 } 311 }
313 312
314 buildUnnamed3377() { 313 buildUnnamed3380() {
314 var o = new core.List<api.ClassificationCategory>();
315 o.add(buildClassificationCategory());
316 o.add(buildClassificationCategory());
317 return o;
318 }
319
320 checkUnnamed3380(core.List<api.ClassificationCategory> o) {
321 unittest.expect(o, unittest.hasLength(2));
322 checkClassificationCategory(o[0]);
323 checkClassificationCategory(o[1]);
324 }
325
326 buildUnnamed3381() {
315 var o = new core.List<api.Entity>(); 327 var o = new core.List<api.Entity>();
316 o.add(buildEntity()); 328 o.add(buildEntity());
317 o.add(buildEntity()); 329 o.add(buildEntity());
318 return o; 330 return o;
319 } 331 }
320 332
321 checkUnnamed3377(core.List<api.Entity> o) { 333 checkUnnamed3381(core.List<api.Entity> o) {
322 unittest.expect(o, unittest.hasLength(2)); 334 unittest.expect(o, unittest.hasLength(2));
323 checkEntity(o[0]); 335 checkEntity(o[0]);
324 checkEntity(o[1]); 336 checkEntity(o[1]);
325 } 337 }
326 338
327 buildUnnamed3378() { 339 buildUnnamed3382() {
328 var o = new core.List<api.Sentence>(); 340 var o = new core.List<api.Sentence>();
329 o.add(buildSentence()); 341 o.add(buildSentence());
330 o.add(buildSentence()); 342 o.add(buildSentence());
331 return o; 343 return o;
332 } 344 }
333 345
334 checkUnnamed3378(core.List<api.Sentence> o) { 346 checkUnnamed3382(core.List<api.Sentence> o) {
335 unittest.expect(o, unittest.hasLength(2)); 347 unittest.expect(o, unittest.hasLength(2));
336 checkSentence(o[0]); 348 checkSentence(o[0]);
337 checkSentence(o[1]); 349 checkSentence(o[1]);
338 } 350 }
339 351
340 buildUnnamed3379() { 352 buildUnnamed3383() {
341 var o = new core.List<api.Token>(); 353 var o = new core.List<api.Token>();
342 o.add(buildToken()); 354 o.add(buildToken());
343 o.add(buildToken()); 355 o.add(buildToken());
344 return o; 356 return o;
345 } 357 }
346 358
347 checkUnnamed3379(core.List<api.Token> o) { 359 checkUnnamed3383(core.List<api.Token> o) {
348 unittest.expect(o, unittest.hasLength(2)); 360 unittest.expect(o, unittest.hasLength(2));
349 checkToken(o[0]); 361 checkToken(o[0]);
350 checkToken(o[1]); 362 checkToken(o[1]);
351 } 363 }
352 364
353 core.int buildCounterAnnotateTextResponse = 0; 365 core.int buildCounterAnnotateTextResponse = 0;
354 buildAnnotateTextResponse() { 366 buildAnnotateTextResponse() {
355 var o = new api.AnnotateTextResponse(); 367 var o = new api.AnnotateTextResponse();
356 buildCounterAnnotateTextResponse++; 368 buildCounterAnnotateTextResponse++;
357 if (buildCounterAnnotateTextResponse < 3) { 369 if (buildCounterAnnotateTextResponse < 3) {
370 o.categories = buildUnnamed3380();
358 o.documentSentiment = buildSentiment(); 371 o.documentSentiment = buildSentiment();
359 o.entities = buildUnnamed3377(); 372 o.entities = buildUnnamed3381();
360 o.language = "foo"; 373 o.language = "foo";
361 o.sentences = buildUnnamed3378(); 374 o.sentences = buildUnnamed3382();
362 o.tokens = buildUnnamed3379(); 375 o.tokens = buildUnnamed3383();
363 } 376 }
364 buildCounterAnnotateTextResponse--; 377 buildCounterAnnotateTextResponse--;
365 return o; 378 return o;
366 } 379 }
367 380
368 checkAnnotateTextResponse(api.AnnotateTextResponse o) { 381 checkAnnotateTextResponse(api.AnnotateTextResponse o) {
369 buildCounterAnnotateTextResponse++; 382 buildCounterAnnotateTextResponse++;
370 if (buildCounterAnnotateTextResponse < 3) { 383 if (buildCounterAnnotateTextResponse < 3) {
384 checkUnnamed3380(o.categories);
371 checkSentiment(o.documentSentiment); 385 checkSentiment(o.documentSentiment);
372 checkUnnamed3377(o.entities); 386 checkUnnamed3381(o.entities);
373 unittest.expect(o.language, unittest.equals('foo')); 387 unittest.expect(o.language, unittest.equals('foo'));
374 checkUnnamed3378(o.sentences); 388 checkUnnamed3382(o.sentences);
375 checkUnnamed3379(o.tokens); 389 checkUnnamed3383(o.tokens);
376 } 390 }
377 buildCounterAnnotateTextResponse--; 391 buildCounterAnnotateTextResponse--;
378 } 392 }
379 393
394 core.int buildCounterClassificationCategory = 0;
395 buildClassificationCategory() {
396 var o = new api.ClassificationCategory();
397 buildCounterClassificationCategory++;
398 if (buildCounterClassificationCategory < 3) {
399 o.confidence = 42.0;
400 o.name = "foo";
401 }
402 buildCounterClassificationCategory--;
403 return o;
404 }
405
406 checkClassificationCategory(api.ClassificationCategory o) {
407 buildCounterClassificationCategory++;
408 if (buildCounterClassificationCategory < 3) {
409 unittest.expect(o.confidence, unittest.equals(42.0));
410 unittest.expect(o.name, unittest.equals('foo'));
411 }
412 buildCounterClassificationCategory--;
413 }
414
415 core.int buildCounterClassifyTextRequest = 0;
416 buildClassifyTextRequest() {
417 var o = new api.ClassifyTextRequest();
418 buildCounterClassifyTextRequest++;
419 if (buildCounterClassifyTextRequest < 3) {
420 o.document = buildDocument();
421 }
422 buildCounterClassifyTextRequest--;
423 return o;
424 }
425
426 checkClassifyTextRequest(api.ClassifyTextRequest o) {
427 buildCounterClassifyTextRequest++;
428 if (buildCounterClassifyTextRequest < 3) {
429 checkDocument(o.document);
430 }
431 buildCounterClassifyTextRequest--;
432 }
433
434 buildUnnamed3384() {
435 var o = new core.List<api.ClassificationCategory>();
436 o.add(buildClassificationCategory());
437 o.add(buildClassificationCategory());
438 return o;
439 }
440
441 checkUnnamed3384(core.List<api.ClassificationCategory> o) {
442 unittest.expect(o, unittest.hasLength(2));
443 checkClassificationCategory(o[0]);
444 checkClassificationCategory(o[1]);
445 }
446
447 core.int buildCounterClassifyTextResponse = 0;
448 buildClassifyTextResponse() {
449 var o = new api.ClassifyTextResponse();
450 buildCounterClassifyTextResponse++;
451 if (buildCounterClassifyTextResponse < 3) {
452 o.categories = buildUnnamed3384();
453 }
454 buildCounterClassifyTextResponse--;
455 return o;
456 }
457
458 checkClassifyTextResponse(api.ClassifyTextResponse o) {
459 buildCounterClassifyTextResponse++;
460 if (buildCounterClassifyTextResponse < 3) {
461 checkUnnamed3384(o.categories);
462 }
463 buildCounterClassifyTextResponse--;
464 }
465
380 core.int buildCounterDependencyEdge = 0; 466 core.int buildCounterDependencyEdge = 0;
381 buildDependencyEdge() { 467 buildDependencyEdge() {
382 var o = new api.DependencyEdge(); 468 var o = new api.DependencyEdge();
383 buildCounterDependencyEdge++; 469 buildCounterDependencyEdge++;
384 if (buildCounterDependencyEdge < 3) { 470 if (buildCounterDependencyEdge < 3) {
385 o.headTokenIndex = 42; 471 o.headTokenIndex = 42;
386 o.label = "foo"; 472 o.label = "foo";
387 } 473 }
388 buildCounterDependencyEdge--; 474 buildCounterDependencyEdge--;
389 return o; 475 return o;
(...skipping 26 matching lines...) Expand all
416 buildCounterDocument++; 502 buildCounterDocument++;
417 if (buildCounterDocument < 3) { 503 if (buildCounterDocument < 3) {
418 unittest.expect(o.content, unittest.equals('foo')); 504 unittest.expect(o.content, unittest.equals('foo'));
419 unittest.expect(o.gcsContentUri, unittest.equals('foo')); 505 unittest.expect(o.gcsContentUri, unittest.equals('foo'));
420 unittest.expect(o.language, unittest.equals('foo')); 506 unittest.expect(o.language, unittest.equals('foo'));
421 unittest.expect(o.type, unittest.equals('foo')); 507 unittest.expect(o.type, unittest.equals('foo'));
422 } 508 }
423 buildCounterDocument--; 509 buildCounterDocument--;
424 } 510 }
425 511
426 buildUnnamed3380() { 512 buildUnnamed3385() {
427 var o = new core.List<api.EntityMention>(); 513 var o = new core.List<api.EntityMention>();
428 o.add(buildEntityMention()); 514 o.add(buildEntityMention());
429 o.add(buildEntityMention()); 515 o.add(buildEntityMention());
430 return o; 516 return o;
431 } 517 }
432 518
433 checkUnnamed3380(core.List<api.EntityMention> o) { 519 checkUnnamed3385(core.List<api.EntityMention> o) {
434 unittest.expect(o, unittest.hasLength(2)); 520 unittest.expect(o, unittest.hasLength(2));
435 checkEntityMention(o[0]); 521 checkEntityMention(o[0]);
436 checkEntityMention(o[1]); 522 checkEntityMention(o[1]);
437 } 523 }
438 524
439 buildUnnamed3381() { 525 buildUnnamed3386() {
440 var o = new core.Map<core.String, core.String>(); 526 var o = new core.Map<core.String, core.String>();
441 o["x"] = "foo"; 527 o["x"] = "foo";
442 o["y"] = "foo"; 528 o["y"] = "foo";
443 return o; 529 return o;
444 } 530 }
445 531
446 checkUnnamed3381(core.Map<core.String, core.String> o) { 532 checkUnnamed3386(core.Map<core.String, core.String> o) {
447 unittest.expect(o, unittest.hasLength(2)); 533 unittest.expect(o, unittest.hasLength(2));
448 unittest.expect(o["x"], unittest.equals('foo')); 534 unittest.expect(o["x"], unittest.equals('foo'));
449 unittest.expect(o["y"], unittest.equals('foo')); 535 unittest.expect(o["y"], unittest.equals('foo'));
450 } 536 }
451 537
452 core.int buildCounterEntity = 0; 538 core.int buildCounterEntity = 0;
453 buildEntity() { 539 buildEntity() {
454 var o = new api.Entity(); 540 var o = new api.Entity();
455 buildCounterEntity++; 541 buildCounterEntity++;
456 if (buildCounterEntity < 3) { 542 if (buildCounterEntity < 3) {
457 o.mentions = buildUnnamed3380(); 543 o.mentions = buildUnnamed3385();
458 o.metadata = buildUnnamed3381(); 544 o.metadata = buildUnnamed3386();
459 o.name = "foo"; 545 o.name = "foo";
460 o.salience = 42.0; 546 o.salience = 42.0;
461 o.sentiment = buildSentiment(); 547 o.sentiment = buildSentiment();
462 o.type = "foo"; 548 o.type = "foo";
463 } 549 }
464 buildCounterEntity--; 550 buildCounterEntity--;
465 return o; 551 return o;
466 } 552 }
467 553
468 checkEntity(api.Entity o) { 554 checkEntity(api.Entity o) {
469 buildCounterEntity++; 555 buildCounterEntity++;
470 if (buildCounterEntity < 3) { 556 if (buildCounterEntity < 3) {
471 checkUnnamed3380(o.mentions); 557 checkUnnamed3385(o.mentions);
472 checkUnnamed3381(o.metadata); 558 checkUnnamed3386(o.metadata);
473 unittest.expect(o.name, unittest.equals('foo')); 559 unittest.expect(o.name, unittest.equals('foo'));
474 unittest.expect(o.salience, unittest.equals(42.0)); 560 unittest.expect(o.salience, unittest.equals(42.0));
475 checkSentiment(o.sentiment); 561 checkSentiment(o.sentiment);
476 unittest.expect(o.type, unittest.equals('foo')); 562 unittest.expect(o.type, unittest.equals('foo'));
477 } 563 }
478 buildCounterEntity--; 564 buildCounterEntity--;
479 } 565 }
480 566
481 core.int buildCounterEntityMention = 0; 567 core.int buildCounterEntityMention = 0;
482 buildEntityMention() { 568 buildEntityMention() {
(...skipping 16 matching lines...) Expand all
499 unittest.expect(o.type, unittest.equals('foo')); 585 unittest.expect(o.type, unittest.equals('foo'));
500 } 586 }
501 buildCounterEntityMention--; 587 buildCounterEntityMention--;
502 } 588 }
503 589
504 core.int buildCounterFeatures = 0; 590 core.int buildCounterFeatures = 0;
505 buildFeatures() { 591 buildFeatures() {
506 var o = new api.Features(); 592 var o = new api.Features();
507 buildCounterFeatures++; 593 buildCounterFeatures++;
508 if (buildCounterFeatures < 3) { 594 if (buildCounterFeatures < 3) {
595 o.classifyText = true;
509 o.extractDocumentSentiment = true; 596 o.extractDocumentSentiment = true;
510 o.extractEntities = true; 597 o.extractEntities = true;
511 o.extractEntitySentiment = true; 598 o.extractEntitySentiment = true;
512 o.extractSyntax = true; 599 o.extractSyntax = true;
513 } 600 }
514 buildCounterFeatures--; 601 buildCounterFeatures--;
515 return o; 602 return o;
516 } 603 }
517 604
518 checkFeatures(api.Features o) { 605 checkFeatures(api.Features o) {
519 buildCounterFeatures++; 606 buildCounterFeatures++;
520 if (buildCounterFeatures < 3) { 607 if (buildCounterFeatures < 3) {
608 unittest.expect(o.classifyText, unittest.isTrue);
521 unittest.expect(o.extractDocumentSentiment, unittest.isTrue); 609 unittest.expect(o.extractDocumentSentiment, unittest.isTrue);
522 unittest.expect(o.extractEntities, unittest.isTrue); 610 unittest.expect(o.extractEntities, unittest.isTrue);
523 unittest.expect(o.extractEntitySentiment, unittest.isTrue); 611 unittest.expect(o.extractEntitySentiment, unittest.isTrue);
524 unittest.expect(o.extractSyntax, unittest.isTrue); 612 unittest.expect(o.extractSyntax, unittest.isTrue);
525 } 613 }
526 buildCounterFeatures--; 614 buildCounterFeatures--;
527 } 615 }
528 616
529 core.int buildCounterPartOfSpeech = 0; 617 core.int buildCounterPartOfSpeech = 0;
530 buildPartOfSpeech() { 618 buildPartOfSpeech() {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 690
603 checkSentiment(api.Sentiment o) { 691 checkSentiment(api.Sentiment o) {
604 buildCounterSentiment++; 692 buildCounterSentiment++;
605 if (buildCounterSentiment < 3) { 693 if (buildCounterSentiment < 3) {
606 unittest.expect(o.magnitude, unittest.equals(42.0)); 694 unittest.expect(o.magnitude, unittest.equals(42.0));
607 unittest.expect(o.score, unittest.equals(42.0)); 695 unittest.expect(o.score, unittest.equals(42.0));
608 } 696 }
609 buildCounterSentiment--; 697 buildCounterSentiment--;
610 } 698 }
611 699
612 buildUnnamed3382() { 700 buildUnnamed3387() {
613 var o = new core.Map<core.String, core.Object>(); 701 var o = new core.Map<core.String, core.Object>();
614 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; 702 o["x"] = {
615 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; 703 'list': [1, 2, 3],
704 'bool': true,
705 'string': 'foo'
706 };
707 o["y"] = {
708 'list': [1, 2, 3],
709 'bool': true,
710 'string': 'foo'
711 };
616 return o; 712 return o;
617 } 713 }
618 714
619 checkUnnamed3382(core.Map<core.String, core.Object> o) { 715 checkUnnamed3387(core.Map<core.String, core.Object> o) {
620 unittest.expect(o, unittest.hasLength(2)); 716 unittest.expect(o, unittest.hasLength(2));
621 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"], unittest.equals('foo')); 717 var casted1 = (o["x"]) as core.Map;
622 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"], unittest.equals('foo')); 718 unittest.expect(casted1, unittest.hasLength(3));
719 unittest.expect(casted1["list"], unittest.equals([1, 2, 3]));
720 unittest.expect(casted1["bool"], unittest.equals(true));
721 unittest.expect(casted1["string"], unittest.equals('foo'));
722 var casted2 = (o["y"]) as core.Map;
723 unittest.expect(casted2, unittest.hasLength(3));
724 unittest.expect(casted2["list"], unittest.equals([1, 2, 3]));
725 unittest.expect(casted2["bool"], unittest.equals(true));
726 unittest.expect(casted2["string"], unittest.equals('foo'));
623 } 727 }
624 728
625 buildUnnamed3383() { 729 buildUnnamed3388() {
626 var o = new core.List<core.Map<core.String, core.Object>>(); 730 var o = new core.List<core.Map<core.String, core.Object>>();
627 o.add(buildUnnamed3382()); 731 o.add(buildUnnamed3387());
628 o.add(buildUnnamed3382()); 732 o.add(buildUnnamed3387());
629 return o; 733 return o;
630 } 734 }
631 735
632 checkUnnamed3383(core.List<core.Map<core.String, core.Object>> o) { 736 checkUnnamed3388(core.List<core.Map<core.String, core.Object>> o) {
633 unittest.expect(o, unittest.hasLength(2)); 737 unittest.expect(o, unittest.hasLength(2));
634 checkUnnamed3382(o[0]); 738 checkUnnamed3387(o[0]);
635 checkUnnamed3382(o[1]); 739 checkUnnamed3387(o[1]);
636 } 740 }
637 741
638 core.int buildCounterStatus = 0; 742 core.int buildCounterStatus = 0;
639 buildStatus() { 743 buildStatus() {
640 var o = new api.Status(); 744 var o = new api.Status();
641 buildCounterStatus++; 745 buildCounterStatus++;
642 if (buildCounterStatus < 3) { 746 if (buildCounterStatus < 3) {
643 o.code = 42; 747 o.code = 42;
644 o.details = buildUnnamed3383(); 748 o.details = buildUnnamed3388();
645 o.message = "foo"; 749 o.message = "foo";
646 } 750 }
647 buildCounterStatus--; 751 buildCounterStatus--;
648 return o; 752 return o;
649 } 753 }
650 754
651 checkStatus(api.Status o) { 755 checkStatus(api.Status o) {
652 buildCounterStatus++; 756 buildCounterStatus++;
653 if (buildCounterStatus < 3) { 757 if (buildCounterStatus < 3) {
654 unittest.expect(o.code, unittest.equals(42)); 758 unittest.expect(o.code, unittest.equals(42));
655 checkUnnamed3383(o.details); 759 checkUnnamed3388(o.details);
656 unittest.expect(o.message, unittest.equals('foo')); 760 unittest.expect(o.message, unittest.equals('foo'));
657 } 761 }
658 buildCounterStatus--; 762 buildCounterStatus--;
659 } 763 }
660 764
661 core.int buildCounterTextSpan = 0; 765 core.int buildCounterTextSpan = 0;
662 buildTextSpan() { 766 buildTextSpan() {
663 var o = new api.TextSpan(); 767 var o = new api.TextSpan();
664 buildCounterTextSpan++; 768 buildCounterTextSpan++;
665 if (buildCounterTextSpan < 3) { 769 if (buildCounterTextSpan < 3) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 buildCounterToken++; 801 buildCounterToken++;
698 if (buildCounterToken < 3) { 802 if (buildCounterToken < 3) {
699 checkDependencyEdge(o.dependencyEdge); 803 checkDependencyEdge(o.dependencyEdge);
700 unittest.expect(o.lemma, unittest.equals('foo')); 804 unittest.expect(o.lemma, unittest.equals('foo'));
701 checkPartOfSpeech(o.partOfSpeech); 805 checkPartOfSpeech(o.partOfSpeech);
702 checkTextSpan(o.text); 806 checkTextSpan(o.text);
703 } 807 }
704 buildCounterToken--; 808 buildCounterToken--;
705 } 809 }
706 810
707
708 main() { 811 main() {
709 unittest.group("obj-schema-AnalyzeEntitiesRequest", () { 812 unittest.group("obj-schema-AnalyzeEntitiesRequest", () {
710 unittest.test("to-json--from-json", () { 813 unittest.test("to-json--from-json", () {
711 var o = buildAnalyzeEntitiesRequest(); 814 var o = buildAnalyzeEntitiesRequest();
712 var od = new api.AnalyzeEntitiesRequest.fromJson(o.toJson()); 815 var od = new api.AnalyzeEntitiesRequest.fromJson(o.toJson());
713 checkAnalyzeEntitiesRequest(od); 816 checkAnalyzeEntitiesRequest(od);
714 }); 817 });
715 }); 818 });
716 819
717
718 unittest.group("obj-schema-AnalyzeEntitiesResponse", () { 820 unittest.group("obj-schema-AnalyzeEntitiesResponse", () {
719 unittest.test("to-json--from-json", () { 821 unittest.test("to-json--from-json", () {
720 var o = buildAnalyzeEntitiesResponse(); 822 var o = buildAnalyzeEntitiesResponse();
721 var od = new api.AnalyzeEntitiesResponse.fromJson(o.toJson()); 823 var od = new api.AnalyzeEntitiesResponse.fromJson(o.toJson());
722 checkAnalyzeEntitiesResponse(od); 824 checkAnalyzeEntitiesResponse(od);
723 }); 825 });
724 }); 826 });
725 827
726
727 unittest.group("obj-schema-AnalyzeEntitySentimentRequest", () { 828 unittest.group("obj-schema-AnalyzeEntitySentimentRequest", () {
728 unittest.test("to-json--from-json", () { 829 unittest.test("to-json--from-json", () {
729 var o = buildAnalyzeEntitySentimentRequest(); 830 var o = buildAnalyzeEntitySentimentRequest();
730 var od = new api.AnalyzeEntitySentimentRequest.fromJson(o.toJson()); 831 var od = new api.AnalyzeEntitySentimentRequest.fromJson(o.toJson());
731 checkAnalyzeEntitySentimentRequest(od); 832 checkAnalyzeEntitySentimentRequest(od);
732 }); 833 });
733 }); 834 });
734 835
735
736 unittest.group("obj-schema-AnalyzeEntitySentimentResponse", () { 836 unittest.group("obj-schema-AnalyzeEntitySentimentResponse", () {
737 unittest.test("to-json--from-json", () { 837 unittest.test("to-json--from-json", () {
738 var o = buildAnalyzeEntitySentimentResponse(); 838 var o = buildAnalyzeEntitySentimentResponse();
739 var od = new api.AnalyzeEntitySentimentResponse.fromJson(o.toJson()); 839 var od = new api.AnalyzeEntitySentimentResponse.fromJson(o.toJson());
740 checkAnalyzeEntitySentimentResponse(od); 840 checkAnalyzeEntitySentimentResponse(od);
741 }); 841 });
742 }); 842 });
743 843
744
745 unittest.group("obj-schema-AnalyzeSentimentRequest", () { 844 unittest.group("obj-schema-AnalyzeSentimentRequest", () {
746 unittest.test("to-json--from-json", () { 845 unittest.test("to-json--from-json", () {
747 var o = buildAnalyzeSentimentRequest(); 846 var o = buildAnalyzeSentimentRequest();
748 var od = new api.AnalyzeSentimentRequest.fromJson(o.toJson()); 847 var od = new api.AnalyzeSentimentRequest.fromJson(o.toJson());
749 checkAnalyzeSentimentRequest(od); 848 checkAnalyzeSentimentRequest(od);
750 }); 849 });
751 }); 850 });
752 851
753
754 unittest.group("obj-schema-AnalyzeSentimentResponse", () { 852 unittest.group("obj-schema-AnalyzeSentimentResponse", () {
755 unittest.test("to-json--from-json", () { 853 unittest.test("to-json--from-json", () {
756 var o = buildAnalyzeSentimentResponse(); 854 var o = buildAnalyzeSentimentResponse();
757 var od = new api.AnalyzeSentimentResponse.fromJson(o.toJson()); 855 var od = new api.AnalyzeSentimentResponse.fromJson(o.toJson());
758 checkAnalyzeSentimentResponse(od); 856 checkAnalyzeSentimentResponse(od);
759 }); 857 });
760 }); 858 });
761 859
762
763 unittest.group("obj-schema-AnalyzeSyntaxRequest", () { 860 unittest.group("obj-schema-AnalyzeSyntaxRequest", () {
764 unittest.test("to-json--from-json", () { 861 unittest.test("to-json--from-json", () {
765 var o = buildAnalyzeSyntaxRequest(); 862 var o = buildAnalyzeSyntaxRequest();
766 var od = new api.AnalyzeSyntaxRequest.fromJson(o.toJson()); 863 var od = new api.AnalyzeSyntaxRequest.fromJson(o.toJson());
767 checkAnalyzeSyntaxRequest(od); 864 checkAnalyzeSyntaxRequest(od);
768 }); 865 });
769 }); 866 });
770 867
771
772 unittest.group("obj-schema-AnalyzeSyntaxResponse", () { 868 unittest.group("obj-schema-AnalyzeSyntaxResponse", () {
773 unittest.test("to-json--from-json", () { 869 unittest.test("to-json--from-json", () {
774 var o = buildAnalyzeSyntaxResponse(); 870 var o = buildAnalyzeSyntaxResponse();
775 var od = new api.AnalyzeSyntaxResponse.fromJson(o.toJson()); 871 var od = new api.AnalyzeSyntaxResponse.fromJson(o.toJson());
776 checkAnalyzeSyntaxResponse(od); 872 checkAnalyzeSyntaxResponse(od);
777 }); 873 });
778 }); 874 });
779 875
780
781 unittest.group("obj-schema-AnnotateTextRequest", () { 876 unittest.group("obj-schema-AnnotateTextRequest", () {
782 unittest.test("to-json--from-json", () { 877 unittest.test("to-json--from-json", () {
783 var o = buildAnnotateTextRequest(); 878 var o = buildAnnotateTextRequest();
784 var od = new api.AnnotateTextRequest.fromJson(o.toJson()); 879 var od = new api.AnnotateTextRequest.fromJson(o.toJson());
785 checkAnnotateTextRequest(od); 880 checkAnnotateTextRequest(od);
786 }); 881 });
787 }); 882 });
788 883
789
790 unittest.group("obj-schema-AnnotateTextResponse", () { 884 unittest.group("obj-schema-AnnotateTextResponse", () {
791 unittest.test("to-json--from-json", () { 885 unittest.test("to-json--from-json", () {
792 var o = buildAnnotateTextResponse(); 886 var o = buildAnnotateTextResponse();
793 var od = new api.AnnotateTextResponse.fromJson(o.toJson()); 887 var od = new api.AnnotateTextResponse.fromJson(o.toJson());
794 checkAnnotateTextResponse(od); 888 checkAnnotateTextResponse(od);
795 }); 889 });
796 }); 890 });
797 891
892 unittest.group("obj-schema-ClassificationCategory", () {
893 unittest.test("to-json--from-json", () {
894 var o = buildClassificationCategory();
895 var od = new api.ClassificationCategory.fromJson(o.toJson());
896 checkClassificationCategory(od);
897 });
898 });
899
900 unittest.group("obj-schema-ClassifyTextRequest", () {
901 unittest.test("to-json--from-json", () {
902 var o = buildClassifyTextRequest();
903 var od = new api.ClassifyTextRequest.fromJson(o.toJson());
904 checkClassifyTextRequest(od);
905 });
906 });
907
908 unittest.group("obj-schema-ClassifyTextResponse", () {
909 unittest.test("to-json--from-json", () {
910 var o = buildClassifyTextResponse();
911 var od = new api.ClassifyTextResponse.fromJson(o.toJson());
912 checkClassifyTextResponse(od);
913 });
914 });
798 915
799 unittest.group("obj-schema-DependencyEdge", () { 916 unittest.group("obj-schema-DependencyEdge", () {
800 unittest.test("to-json--from-json", () { 917 unittest.test("to-json--from-json", () {
801 var o = buildDependencyEdge(); 918 var o = buildDependencyEdge();
802 var od = new api.DependencyEdge.fromJson(o.toJson()); 919 var od = new api.DependencyEdge.fromJson(o.toJson());
803 checkDependencyEdge(od); 920 checkDependencyEdge(od);
804 }); 921 });
805 }); 922 });
806 923
807
808 unittest.group("obj-schema-Document", () { 924 unittest.group("obj-schema-Document", () {
809 unittest.test("to-json--from-json", () { 925 unittest.test("to-json--from-json", () {
810 var o = buildDocument(); 926 var o = buildDocument();
811 var od = new api.Document.fromJson(o.toJson()); 927 var od = new api.Document.fromJson(o.toJson());
812 checkDocument(od); 928 checkDocument(od);
813 }); 929 });
814 }); 930 });
815 931
816
817 unittest.group("obj-schema-Entity", () { 932 unittest.group("obj-schema-Entity", () {
818 unittest.test("to-json--from-json", () { 933 unittest.test("to-json--from-json", () {
819 var o = buildEntity(); 934 var o = buildEntity();
820 var od = new api.Entity.fromJson(o.toJson()); 935 var od = new api.Entity.fromJson(o.toJson());
821 checkEntity(od); 936 checkEntity(od);
822 }); 937 });
823 }); 938 });
824 939
825
826 unittest.group("obj-schema-EntityMention", () { 940 unittest.group("obj-schema-EntityMention", () {
827 unittest.test("to-json--from-json", () { 941 unittest.test("to-json--from-json", () {
828 var o = buildEntityMention(); 942 var o = buildEntityMention();
829 var od = new api.EntityMention.fromJson(o.toJson()); 943 var od = new api.EntityMention.fromJson(o.toJson());
830 checkEntityMention(od); 944 checkEntityMention(od);
831 }); 945 });
832 }); 946 });
833 947
834
835 unittest.group("obj-schema-Features", () { 948 unittest.group("obj-schema-Features", () {
836 unittest.test("to-json--from-json", () { 949 unittest.test("to-json--from-json", () {
837 var o = buildFeatures(); 950 var o = buildFeatures();
838 var od = new api.Features.fromJson(o.toJson()); 951 var od = new api.Features.fromJson(o.toJson());
839 checkFeatures(od); 952 checkFeatures(od);
840 }); 953 });
841 }); 954 });
842 955
843
844 unittest.group("obj-schema-PartOfSpeech", () { 956 unittest.group("obj-schema-PartOfSpeech", () {
845 unittest.test("to-json--from-json", () { 957 unittest.test("to-json--from-json", () {
846 var o = buildPartOfSpeech(); 958 var o = buildPartOfSpeech();
847 var od = new api.PartOfSpeech.fromJson(o.toJson()); 959 var od = new api.PartOfSpeech.fromJson(o.toJson());
848 checkPartOfSpeech(od); 960 checkPartOfSpeech(od);
849 }); 961 });
850 }); 962 });
851 963
852
853 unittest.group("obj-schema-Sentence", () { 964 unittest.group("obj-schema-Sentence", () {
854 unittest.test("to-json--from-json", () { 965 unittest.test("to-json--from-json", () {
855 var o = buildSentence(); 966 var o = buildSentence();
856 var od = new api.Sentence.fromJson(o.toJson()); 967 var od = new api.Sentence.fromJson(o.toJson());
857 checkSentence(od); 968 checkSentence(od);
858 }); 969 });
859 }); 970 });
860 971
861
862 unittest.group("obj-schema-Sentiment", () { 972 unittest.group("obj-schema-Sentiment", () {
863 unittest.test("to-json--from-json", () { 973 unittest.test("to-json--from-json", () {
864 var o = buildSentiment(); 974 var o = buildSentiment();
865 var od = new api.Sentiment.fromJson(o.toJson()); 975 var od = new api.Sentiment.fromJson(o.toJson());
866 checkSentiment(od); 976 checkSentiment(od);
867 }); 977 });
868 }); 978 });
869 979
870
871 unittest.group("obj-schema-Status", () { 980 unittest.group("obj-schema-Status", () {
872 unittest.test("to-json--from-json", () { 981 unittest.test("to-json--from-json", () {
873 var o = buildStatus(); 982 var o = buildStatus();
874 var od = new api.Status.fromJson(o.toJson()); 983 var od = new api.Status.fromJson(o.toJson());
875 checkStatus(od); 984 checkStatus(od);
876 }); 985 });
877 }); 986 });
878 987
879
880 unittest.group("obj-schema-TextSpan", () { 988 unittest.group("obj-schema-TextSpan", () {
881 unittest.test("to-json--from-json", () { 989 unittest.test("to-json--from-json", () {
882 var o = buildTextSpan(); 990 var o = buildTextSpan();
883 var od = new api.TextSpan.fromJson(o.toJson()); 991 var od = new api.TextSpan.fromJson(o.toJson());
884 checkTextSpan(od); 992 checkTextSpan(od);
885 }); 993 });
886 }); 994 });
887 995
888
889 unittest.group("obj-schema-Token", () { 996 unittest.group("obj-schema-Token", () {
890 unittest.test("to-json--from-json", () { 997 unittest.test("to-json--from-json", () {
891 var o = buildToken(); 998 var o = buildToken();
892 var od = new api.Token.fromJson(o.toJson()); 999 var od = new api.Token.fromJson(o.toJson());
893 checkToken(od); 1000 checkToken(od);
894 }); 1001 });
895 }); 1002 });
896 1003
897
898 unittest.group("resource-DocumentsResourceApi", () { 1004 unittest.group("resource-DocumentsResourceApi", () {
899 unittest.test("method--analyzeEntities", () { 1005 unittest.test("method--analyzeEntities", () {
900
901 var mock = new HttpServerMock(); 1006 var mock = new HttpServerMock();
902 api.DocumentsResourceApi res = new api.LanguageApi(mock).documents; 1007 api.DocumentsResourceApi res = new api.LanguageApi(mock).documents;
903 var arg_request = buildAnalyzeEntitiesRequest(); 1008 var arg_request = buildAnalyzeEntitiesRequest();
904 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1009 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
905 var obj = new api.AnalyzeEntitiesRequest.fromJson(json); 1010 var obj = new api.AnalyzeEntitiesRequest.fromJson(json);
906 checkAnalyzeEntitiesRequest(obj); 1011 checkAnalyzeEntitiesRequest(obj);
907 1012
908 var path = (req.url).path; 1013 var path = (req.url).path;
909 var pathOffset = 0; 1014 var pathOffset = 0;
910 var index; 1015 var index;
911 var subPart; 1016 var subPart;
912 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1017 unittest.expect(
1018 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
913 pathOffset += 1; 1019 pathOffset += 1;
914 unittest.expect(path.substring(pathOffset, pathOffset + 33), unittest.eq uals("v1beta2/documents:analyzeEntities")); 1020 unittest.expect(path.substring(pathOffset, pathOffset + 33),
1021 unittest.equals("v1beta2/documents:analyzeEntities"));
915 pathOffset += 33; 1022 pathOffset += 33;
916 1023
917 var query = (req.url).query; 1024 var query = (req.url).query;
918 var queryOffset = 0; 1025 var queryOffset = 0;
919 var queryMap = {}; 1026 var queryMap = {};
920 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1027 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
921 parseBool(n) { 1028 parseBool(n) {
922 if (n == "true") return true; 1029 if (n == "true") return true;
923 if (n == "false") return false; 1030 if (n == "false") return false;
924 if (n == null) return null; 1031 if (n == null) return null;
925 throw new core.ArgumentError("Invalid boolean: $n"); 1032 throw new core.ArgumentError("Invalid boolean: $n");
926 } 1033 }
1034
927 if (query.length > 0) { 1035 if (query.length > 0) {
928 for (var part in query.split("&")) { 1036 for (var part in query.split("&")) {
929 var keyvalue = part.split("="); 1037 var keyvalue = part.split("=");
930 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1038 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1039 core.Uri.decodeQueryComponent(keyvalue[1]));
931 } 1040 }
932 } 1041 }
933 1042
934
935 var h = { 1043 var h = {
936 "content-type" : "application/json; charset=utf-8", 1044 "content-type": "application/json; charset=utf-8",
937 }; 1045 };
938 var resp = convert.JSON.encode(buildAnalyzeEntitiesResponse()); 1046 var resp = convert.JSON.encode(buildAnalyzeEntitiesResponse());
939 return new async.Future.value(stringResponse(200, h, resp)); 1047 return new async.Future.value(stringResponse(200, h, resp));
940 }), true); 1048 }), true);
941 res.analyzeEntities(arg_request).then(unittest.expectAsync1(((api.AnalyzeE ntitiesResponse response) { 1049 res
1050 .analyzeEntities(arg_request)
1051 .then(unittest.expectAsync1(((api.AnalyzeEntitiesResponse response) {
942 checkAnalyzeEntitiesResponse(response); 1052 checkAnalyzeEntitiesResponse(response);
943 }))); 1053 })));
944 }); 1054 });
945 1055
946 unittest.test("method--analyzeEntitySentiment", () { 1056 unittest.test("method--analyzeEntitySentiment", () {
947
948 var mock = new HttpServerMock(); 1057 var mock = new HttpServerMock();
949 api.DocumentsResourceApi res = new api.LanguageApi(mock).documents; 1058 api.DocumentsResourceApi res = new api.LanguageApi(mock).documents;
950 var arg_request = buildAnalyzeEntitySentimentRequest(); 1059 var arg_request = buildAnalyzeEntitySentimentRequest();
951 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1060 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
952 var obj = new api.AnalyzeEntitySentimentRequest.fromJson(json); 1061 var obj = new api.AnalyzeEntitySentimentRequest.fromJson(json);
953 checkAnalyzeEntitySentimentRequest(obj); 1062 checkAnalyzeEntitySentimentRequest(obj);
954 1063
955 var path = (req.url).path; 1064 var path = (req.url).path;
956 var pathOffset = 0; 1065 var pathOffset = 0;
957 var index; 1066 var index;
958 var subPart; 1067 var subPart;
959 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1068 unittest.expect(
1069 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
960 pathOffset += 1; 1070 pathOffset += 1;
961 unittest.expect(path.substring(pathOffset, pathOffset + 40), unittest.eq uals("v1beta2/documents:analyzeEntitySentiment")); 1071 unittest.expect(path.substring(pathOffset, pathOffset + 40),
1072 unittest.equals("v1beta2/documents:analyzeEntitySentiment"));
962 pathOffset += 40; 1073 pathOffset += 40;
963 1074
964 var query = (req.url).query; 1075 var query = (req.url).query;
965 var queryOffset = 0; 1076 var queryOffset = 0;
966 var queryMap = {}; 1077 var queryMap = {};
967 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1078 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
968 parseBool(n) { 1079 parseBool(n) {
969 if (n == "true") return true; 1080 if (n == "true") return true;
970 if (n == "false") return false; 1081 if (n == "false") return false;
971 if (n == null) return null; 1082 if (n == null) return null;
972 throw new core.ArgumentError("Invalid boolean: $n"); 1083 throw new core.ArgumentError("Invalid boolean: $n");
973 } 1084 }
1085
974 if (query.length > 0) { 1086 if (query.length > 0) {
975 for (var part in query.split("&")) { 1087 for (var part in query.split("&")) {
976 var keyvalue = part.split("="); 1088 var keyvalue = part.split("=");
977 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1089 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1090 core.Uri.decodeQueryComponent(keyvalue[1]));
978 } 1091 }
979 } 1092 }
980 1093
981
982 var h = { 1094 var h = {
983 "content-type" : "application/json; charset=utf-8", 1095 "content-type": "application/json; charset=utf-8",
984 }; 1096 };
985 var resp = convert.JSON.encode(buildAnalyzeEntitySentimentResponse()); 1097 var resp = convert.JSON.encode(buildAnalyzeEntitySentimentResponse());
986 return new async.Future.value(stringResponse(200, h, resp)); 1098 return new async.Future.value(stringResponse(200, h, resp));
987 }), true); 1099 }), true);
988 res.analyzeEntitySentiment(arg_request).then(unittest.expectAsync1(((api.A nalyzeEntitySentimentResponse response) { 1100 res.analyzeEntitySentiment(arg_request).then(
1101 unittest.expectAsync1(((api.AnalyzeEntitySentimentResponse response) {
989 checkAnalyzeEntitySentimentResponse(response); 1102 checkAnalyzeEntitySentimentResponse(response);
990 }))); 1103 })));
991 }); 1104 });
992 1105
993 unittest.test("method--analyzeSentiment", () { 1106 unittest.test("method--analyzeSentiment", () {
994
995 var mock = new HttpServerMock(); 1107 var mock = new HttpServerMock();
996 api.DocumentsResourceApi res = new api.LanguageApi(mock).documents; 1108 api.DocumentsResourceApi res = new api.LanguageApi(mock).documents;
997 var arg_request = buildAnalyzeSentimentRequest(); 1109 var arg_request = buildAnalyzeSentimentRequest();
998 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1110 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
999 var obj = new api.AnalyzeSentimentRequest.fromJson(json); 1111 var obj = new api.AnalyzeSentimentRequest.fromJson(json);
1000 checkAnalyzeSentimentRequest(obj); 1112 checkAnalyzeSentimentRequest(obj);
1001 1113
1002 var path = (req.url).path; 1114 var path = (req.url).path;
1003 var pathOffset = 0; 1115 var pathOffset = 0;
1004 var index; 1116 var index;
1005 var subPart; 1117 var subPart;
1006 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1118 unittest.expect(
1119 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1007 pathOffset += 1; 1120 pathOffset += 1;
1008 unittest.expect(path.substring(pathOffset, pathOffset + 34), unittest.eq uals("v1beta2/documents:analyzeSentiment")); 1121 unittest.expect(path.substring(pathOffset, pathOffset + 34),
1122 unittest.equals("v1beta2/documents:analyzeSentiment"));
1009 pathOffset += 34; 1123 pathOffset += 34;
1010 1124
1011 var query = (req.url).query; 1125 var query = (req.url).query;
1012 var queryOffset = 0; 1126 var queryOffset = 0;
1013 var queryMap = {}; 1127 var queryMap = {};
1014 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1128 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1015 parseBool(n) { 1129 parseBool(n) {
1016 if (n == "true") return true; 1130 if (n == "true") return true;
1017 if (n == "false") return false; 1131 if (n == "false") return false;
1018 if (n == null) return null; 1132 if (n == null) return null;
1019 throw new core.ArgumentError("Invalid boolean: $n"); 1133 throw new core.ArgumentError("Invalid boolean: $n");
1020 } 1134 }
1135
1021 if (query.length > 0) { 1136 if (query.length > 0) {
1022 for (var part in query.split("&")) { 1137 for (var part in query.split("&")) {
1023 var keyvalue = part.split("="); 1138 var keyvalue = part.split("=");
1024 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1139 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1140 core.Uri.decodeQueryComponent(keyvalue[1]));
1025 } 1141 }
1026 } 1142 }
1027 1143
1028
1029 var h = { 1144 var h = {
1030 "content-type" : "application/json; charset=utf-8", 1145 "content-type": "application/json; charset=utf-8",
1031 }; 1146 };
1032 var resp = convert.JSON.encode(buildAnalyzeSentimentResponse()); 1147 var resp = convert.JSON.encode(buildAnalyzeSentimentResponse());
1033 return new async.Future.value(stringResponse(200, h, resp)); 1148 return new async.Future.value(stringResponse(200, h, resp));
1034 }), true); 1149 }), true);
1035 res.analyzeSentiment(arg_request).then(unittest.expectAsync1(((api.Analyze SentimentResponse response) { 1150 res
1151 .analyzeSentiment(arg_request)
1152 .then(unittest.expectAsync1(((api.AnalyzeSentimentResponse response) {
1036 checkAnalyzeSentimentResponse(response); 1153 checkAnalyzeSentimentResponse(response);
1037 }))); 1154 })));
1038 }); 1155 });
1039 1156
1040 unittest.test("method--analyzeSyntax", () { 1157 unittest.test("method--analyzeSyntax", () {
1041
1042 var mock = new HttpServerMock(); 1158 var mock = new HttpServerMock();
1043 api.DocumentsResourceApi res = new api.LanguageApi(mock).documents; 1159 api.DocumentsResourceApi res = new api.LanguageApi(mock).documents;
1044 var arg_request = buildAnalyzeSyntaxRequest(); 1160 var arg_request = buildAnalyzeSyntaxRequest();
1045 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1161 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1046 var obj = new api.AnalyzeSyntaxRequest.fromJson(json); 1162 var obj = new api.AnalyzeSyntaxRequest.fromJson(json);
1047 checkAnalyzeSyntaxRequest(obj); 1163 checkAnalyzeSyntaxRequest(obj);
1048 1164
1049 var path = (req.url).path; 1165 var path = (req.url).path;
1050 var pathOffset = 0; 1166 var pathOffset = 0;
1051 var index; 1167 var index;
1052 var subPart; 1168 var subPart;
1053 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1169 unittest.expect(
1170 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1054 pathOffset += 1; 1171 pathOffset += 1;
1055 unittest.expect(path.substring(pathOffset, pathOffset + 31), unittest.eq uals("v1beta2/documents:analyzeSyntax")); 1172 unittest.expect(path.substring(pathOffset, pathOffset + 31),
1173 unittest.equals("v1beta2/documents:analyzeSyntax"));
1056 pathOffset += 31; 1174 pathOffset += 31;
1057 1175
1058 var query = (req.url).query; 1176 var query = (req.url).query;
1059 var queryOffset = 0; 1177 var queryOffset = 0;
1060 var queryMap = {}; 1178 var queryMap = {};
1061 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1179 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1062 parseBool(n) { 1180 parseBool(n) {
1063 if (n == "true") return true; 1181 if (n == "true") return true;
1064 if (n == "false") return false; 1182 if (n == "false") return false;
1065 if (n == null) return null; 1183 if (n == null) return null;
1066 throw new core.ArgumentError("Invalid boolean: $n"); 1184 throw new core.ArgumentError("Invalid boolean: $n");
1067 } 1185 }
1186
1068 if (query.length > 0) { 1187 if (query.length > 0) {
1069 for (var part in query.split("&")) { 1188 for (var part in query.split("&")) {
1070 var keyvalue = part.split("="); 1189 var keyvalue = part.split("=");
1071 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1190 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1191 core.Uri.decodeQueryComponent(keyvalue[1]));
1072 } 1192 }
1073 } 1193 }
1074 1194
1075
1076 var h = { 1195 var h = {
1077 "content-type" : "application/json; charset=utf-8", 1196 "content-type": "application/json; charset=utf-8",
1078 }; 1197 };
1079 var resp = convert.JSON.encode(buildAnalyzeSyntaxResponse()); 1198 var resp = convert.JSON.encode(buildAnalyzeSyntaxResponse());
1080 return new async.Future.value(stringResponse(200, h, resp)); 1199 return new async.Future.value(stringResponse(200, h, resp));
1081 }), true); 1200 }), true);
1082 res.analyzeSyntax(arg_request).then(unittest.expectAsync1(((api.AnalyzeSyn taxResponse response) { 1201 res
1202 .analyzeSyntax(arg_request)
1203 .then(unittest.expectAsync1(((api.AnalyzeSyntaxResponse response) {
1083 checkAnalyzeSyntaxResponse(response); 1204 checkAnalyzeSyntaxResponse(response);
1084 }))); 1205 })));
1085 }); 1206 });
1086 1207
1087 unittest.test("method--annotateText", () { 1208 unittest.test("method--annotateText", () {
1088
1089 var mock = new HttpServerMock(); 1209 var mock = new HttpServerMock();
1090 api.DocumentsResourceApi res = new api.LanguageApi(mock).documents; 1210 api.DocumentsResourceApi res = new api.LanguageApi(mock).documents;
1091 var arg_request = buildAnnotateTextRequest(); 1211 var arg_request = buildAnnotateTextRequest();
1092 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1212 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1093 var obj = new api.AnnotateTextRequest.fromJson(json); 1213 var obj = new api.AnnotateTextRequest.fromJson(json);
1094 checkAnnotateTextRequest(obj); 1214 checkAnnotateTextRequest(obj);
1095 1215
1096 var path = (req.url).path; 1216 var path = (req.url).path;
1097 var pathOffset = 0; 1217 var pathOffset = 0;
1098 var index; 1218 var index;
1099 var subPart; 1219 var subPart;
1100 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1220 unittest.expect(
1221 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1101 pathOffset += 1; 1222 pathOffset += 1;
1102 unittest.expect(path.substring(pathOffset, pathOffset + 30), unittest.eq uals("v1beta2/documents:annotateText")); 1223 unittest.expect(path.substring(pathOffset, pathOffset + 30),
1224 unittest.equals("v1beta2/documents:annotateText"));
1103 pathOffset += 30; 1225 pathOffset += 30;
1104 1226
1105 var query = (req.url).query; 1227 var query = (req.url).query;
1106 var queryOffset = 0; 1228 var queryOffset = 0;
1107 var queryMap = {}; 1229 var queryMap = {};
1108 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1230 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1109 parseBool(n) { 1231 parseBool(n) {
1110 if (n == "true") return true; 1232 if (n == "true") return true;
1111 if (n == "false") return false; 1233 if (n == "false") return false;
1112 if (n == null) return null; 1234 if (n == null) return null;
1113 throw new core.ArgumentError("Invalid boolean: $n"); 1235 throw new core.ArgumentError("Invalid boolean: $n");
1114 } 1236 }
1237
1115 if (query.length > 0) { 1238 if (query.length > 0) {
1116 for (var part in query.split("&")) { 1239 for (var part in query.split("&")) {
1117 var keyvalue = part.split("="); 1240 var keyvalue = part.split("=");
1118 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1241 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1242 core.Uri.decodeQueryComponent(keyvalue[1]));
1119 } 1243 }
1120 } 1244 }
1121 1245
1122
1123 var h = { 1246 var h = {
1124 "content-type" : "application/json; charset=utf-8", 1247 "content-type": "application/json; charset=utf-8",
1125 }; 1248 };
1126 var resp = convert.JSON.encode(buildAnnotateTextResponse()); 1249 var resp = convert.JSON.encode(buildAnnotateTextResponse());
1127 return new async.Future.value(stringResponse(200, h, resp)); 1250 return new async.Future.value(stringResponse(200, h, resp));
1128 }), true); 1251 }), true);
1129 res.annotateText(arg_request).then(unittest.expectAsync1(((api.AnnotateTex tResponse response) { 1252 res
1253 .annotateText(arg_request)
1254 .then(unittest.expectAsync1(((api.AnnotateTextResponse response) {
1130 checkAnnotateTextResponse(response); 1255 checkAnnotateTextResponse(response);
1131 }))); 1256 })));
1132 }); 1257 });
1133 1258
1259 unittest.test("method--classifyText", () {
1260 var mock = new HttpServerMock();
1261 api.DocumentsResourceApi res = new api.LanguageApi(mock).documents;
1262 var arg_request = buildClassifyTextRequest();
1263 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1264 var obj = new api.ClassifyTextRequest.fromJson(json);
1265 checkClassifyTextRequest(obj);
1266
1267 var path = (req.url).path;
1268 var pathOffset = 0;
1269 var index;
1270 var subPart;
1271 unittest.expect(
1272 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1273 pathOffset += 1;
1274 unittest.expect(path.substring(pathOffset, pathOffset + 30),
1275 unittest.equals("v1beta2/documents:classifyText"));
1276 pathOffset += 30;
1277
1278 var query = (req.url).query;
1279 var queryOffset = 0;
1280 var queryMap = {};
1281 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1282 parseBool(n) {
1283 if (n == "true") return true;
1284 if (n == "false") return false;
1285 if (n == null) return null;
1286 throw new core.ArgumentError("Invalid boolean: $n");
1287 }
1288
1289 if (query.length > 0) {
1290 for (var part in query.split("&")) {
1291 var keyvalue = part.split("=");
1292 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1293 core.Uri.decodeQueryComponent(keyvalue[1]));
1294 }
1295 }
1296
1297 var h = {
1298 "content-type": "application/json; charset=utf-8",
1299 };
1300 var resp = convert.JSON.encode(buildClassifyTextResponse());
1301 return new async.Future.value(stringResponse(200, h, resp));
1302 }), true);
1303 res
1304 .classifyText(arg_request)
1305 .then(unittest.expectAsync1(((api.ClassifyTextResponse response) {
1306 checkClassifyTextResponse(response);
1307 })));
1308 });
1134 }); 1309 });
1135
1136
1137 } 1310 }
1138
OLDNEW
« no previous file with comments | « generated/googleapis_beta/test/language/v1beta1_test.dart ('k') | generated/googleapis_beta/test/logging/v2beta1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698