MockBuilder: fix static analysis issues:

* Remove unused helper in test
* Migrate off analyzer displayName getters.

PiperOrigin-RevId: 323832498
diff --git a/lib/src/builder.dart b/lib/src/builder.dart
index 1fe143c..0ce83be 100644
--- a/lib/src/builder.dart
+++ b/lib/src/builder.dart
@@ -707,7 +707,7 @@
       // There is a potential for these names to collide. If one mock class
       // requires a fake for a certain Foo, and another mock class requires a
       // fake for a different Foo, they will collide.
-      var fakeName = '_Fake${dartType.name}';
+      var fakeName = '_Fake${elementToFake.name}';
       // Only make one fake class for each class that needs to be faked.
       if (!fakedClassElements.contains(elementToFake)) {
         fakeClasses.add(Class((cBuilder) {
@@ -722,7 +722,7 @@
           }
           cBuilder.implements.add(TypeReference((b) {
             b
-              ..symbol = dartType.name
+              ..symbol = elementToFake.name
               ..url = _typeImport(dartType)
               ..types.addAll(typeParameters);
           }));
@@ -928,7 +928,7 @@
     if (type is analyzer.InterfaceType) {
       return TypeReference((b) {
         b
-          ..symbol = type.name
+          ..symbol = type.element.name
           ..isNullable = forceNullable || typeSystem.isPotentiallyNullable(type)
           ..url = _typeImport(type)
           ..types.addAll(type.typeArguments.map(_typeReference));
@@ -967,11 +967,11 @@
     } else if (type is analyzer.TypeParameterType) {
       return TypeReference((b) {
         b
-          ..symbol = type.name
+          ..symbol = type.element.name
           ..isNullable = forceNullable || typeSystem.isNullable(type);
       });
     } else {
-      return refer(type.displayName, _typeImport(type));
+      return refer(type.getDisplayString(), _typeImport(type));
     }
   }
 
diff --git a/test/builder/custom_mocks_test.dart b/test/builder/custom_mocks_test.dart
index 77a34ee..586c7c0 100644
--- a/test/builder/custom_mocks_test.dart
+++ b/test/builder/custom_mocks_test.dart
@@ -490,32 +490,6 @@
   );
 }
 
-/// Test [MockBuilder] on a single source file, in a package which has opted
-/// into the non-nullable type system, and with the non-nullable experiment
-/// enabled.
-Future<void> _expectSingleNonNullableOutput(
-    String sourceAssetText,
-    /*String|Matcher<List<int>>*/ dynamic output) async {
-  var packageConfig = PackageConfig([
-    Package('foo', Uri.file('/foo/'),
-        packageUriRoot: Uri.file('/foo/lib/'),
-        languageVersion: LanguageVersion(2, 9))
-  ]);
-
-  await withEnabledExperiments(
-    () async => await testBuilder(
-        buildMocks(BuilderOptions({})),
-        {
-          ...annotationsAsset,
-          ...simpleTestAsset,
-          'foo|lib/foo.dart': sourceAssetText,
-        },
-        outputs: {'foo|test/foo_test.mocks.dart': output},
-        packageConfig: packageConfig),
-    ['non-nullable'],
-  );
-}
-
 TypeMatcher<List<int>> _containsAllOf(a, [b]) => decodedMatches(
     b == null ? allOf(contains(a)) : allOf(contains(a), contains(b)));