migrate `unnecessary_nullable_for_final_variable_declarations` nnbd experiment tests

Fixes: https://github.com/dart-lang/linter/issues/4733

Change-Id: I6fbcd42719be924e463bb03d1998706f2ab3d645
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323442
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
diff --git a/pkg/linter/test/rules/unnecessary_nullable_for_final_variable_declarations_test.dart b/pkg/linter/test/rules/unnecessary_nullable_for_final_variable_declarations_test.dart
index ce9b607..098b423 100644
--- a/pkg/linter/test/rules/unnecessary_nullable_for_final_variable_declarations_test.dart
+++ b/pkg/linter/test/rules/unnecessary_nullable_for_final_variable_declarations_test.dart
@@ -37,12 +37,108 @@
 ''');
   }
 
-  test_nonNullableType() async {
+  test_nonNullableType_const() async {
+    await assertNoDiagnostics(r'''
+const int i = 1;
+const dynamic j = 1; 
+''');
+  }
+
+  test_nonNullableType_field() async {
+    await assertNoDiagnostics(r'''
+class A {
+  // ignore: unused_field
+  final int _j = 1;
+  final int j = 1;
+  final dynamic k = 1;
+  static final int l = 1;
+  // ignore: unused_field
+  static final int _l = 1;
+}
+''');
+  }
+
+  test_nonNullableType_field_extension() async {
+    await assertNoDiagnostics(r'''
+extension E on Object {
+  // ignore: unused_field
+  static final int _j = 1;
+  static final int j = 1;
+  static final dynamic k = 1;
+}
+''');
+  }
+
+  test_nonNullableType_topLevel() async {
     await assertNoDiagnostics(r'''
 final int i = 1;
+// ignore: unused_element
+final int _j = 1;
 ''');
   }
 
+  test_nonNullableType_variable() async {
+    await assertNoDiagnostics(r'''
+f() {
+  final int _j = 1;
+  final int j = 1;
+  final dynamic k = 1;
+}
+''');
+  }
+
+  test_nullableType_field() async {
+    await assertDiagnostics(r'''
+class A {
+  // ignore: unused_field
+  final int? _i = 1;
+  final int? i = 1;
+  static final int? j = 1;
+}
+''', [
+      lint(49, 6),
+      lint(97, 5),
+    ]);
+  }
+
+  test_nullableType_field_extension() async {
+    await assertDiagnostics(r'''
+extension E on Object {
+  // ignore: unused_field
+  static final int? _e = 1;
+  static final int? e = 1;
+}
+''', [
+      lint(70, 6),
+      lint(98, 5),
+    ]);
+  }
+
+  test_nullableType_topLevel() async {
+    await assertDiagnostics(r'''
+// ignore: unused_element
+final int? _i = 1;
+final int? i = 1;
+const int? ic = 1;
+''', [
+      lint(37, 6),
+      lint(56, 5),
+      lint(74, 6),
+    ]);
+  }
+
+  test_nullableType_variable() async {
+    await assertDiagnostics(r'''
+f() {
+  final int? _i = 1;
+  final int? i = 1;
+}
+''', [
+      lint(19, 6),
+      lint(40, 5),
+    ]);
+  }
+
   test_record() async {
     await assertDiagnostics(r'''
 f() {
diff --git a/pkg/linter/test_data/rules/experiments/nnbd/rules/unnecessary_nullable_for_final_variable_declarations.dart b/pkg/linter/test_data/rules/experiments/nnbd/rules/unnecessary_nullable_for_final_variable_declarations.dart
deleted file mode 100644
index c1beee8..0000000
--- a/pkg/linter/test_data/rules/experiments/nnbd/rules/unnecessary_nullable_for_final_variable_declarations.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// test w/ `dart test -N unnecessary_nullable_for_final_variable_declarations`
-
-final int? _i = 1; // LINT
-final int _j = 1; // OK
-final int? i = 1; // LINT
-final int j = 1; // OK
-const int? ic = 1; // LINT
-const int jc = 1; // OK
-const dynamic jcd = 1; // OK
-
-class A {
-  final int? _i = 1; // LINT
-  final int _j = 1; // OK
-  final int? i = 1; // OK (may be overriden or may override)
-  final int j = 1; // OK
-  final dynamic jd = 1; // OK
-  static final int? si = 1; // LINT
-  static final int sj = 1; // OK
-}
-
-extension E on A {
-  static final int? _e1i = 1; // LINT
-  static final int _e1j = 1; // OK
-  static final int? e1i = 1; // LINT
-  static final int e1j = 1; // OK
-  static final dynamic e1jd = 1; // OK
-}
-
-m() {
-  final int? _i = 1; // LINT
-  final int _j = 1; // OK
-  final int? i = 1; // LINT
-  final int j = 1; // OK
-  final dynamic jd = 1; // OK
-}