From e19b31db295725e7c8aac1051d84699ec8744ce7 Mon Sep 17 00:00:00 2001 From: Tim Blasi Date: Tue, 12 Jan 2016 11:36:58 -0800 Subject: [PATCH] refactor(test): Remove unnecessary `noSuchMethod` Remove trivial implementations in many spy objects which just calls the parent's `noSuchMethod`. Closes #6410 Closes #6491 --- .../directives/observable_list_diff_spec.dart | 4 +- modules/angular2/test/common/spies.dart | 12 +--- modules/angular2/test/compiler/spies.dart | 8 +-- modules/angular2/test/core/spies.dart | 60 +++++-------------- .../test/platform/browser/tools/spies.dart | 7 +-- modules/angular2/test/router/spies.dart | 13 +--- .../test/testing/testing_internal_spec.ts | 1 - .../web_socket_message_bus_spec.dart | 6 -- .../test/web_workers/worker/spies.dart | 4 +- 9 files changed, 27 insertions(+), 88 deletions(-) diff --git a/modules/angular2/test/common/directives/observable_list_diff_spec.dart b/modules/angular2/test/common/directives/observable_list_diff_spec.dart index 630f4aee68..b6c4104087 100644 --- a/modules/angular2/test/common/directives/observable_list_diff_spec.dart +++ b/modules/angular2/test/common/directives/observable_list_diff_spec.dart @@ -6,9 +6,7 @@ import 'package:angular2/core.dart' show ChangeDetectorRef; import 'package:angular2/common.dart' show ObservableListDiffFactory; @proxy -class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef {} main() { describe('ObservableListDiff', () { diff --git a/modules/angular2/test/common/spies.dart b/modules/angular2/test/common/spies.dart index 50b75e95ab..6c94ca2246 100644 --- a/modules/angular2/test/common/spies.dart +++ b/modules/angular2/test/common/spies.dart @@ -5,16 +5,10 @@ import 'package:angular2/src/core/change_detection/change_detection.dart'; import 'package:angular2/testing_internal.dart'; @proxy -class SpyNgControl extends SpyObject implements NgControl { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyNgControl extends SpyObject implements NgControl {} @proxy -class SpyValueAccessor extends SpyObject implements ControlValueAccessor { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyValueAccessor extends SpyObject implements ControlValueAccessor {} @proxy -class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef {} diff --git a/modules/angular2/test/compiler/spies.dart b/modules/angular2/test/compiler/spies.dart index e651dd805c..df34fedeea 100644 --- a/modules/angular2/test/compiler/spies.dart +++ b/modules/angular2/test/compiler/spies.dart @@ -5,11 +5,7 @@ import 'package:angular2/testing_internal.dart'; import 'package:angular2/src/compiler/template_compiler.dart'; @proxy -class SpyXHR extends SpyObject implements XHR { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyXHR extends SpyObject implements XHR {} @proxy -class SpyTemplateCompiler extends SpyObject implements TemplateCompiler { - noSuchMethod(m) => super.noSuchMethod(m); -} \ No newline at end of file +class SpyTemplateCompiler extends SpyObject implements TemplateCompiler {} diff --git a/modules/angular2/test/core/spies.dart b/modules/angular2/test/core/spies.dart index 1b74e8953c..82eb811e06 100644 --- a/modules/angular2/test/core/spies.dart +++ b/modules/angular2/test/core/spies.dart @@ -13,77 +13,47 @@ import 'package:angular2/src/platform/dom/dom_adapter.dart'; import 'package:angular2/testing_internal.dart'; @proxy -class SpyDependencyProvider extends SpyObject implements DependencyProvider { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyDependencyProvider extends SpyObject implements DependencyProvider {} @proxy -class SpyChangeDetector extends SpyObject implements ChangeDetector { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyChangeDetector extends SpyObject implements ChangeDetector {} @proxy -class SpyChangeDispatcher extends SpyObject implements ChangeDispatcher { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyChangeDispatcher extends SpyObject implements ChangeDispatcher {} @proxy class SpyIterableDifferFactory extends SpyObject - implements IterableDifferFactory { - noSuchMethod(m) => super.noSuchMethod(m); -} + implements IterableDifferFactory {} @proxy -class SpyInjector extends SpyObject implements Injector { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyInjector extends SpyObject implements Injector {} @proxy -class SpyDirectiveResolver extends SpyObject implements DirectiveResolver { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyDirectiveResolver extends SpyObject implements DirectiveResolver {} @proxy -class SpyView extends SpyObject implements AppView { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyView extends SpyObject implements AppView {} @proxy -class SpyProtoView extends SpyObject implements AppProtoView { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyProtoView extends SpyObject implements AppProtoView {} @proxy -class SpyHostViewFactory extends SpyObject implements HostViewFactory { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyHostViewFactory extends SpyObject implements HostViewFactory {} @proxy -class SpyElementRef extends SpyObject implements ElementRef { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyElementRef extends SpyObject implements ElementRef {} @proxy -class SpyAppViewManager extends SpyObject implements AppViewManager_ { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyAppViewManager extends SpyObject implements AppViewManager_ {} @proxy -class SpyRenderer extends SpyObject implements Renderer { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyRenderer extends SpyObject implements Renderer {} @proxy -class SpyRootRenderer extends SpyObject implements RootRenderer { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyRootRenderer extends SpyObject implements RootRenderer {} @proxy -class SpyAppViewListener extends SpyObject implements AppViewListener { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyAppViewListener extends SpyObject implements AppViewListener {} @proxy -class SpyDomAdapter extends SpyObject implements DomAdapter { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyDomAdapter extends SpyObject implements DomAdapter {} diff --git a/modules/angular2/test/platform/browser/tools/spies.dart b/modules/angular2/test/platform/browser/tools/spies.dart index eae85b5060..614f7e73bb 100644 --- a/modules/angular2/test/platform/browser/tools/spies.dart +++ b/modules/angular2/test/platform/browser/tools/spies.dart @@ -8,7 +8,6 @@ import 'dart:js'; @proxy class SpyApplicationRef extends SpyObject implements ApplicationRef { tick() {} - noSuchMethod(m) => super.noSuchMethod(m); } @proxy @@ -16,11 +15,9 @@ class SpyComponentRef extends SpyObject implements ComponentRef_ { Injector injector; SpyComponentRef() { - this.injector = - Injector.resolveAndCreate([bind(ApplicationRef).toClass(SpyApplicationRef)]); + this.injector = Injector + .resolveAndCreate([bind(ApplicationRef).toClass(SpyApplicationRef)]); } - - noSuchMethod(m) => super.noSuchMethod(m); } void callNgProfilerTimeChangeDetection([config]) { diff --git a/modules/angular2/test/router/spies.dart b/modules/angular2/test/router/spies.dart index 2e23c9a6a3..af66ea951b 100644 --- a/modules/angular2/test/router/spies.dart +++ b/modules/angular2/test/router/spies.dart @@ -4,21 +4,14 @@ import 'package:angular2/router.dart'; import 'package:angular2/testing_internal.dart'; @proxy -class SpyLocation extends SpyObject implements Location { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyLocation extends SpyObject implements Location {} @proxy -class SpyRouter extends SpyObject implements Router { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyRouter extends SpyObject implements Router {} @proxy -class SpyRouterOutlet extends SpyObject implements RouterOutlet { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyRouterOutlet extends SpyObject implements RouterOutlet {} class SpyPlatformLocation extends SpyObject implements PlatformLocation { String pathname; - noSuchMethod(m) => super.noSuchMethod(m); } diff --git a/modules/angular2/test/testing/testing_internal_spec.ts b/modules/angular2/test/testing/testing_internal_spec.ts index a12ffe6d3b..78a04208f3 100644 --- a/modules/angular2/test/testing/testing_internal_spec.ts +++ b/modules/angular2/test/testing/testing_internal_spec.ts @@ -24,7 +24,6 @@ class TestObj { class SpyTestObj extends SpyObject { constructor() { super(TestObj); } - noSuchMethod(m) { return super.noSuchMethod(m) } } diff --git a/modules/angular2/test/web_workers/debug_tools/web_socket_message_bus_spec.dart b/modules/angular2/test/web_workers/debug_tools/web_socket_message_bus_spec.dart index 9b87a3e281..e7248c968f 100644 --- a/modules/angular2/test/web_workers/debug_tools/web_socket_message_bus_spec.dart +++ b/modules/angular2/test/web_workers/debug_tools/web_socket_message_bus_spec.dart @@ -60,15 +60,9 @@ main() { @proxy class SpyMessageEvent extends SpyObject implements MessageEvent { SpyMessageEvent() : super(SpyMessageEvent); - noSuchMethod(m) { - return super.noSuchMethod(m); - } } @proxy class SpyWebSocket extends SpyObject implements WebSocket { SpyWebSocket() : super(SpyWebSocket); - noSuchMethod(m) { - return super.noSuchMethod(m); - } } diff --git a/modules/angular2/test/web_workers/worker/spies.dart b/modules/angular2/test/web_workers/worker/spies.dart index c3385ca77c..263b1d160f 100644 --- a/modules/angular2/test/web_workers/worker/spies.dart +++ b/modules/angular2/test/web_workers/worker/spies.dart @@ -4,6 +4,4 @@ import 'package:angular2/src/web_workers/shared/client_message_broker.dart'; import 'package:angular2/testing_internal.dart'; @proxy -class SpyMessageBroker extends SpyObject implements ClientMessageBroker { - noSuchMethod(m) => super.noSuchMethod(m); -} +class SpyMessageBroker extends SpyObject implements ClientMessageBroker {}