@@ -280,6 +280,76 @@ void main() {
280
280
expect (routeWithDefaultCaseSensitivity.caseSensitive, false );
281
281
},
282
282
);
283
+
284
+ testWidgets (
285
+ 'It should throw beacuase there is no code generated' ,
286
+ (WidgetTester tester) async {
287
+ final List <FlutterErrorDetails > errors = < FlutterErrorDetails > [];
288
+
289
+ FlutterError .onError =
290
+ (FlutterErrorDetails details) => errors.add (details);
291
+
292
+ const String errorText = 'Should be generated' ;
293
+
294
+ Widget buildWidget (void Function (BuildContext ) onTap) {
295
+ return MaterialApp (
296
+ home: Builder (
297
+ builder: (BuildContext context) => GestureDetector (
298
+ child: const Text ('Tap' ),
299
+ onTap: () => onTap (context),
300
+ ),
301
+ ),
302
+ );
303
+ }
304
+
305
+ final Widget pushThrower = buildWidget ((BuildContext context) {
306
+ const _GoRouteDataBuild ().push <void >(context);
307
+ });
308
+ await tester.pumpWidget (pushThrower);
309
+ await tester.tap (find.text ('Tap' ));
310
+
311
+ expect (errors.first.exception, isA <UnimplementedError >());
312
+ expect (errors.first.exception.toString (), contains (errorText));
313
+
314
+ errors.clear ();
315
+
316
+ final Widget goThrower = buildWidget ((BuildContext context) {
317
+ const _GoRouteDataBuild ().go (context);
318
+ });
319
+ await tester.pumpWidget (goThrower);
320
+ await tester.tap (find.text ('Tap' ));
321
+
322
+ expect (errors.first.exception, isA <UnimplementedError >());
323
+ expect (errors.first.exception.toString (), contains (errorText));
324
+
325
+ errors.clear ();
326
+
327
+ final Widget pushReplacementThrower =
328
+ buildWidget ((BuildContext context) {
329
+ const _GoRouteDataBuild ().pushReplacement (context);
330
+ });
331
+ await tester.pumpWidget (pushReplacementThrower);
332
+ await tester.tap (find.text ('Tap' ));
333
+
334
+ expect (errors.first.exception, isA <UnimplementedError >());
335
+ expect (errors.first.exception.toString (), contains (errorText));
336
+
337
+ errors.clear ();
338
+
339
+ final Widget replaceThrower = buildWidget ((BuildContext context) {
340
+ const _GoRouteDataBuild ().pushReplacement (context);
341
+ });
342
+ await tester.pumpWidget (replaceThrower);
343
+ await tester.tap (find.text ('Tap' ));
344
+
345
+ expect (errors.first.exception, isA <UnimplementedError >());
346
+ expect (errors.first.exception.toString (), contains (errorText));
347
+
348
+ errors.clear ();
349
+
350
+ FlutterError .onError = FlutterError .dumpErrorToConsole;
351
+ },
352
+ );
283
353
});
284
354
285
355
group ('ShellRouteData' , () {
0 commit comments