Fix bugs in a couple of language tests

Change-Id: I601f1dafa10b9553ad4e08bad3232a896bf52aa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104843
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/tests/language_2/nnbd/static_errors/missing_required_argument_test.dart b/tests/language_2/nnbd/static_errors/missing_required_argument_test.dart
index 9ef8798..630c53d 100644
--- a/tests/language_2/nnbd/static_errors/missing_required_argument_test.dart
+++ b/tests/language_2/nnbd/static_errors/missing_required_argument_test.dart
@@ -12,14 +12,14 @@
   A({required int a}) {}
   A.named() : this(); //# 01: compile-time error
   void m1({required int a}) {}
-  F m2() => ({required String x}) => null;
+  F m2() => ({required String x}) => '';
 }
 
 class B extends A { B() : super(); } //# 02: compile-time error
 
 void f({required int a}) {}
 
-void Function({required int a}) g() => null;
+void Function({required int a}) g() => throw '';
 
 main() {
   A a = new A(); //# 03: compile-time error
diff --git a/tests/language_2/nnbd/static_errors/unchecked_use_of_nullable_test.dart b/tests/language_2/nnbd/static_errors/unchecked_use_of_nullable_test.dart
index ce24941..1555536 100644
--- a/tests/language_2/nnbd/static_errors/unchecked_use_of_nullable_test.dart
+++ b/tests/language_2/nnbd/static_errors/unchecked_use_of_nullable_test.dart
@@ -17,7 +17,7 @@
   x.toString(); //# 02: ok
   x.hashCode; //# 03: ok
   x.runtimeType; //# 04: ok
-  x.noSuchMethod(null); //# 05: ok
+  x.noSuchMethod(Invocation.method(#toString, [])); //# 05: ok
   x + 1; //# 06: compile-time error
   -x; //# 06: compile-time error
   x++; //# 07: compile-time error
@@ -73,7 +73,7 @@
   x.toString(); //# 42: ok
   x.hashCode; //# 43: ok
   x.runtimeType; //# 44: ok
-  x.noSuchMethod(null); //# 45: ok
+  x.noSuchMethod(Invocation.method(#toString, [])); //# 45: ok
   x + 1; //# 46: compile-time error
   -x; //# 47: compile-time error
   x++; //# 48: compile-time error
@@ -124,7 +124,7 @@
   x.toString(); //# 82: ok
   x.hashCode; //# 83: ok
   x.runtimeType; //# 84: ok
-  x.noSuchMethod(null); //# 85: ok
+  x.noSuchMethod(Invocation.method(#toString, [])); //# 85: ok
   x + 1; //# 86: compile-time error
   -x; //# 87: compile-time error
   x++; //# 88: compile-time error