anchor.diff:  import 'dart:async';
   
   class HistoryMock extends Mock implements HashHistory {
  -  String url = null;
  -  void pushState(Object data, String title, [String url]){
  -    this.url = url;
  -  }
  -  void replaceState(Object data, String title, [String url]){
  -    this.url = url;
  -  }
   }
   
   // History class for async testing
  -class HistoryAsyncMock extends Mock implements HashHistory {
  +class DummyTestHistory {
     String expected_title;
     String expected_url;
  -
  -  HistoryAsyncMock(this.expected_title, this.expected_url);
  +  var test = true;
  +
  +  DummyTestHistory(this.expected_title, this.expected_url);
   
     void pushState(Object data, String title, [String url]){
  -    expect(title, equals(this.expected_title));
  -    expect(title, equals(this.expected_url));
  +    if(test){
  +      expect(title, equals(this.expected_title));
  +      expect(title, equals(this.expected_url));
  +    }
     }
     void replaceState(Object data, String title, [String url]){
  -    expect(title, equals(this.expected_title));
  -    expect(title, equals(this.expected_url));
  -  }
  -}
  -
  -class ViewMock extends Mock implements View {
  -  var state = null;
  +    if(test){
  +      expect(title, equals(this.expected_title));
  +      expect(title, equals(this.expected_url));
  +    }
  +  }
  +}
  +
  +class AsyncHistoryMock extends Mock implements DummyTestHistory {
  +  DummyTestHistory _real;
  +
  +  AsyncHistoryMock(DummyTestHistory history){
  +    _real = history;
  +    when(callsTo('replaceState')).alwaysCall(_real.replaceState);
  +    when(callsTo('pushState')).alwaysCall(_real.pushState);
  +  }
  +}
  +
  +// Spy for View
  +class DummyView implements View{
     Data data = null;
     void load(Data data){
  -    this.state = #load;
       this.data = data;
     }
     void unload(){
  -    this.state = #unload;
  +    this.data = null;
  +  }
  +}
  +
  +class ViewSpy extends Mock implements DummyView {
  +  DummyView _real;
  +
  +  ViewSpy(DummyView view){
  +    _real = view;
  +    when(callsTo('load')).alwaysCall(_real.load);
  +    when(callsTo('unload')).alwaysCall(_real.unload);
     }
   }
   
  
positive.code:     var historyReplaceCalls = 0;
      var historyPushCalls = 0;
  
      ViewMock viewStatic = new ViewMock();
      ViewMock viewOneParameter = new ViewMock();
  
      PageNavigator pageNavigator = new PageNavigator(router, history);
      pageNavigator.registerView(routeNameStatic, viewStatic);
  
negative.code:       // history state
        history.getLogs(callsTo("replaceState")).verify(happenedExactly(++historyReplaceCalls));
        history.getLogs(callsTo("pushState")).verify(happenedExactly(historyPushCalls));
        expect(history.getLogs(callsTo('replaceState')).last.args[2], equals(pathOneParameter));
  
        //view methods called correctly
        viewOneParameter.getLogs(callsTo("load")).verify(happenedOnce);
        expect(viewOneParameter.getLogs(callsTo('load')).last.args.first.toJson(), equals(params));
  
        viewOneParameter.getLogs(callsTo("unload")).verify(happenedExactly(0));
      });
  