@@ -89,18 +89,6 @@ MockFoo() {
89
89
void main () {
90
90
late InMemoryAssetWriter writer;
91
91
92
- /// Test [MockBuilder] in a package which has not opted into null safety.
93
- Future <void > testPreNonNullable (Map <String , String > sourceAssets,
94
- {Map <String , /*String|Matcher<String>*/ Object >? outputs}) async {
95
- final packageConfig = PackageConfig ([
96
- Package ('foo' , Uri .file ('/foo/' ),
97
- packageUriRoot: Uri .file ('/foo/lib/' ),
98
- languageVersion: LanguageVersion (2 , 7 ))
99
- ]);
100
- await testBuilder (buildMocks (BuilderOptions ({})), sourceAssets,
101
- outputs: outputs, packageConfig: packageConfig);
102
- }
103
-
104
92
/// Builds with [MockBuilder] in a package which has opted into null safety,
105
93
/// returning the content of the generated mocks library.
106
94
Future <String > buildWithNonNullable (Map <String , String > sourceAssets) async {
@@ -622,34 +610,6 @@ void main() {
622
610
expect (mocksContent, contains ('returnValueForMissingStub: 0,' ));
623
611
});
624
612
625
- test (
626
- 'generates mock methods with non-nullable return types, specifying '
627
- 'legal default values for basic known types, in mixed mode' , () async {
628
- final mocksContent = await buildWithNonNullable ({
629
- ...annotationsAsset,
630
- 'foo|lib/foo.dart' : dedent (r'''
631
- abstract class Foo {
632
- int m({required int x, double? y});
633
- }
634
- ''' ),
635
- 'foo|test/foo_test.dart' : '''
636
- // @dart=2.9
637
- import 'package:foo/foo.dart';
638
- import 'package:mockito/annotations.dart';
639
-
640
- @GenerateMocks(
641
- [],
642
- customMocks: [
643
- MockSpec<Foo>(onMissingStub: OnMissingStub.returnDefault),
644
- ],
645
- )
646
- void main() {}
647
- '''
648
- });
649
- expect (mocksContent, contains ('returnValue: 0,' ));
650
- expect (mocksContent, contains ('returnValueForMissingStub: 0,' ));
651
- });
652
-
653
613
test (
654
614
'generates mock methods with non-nullable return types, specifying '
655
615
'legal default values for unknown types' , () async {
@@ -1273,58 +1233,6 @@ void main() {
1273
1233
);
1274
1234
});
1275
1235
1276
- test ('given a pre-non-nullable library, does not override any members' ,
1277
- () async {
1278
- await testPreNonNullable (
1279
- {
1280
- ...annotationsAsset,
1281
- ...simpleTestAsset,
1282
- 'foo|lib/foo.dart' : dedent (r'''
1283
- abstract class Foo {
1284
- int f(int a);
1285
- }
1286
- ''' ),
1287
- },
1288
- outputs: {
1289
- 'foo|test/foo_test.mocks.dart' : _containsAllOf (dedent ('''
1290
- class MockFoo extends _i1.Mock implements _i2.Foo {
1291
- $_constructorWithThrowOnMissingStub
1292
- }
1293
- ''' ))
1294
- },
1295
- );
1296
- });
1297
-
1298
- test (
1299
- 'given a pre-non-nullable safe library, does not write "?" on interface '
1300
- 'types' , () async {
1301
- await testPreNonNullable (
1302
- {
1303
- ...annotationsAsset,
1304
- ...simpleTestAsset,
1305
- 'foo|lib/foo.dart' : dedent ('''
1306
- abstract class Foo<T> {
1307
- int f(int a);
1308
- }
1309
- ''' ),
1310
- 'foo|test/foo_test.dart' : dedent ('''
1311
- import 'package:foo/foo.dart';
1312
- import 'package:mockito/annotations.dart';
1313
- @GenerateMocks(
1314
- [], customMocks: [MockSpec<Foo<int>>(as: #MockFoo)])
1315
- void main() {}
1316
- ''' ),
1317
- },
1318
- outputs: {
1319
- 'foo|test/foo_test.mocks.dart' : _containsAllOf (dedent ('''
1320
- class MockFoo extends _i1.Mock implements _i2.Foo<int> {
1321
- $_constructorWithThrowOnMissingStub
1322
- }
1323
- ''' ))
1324
- },
1325
- );
1326
- });
1327
-
1328
1236
test (
1329
1237
'generates a mock class which uses the new behavior of returning '
1330
1238
'a valid value for missing stubs, if GenerateNiceMocks were used' ,
0 commit comments