[analysis_server] move package:matcher to a dev_dependency

Change-Id: Id4ed2ea8c960ca35bb1abbe74fdf2a711baf3c1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402586
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
diff --git a/pkg/analysis_server/lib/src/utilities/mocks.dart b/pkg/analysis_server/lib/src/utilities/mocks.dart
index 0c47555..1a1a5da 100644
--- a/pkg/analysis_server/lib/src/utilities/mocks.dart
+++ b/pkg/analysis_server/lib/src/utilities/mocks.dart
@@ -11,7 +11,6 @@
 import 'package:analyzer_plugin/protocol/protocol.dart' as plugin;
 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
 import 'package:analyzer_plugin/src/protocol/protocol_internal.dart' as plugin;
-import 'package:matcher/expect.dart';
 import 'package:watcher/watcher.dart';
 
 /// A mock [ServerCommunicationChannel] for testing [AnalysisServer].
@@ -47,11 +46,6 @@
     _closed = true;
   }
 
-  void expectMsgCount({int responseCount = 0, int notificationCount = 0}) {
-    expect(responsesReceived, hasLength(responseCount));
-    expect(notificationsReceived, hasLength(notificationCount));
-  }
-
   @override
   void sendNotification(Notification notification) {
     // Don't deliver notifications after the connection is closed.
@@ -188,7 +182,7 @@
 
   @override
   dynamic noSuchMethod(Invocation invocation) =>
-      fail('Unexpected invocation of ${invocation.memberName}');
+      throw Exception('Unexpected invocation of ${invocation.memberName}');
 
   @override
   void removedContextRoot(analyzer.ContextRoot contextRoot) {
diff --git a/pkg/analysis_server/pubspec.yaml b/pkg/analysis_server/pubspec.yaml
index 7328685..1c5bf99 100644
--- a/pkg/analysis_server/pubspec.yaml
+++ b/pkg/analysis_server/pubspec.yaml
@@ -21,7 +21,6 @@
   json_rpc_2: any
   language_server_protocol: any
   linter: any
-  matcher: any
   memory_usage: any
   meta: any
   path: any
@@ -40,6 +39,7 @@
   cli_util: any
   lints: any
   logging: any
+  matcher: any
   test: any
   test_descriptor: any
   test_reflective_loader: any
diff --git a/pkg/analysis_server/test/socket_server_test.dart b/pkg/analysis_server/test/socket_server_test.dart
index e66ac37..798e174 100644
--- a/pkg/analysis_server/test/socket_server_test.dart
+++ b/pkg/analysis_server/test/socket_server_test.dart
@@ -98,3 +98,10 @@
     return server;
   }
 }
+
+extension on MockServerChannel {
+  void expectMsgCount({int responseCount = 0, int notificationCount = 0}) {
+    expect(responsesReceived, hasLength(responseCount));
+    expect(notificationsReceived, hasLength(notificationCount));
+  }
+}