@@ -11,11 +11,11 @@ class RealClass {
1111 String methodWithObjArgs (RealClass x) => "Real" ;
1212 // "SpecialArgs" here means type-parameterized args. But that makes for a long
1313 // method name.
14- String methodWithSpecialArgs (
14+ String typeParameterizedFn (
1515 List <int > w, List <int > x, [List <int > y, List <int > z]) => "Real" ;
1616 // "SpecialNamedArgs" here means type-parameterized, named args. But that
1717 // makes for a long method name.
18- String methodWithSpecialNamedArgs (List <int > w, List <int > x, {List <int > y, List <int > z}) =>
18+ String typeParameterizedNamedFn (List <int > w, List <int > x, {List <int > y, List <int > z}) =>
1919 "Real" ;
2020 String get getter => "Real" ;
2121 void set setter (String arg) {
@@ -219,93 +219,78 @@ void main() {
219219 expect (mock.methodWithNormalArgs (43 ), equals ("43" ));
220220 });
221221 test ("should mock method with typed arg matchers" , () {
222- when (mock.methodWithSpecialArgs (
223- typed/*<List<int>>*/ (any), typed/*<List<int>>*/ (any)))
222+ when (mock.typeParameterizedFn (typed (any), typed (any)))
224223 .thenReturn ("A lot!" );
225- expect (mock.methodWithSpecialArgs ([42 ], [43 ]), equals ("A lot!" ));
226- expect (mock.methodWithSpecialArgs ([43 ], [44 ]), equals ("A lot!" ));
224+ expect (mock.typeParameterizedFn ([42 ], [43 ]), equals ("A lot!" ));
225+ expect (mock.typeParameterizedFn ([43 ], [44 ]), equals ("A lot!" ));
227226 });
228227 test ("should mock method with an optional typed arg matcher" , () {
229- when (mock.methodWithSpecialArgs (
230- typed/*<List<int>>*/ (any),
231- typed/*<List<int>>*/ (any),
232- typed/*<List<int>>*/ (any)))
228+ when (mock.typeParameterizedFn (typed (any), typed (any), typed (any)))
233229 .thenReturn ("A lot!" );
234- expect (mock.methodWithSpecialArgs ([42 ], [43 ], [44 ]), equals ("A lot!" ));
230+ expect (mock.typeParameterizedFn ([42 ], [43 ], [44 ]), equals ("A lot!" ));
235231 });
236232 test ("should mock method with an optional typed arg matcher and an optional real arg" , () {
237- when (mock.methodWithSpecialArgs (
238- typed/*<List<int>>*/ (any),
239- typed/*<List<int>>*/ (any),
240- [44 ],
241- typed/*<List<int>>*/ (any)))
233+ when (mock.typeParameterizedFn (typed (any), typed (any), [44 ], typed (any)))
242234 .thenReturn ("A lot!" );
243- expect (mock.methodWithSpecialArgs ([42 ], [43 ], [44 ], [45 ]), equals ("A lot!" ));
235+ expect (mock.typeParameterizedFn ([42 ], [43 ], [44 ], [45 ]), equals ("A lot!" ));
244236 });
245237 test ("should mock method with only some typed arg matchers" , () {
246- when (mock.methodWithSpecialArgs (
247- typed/*<List<int>>*/ (any), [43 ], typed/*<List<int>>*/ (any)))
238+ when (mock.typeParameterizedFn (typed (any), [43 ], typed (any)))
248239 .thenReturn ("A lot!" );
249- expect (mock.methodWithSpecialArgs ([42 ], [43 ], [44 ]), equals ("A lot!" ));
250- when (mock.methodWithSpecialArgs (typed/*<List<int>>*/ (any), [43 ]))
240+ expect (mock.typeParameterizedFn ([42 ], [43 ], [44 ]), equals ("A lot!" ));
241+ when (mock.typeParameterizedFn (typed (any), [43 ]))
251242 .thenReturn ("A bunch!" );
252- expect (mock.methodWithSpecialArgs ([42 ], [43 ]), equals ("A bunch!" ));
243+ expect (mock.typeParameterizedFn ([42 ], [43 ]), equals ("A bunch!" ));
253244 });
254245 test ("should throw when [typed] used alongside [null]." , () {
255- expect (() => when (mock.methodWithSpecialArgs (
256- typed/*<List<int>>*/ (any), null , typed/*<List<int>>*/ (any))),
246+ expect (() => when (mock.typeParameterizedFn (typed (any), null , typed (any))),
257247 throwsArgumentError);
258- expect (() => when (mock.methodWithSpecialArgs (
259- typed/*<List<int>>*/ (any), typed/*<List<int>>*/ (any), null )),
248+ expect (() => when (mock.typeParameterizedFn (typed (any), typed (any), null )),
260249 throwsArgumentError);
261250 });
262251 test ("should mock method when [typed] used alongside matched [null]." , () {
263- when (mock.methodWithSpecialArgs (
264- typed/*<List<int>>*/ (any), argThat (equals (null )), typed/*<List<int>>*/ (any)))
252+ when (mock.typeParameterizedFn (
253+ typed (any), argThat (equals (null )), typed (any)))
265254 .thenReturn ("A lot!" );
266- expect (mock.methodWithSpecialArgs ([42 ], null , [44 ]), equals ("A lot!" ));
255+ expect (mock.typeParameterizedFn ([42 ], null , [44 ]), equals ("A lot!" ));
267256 });
268257 test ("should mock method with named, typed arg matcher" , () {
269- when (mock.methodWithSpecialNamedArgs (
270- typed/*<List<int>>*/ (any), [43 ], y: typed/*<List<int>>*/ (any, named: "y" )))
258+ when (mock.typeParameterizedNamedFn (
259+ typed (any), [43 ], y: typed (any, named: "y" )))
271260 .thenReturn ("A lot!" );
272- expect (mock.methodWithSpecialNamedArgs ([42 ], [43 ], y: [44 ]), equals ("A lot!" ));
261+ expect (mock.typeParameterizedNamedFn ([42 ], [43 ], y: [44 ]), equals ("A lot!" ));
273262 });
274263 test ("should mock method with named, typed arg matcher and an arg matcher" , () {
275264 when (
276- mock.methodWithSpecialNamedArgs (
277- typed/*<List<int>>*/ (any),
278- [43 ],
279- y: typed/*<List<int>>*/ (any, named: "y" ),
280- z: argThat (contains (45 ))))
265+ mock.typeParameterizedNamedFn (
266+ typed (any), [43 ],
267+ y: typed (any, named: "y" ), z: argThat (contains (45 ))))
281268 .thenReturn ("A lot!" );
282- expect (mock.methodWithSpecialNamedArgs ([42 ], [43 ], y: [44 ], z: [45 ]),
269+ expect (mock.typeParameterizedNamedFn ([42 ], [43 ], y: [44 ], z: [45 ]),
283270 equals ("A lot!" ));
284271 });
285272 test ("should mock method with named, typed arg matcher and a regular arg" , () {
286273 when (
287- mock.methodWithSpecialNamedArgs (
288- typed/*<List<int>>*/ (any),
289- [43 ],
290- y: typed/*<List<int>>*/ (any, named: "y" ),
291- z: [45 ]))
274+ mock.typeParameterizedNamedFn (
275+ typed (any), [43 ],
276+ y: typed (any, named: "y" ), z: [45 ]))
292277 .thenReturn ("A lot!" );
293- expect (mock.methodWithSpecialNamedArgs ([42 ], [43 ], y: [44 ], z: [45 ]),
278+ expect (mock.typeParameterizedNamedFn ([42 ], [43 ], y: [44 ], z: [45 ]),
294279 equals ("A lot!" ));
295280 });
296281 test ("should throw when [typed] used as a named arg, without `named:`" , () {
297- expect (() => when (mock.methodWithSpecialNamedArgs (
298- typed/*<List<int>>*/ (any), [43 ], y: typed/*<List<int>>*/ (any))),
282+ expect (() => when (mock.typeParameterizedNamedFn (
283+ typed (any), [43 ], y: typed (any))),
299284 throwsArgumentError);
300285 });
301286 test ("should throw when [typed] used as a positional arg, with `named:`" , () {
302- expect (() => when (mock.methodWithSpecialNamedArgs (
303- typed/*<List<int>>*/ (any), typed/*<List<int>>*/ (any, named: "y" ))),
287+ expect (() => when (mock.typeParameterizedNamedFn (
288+ typed (any), typed (any, named: "y" ))),
304289 throwsArgumentError);
305290 });
306291 test ("should throw when [typed] used as a named arg, with the wrong `named:`" , () {
307- expect (() => when (mock.methodWithSpecialNamedArgs (
308- typed/*<List<int>>*/ (any), [43 ], y: typed/*<List<int>>*/ (any, named: "z" ))),
292+ expect (() => when (mock.typeParameterizedNamedFn (
293+ typed (any), [43 ], y: typed (any, named: "z" ))),
309294 throwsArgumentError);
310295 });
311296 });
@@ -424,15 +409,14 @@ void main() {
424409 verify (mock.setter = "A" );
425410 });
426411 test ("should verify method with typed arg matchers" , () {
427- mock.methodWithSpecialArgs ([42 ], [43 ]);
428- verify (mock.methodWithSpecialArgs (
429- typed/*<List<int>>*/ (any), typed/*<List<int>>*/ (any)));
412+ mock.typeParameterizedFn ([42 ], [43 ]);
413+ verify (mock.typeParameterizedFn (typed (any), typed (any)));
430414 });
431415 test ("should verify method with argument capturer" , () {
432- mock.methodWithSpecialArgs ([50 ], [17 ]);
433- mock.methodWithSpecialArgs ([100 ], [17 ]);
434- expect (verify (mock.methodWithSpecialArgs (
435- typed/*<List<int>>*/ (captureAny), [17 ])).captured,
416+ mock.typeParameterizedFn ([50 ], [17 ]);
417+ mock.typeParameterizedFn ([100 ], [17 ]);
418+ expect (verify (mock.typeParameterizedFn (
419+ typed (captureAny), [17 ])).captured,
436420 equals ([[50 ], [100 ]]));
437421 });
438422 });
0 commit comments