Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: pkg/analysis_server/test/mocks.dart

Issue 252373003: Rework some analysis server tests using mocks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Mock Sources too. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/test/analysis_server_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/mocks.dart
diff --git a/pkg/analysis_server/test/mocks.dart b/pkg/analysis_server/test/mocks.dart
index 973ebeb1db240362a579f49f5442bca698a7ad8f..065ecdeb232a87671f2e21f4ef602d1b1d96c7c3 100644
--- a/pkg/analysis_server/test/mocks.dart
+++ b/pkg/analysis_server/test/mocks.dart
@@ -9,11 +9,13 @@ import 'dart:io';
import 'dart:mirrors';
import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/source.dart';
import 'package:analysis_server/src/analysis_logger.dart';
import 'package:analysis_server/src/analysis_server.dart';
import 'package:analysis_server/src/channel.dart';
import 'package:analysis_server/src/protocol.dart';
import 'package:matcher/matcher.dart';
+import 'package:mock/mock.dart';
import 'package:unittest/unittest.dart';
/**
@@ -182,14 +184,17 @@ class MockAnalysisLogger extends Logger {
}
/**
- * A mock [AnalysisContext] for testing [AnalysisServer]. This class raises an
- * exception for every abstract method in [AnalysisContext]. Tests should
- * derive from this and re-implement the methods they need.
+ * A mock [AnalysisContext] for testing [AnalysisServer].
*/
@proxy
scheglov 2014/04/24 05:56:25 Why do we need @proxy here?
Paul Berry 2014/04/24 15:05:26 My mistake. I've removed it.
-class MockAnalysisContext extends AnalysisContext {
- noSuchMethod(Invocation invocation) {
- var name = MirrorSystem.getName(invocation.memberName);
- return _unexpected("MockAnalysisContext.$name");
- }
+class MockAnalysisContext extends Mock implements AnalysisContext {
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+}
+
+/**
+ * A mock [Source]. Particularly useful when all that is needed is the
+ * encoding.
+ */
+class MockSource extends Mock implements Source {
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}
« no previous file with comments | « pkg/analysis_server/test/analysis_server_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698