anchor.diff:      });
   
       test('returns empty response if no task available', () async {
  -      RequestContext context = RequestContext(agent: agent);
  +      FakeRequestContext context = FakeRequestContext()..agent = agent;
         Map<String, dynamic> request = <String, dynamic>{'AgentID': 'aid'};
         when(taskProvider.findNextTask(agent)).thenAnswer((Invocation invocation) {
           return Future<TaskAndCommit>.value(null);
  
positive.code:     });
  
      test('Looks up agent if not provided in the context', () async {
        RequestContext context = RequestContext();
        Map<String, dynamic> request = <String, dynamic>{'AgentID': 'aid'};
        when(db.lookup<Agent>(any)).thenAnswer((Invocation invocation) {
          return Future<List<Agent>>.value(<Agent>[agent]);
  
negative.code:     });
  
      test('throws 400 if no agent in context or request', () {
        FakeRequestContext context = FakeRequestContext();
        Map<String, dynamic> request = <String, dynamic>{};
        expect(() => handler.handleApiRequest(context, request), throwsA(isA<BadRequestException>()));
      });
  
      test('throws 400 if context and request disagree on agent id', () {
        FakeRequestContext context = FakeRequestContext()..agent = agent;
        Map<String, dynamic> request = <String, dynamic>{'AgentID': 'bar'};
        expect(() => handler.handleApiRequest(context, request), throwsA(isA<BadRequestException>()));
      });
  