anchor.diff:    group('matchAnnotation', () {
       group('with field annotations', () {
         test('annotated with typed field', () {
  -        var annotatedClass =
  -            _getAnnotationForClass(libElement, 'WithTypedField');
  -        var annotation = annotatedClass.metadata.single;
  +        var annotation = _getClassAnnotation(libElement, 'WithTypedField');
           var matched = matchAnnotation(defs.PublicAnnotationClass, annotation);
           expect(matched, isTrue);
         });
   
         test('annotated with untyped field', () {
  -        var annotatedClass =
  -            _getAnnotationForClass(libElement, 'WithUntypedField');
  -        var annotation = annotatedClass.metadata.single;
  +        var annotation = _getClassAnnotation(libElement, 'WithUntypedField');
           var matched = matchAnnotation(defs.PublicAnnotationClass, annotation);
           expect(matched, isTrue);
         });
   
         test('annotated with local typed field', () {
  -        var annotatedClass =
  -            _getAnnotationForClass(libElement, 'WithLocalTypedField');
  -        var annotation = annotatedClass.metadata.single;
  +        var annotation = _getClassAnnotation(libElement, 'WithLocalTypedField');
           var matched = matchAnnotation(defs.PublicAnnotationClass, annotation);
           expect(matched, isTrue);
         });
   
         test('annotated with local untyped field', () {
  -        var annotatedClass =
  -            _getAnnotationForClass(libElement, 'WithLocalUntypedField');
  -        var annotation = annotatedClass.metadata.single;
  +        var annotation =
  +            _getClassAnnotation(libElement, 'WithLocalUntypedField');
           var matched = matchAnnotation(defs.PublicAnnotationClass, annotation);
           expect(matched, isTrue);
         });
  
positive.code: 
      group('with class annotations', () {
        test('annotated with class', () {
          var annotatedClass = _getAnnotationForClass(libElement, 'CtorNoParams');
          var annotation = annotatedClass.metadata.single;
          var matched = matchAnnotation(defs.PublicAnnotationClass, annotation);
          expect(matched, isTrue);
        });
  
        test('not annotated with specified class', () {
          var annotatedClass =
              _getAnnotationForClass(libElement, 'OtherClassCtorNoParams');
          var annotation = annotatedClass.metadata.single;
          var matched = matchAnnotation(defs.PublicAnnotationClass, annotation);
          expect(matched, isFalse, reason: 'not annotated with that type');
        });
  
        test('annotated with class in a part', () {
          ClassElement annotatedClass =
              _getAnnotationForClass(libElement, 'CtorNoParamsFromPartInPart');
          var annotation = annotatedClass.metadata.single;
          var matched =
              matchAnnotation(defs.PublicAnnotationClassInPart, annotation);
          expect(matched, isTrue);
        });
  
        test('class in a part annotated with class', () {
          var annotatedClass =
              _getAnnotationForClass(libElement, 'CtorNoParamsInPart');
          var annotation = annotatedClass.metadata.single;
          var matched = matchAnnotation(defs.PublicAnnotationClass, annotation);
          expect(matched, isTrue);
        });
  
        test('class in a part annotated with class in a part', () {
          ClassElement annotatedClass =
              _getAnnotationForClass(libElement, 'CtorNoParamsFromPartInPart');
          var annotation = annotatedClass.metadata.single;
          var matched =
              matchAnnotation(defs.PublicAnnotationClassInPart, annotation);
          expect(matched, isTrue);
  
negative.code:   return getLibraryElementForSourceFile(context, annotatedClassesFilePath);
  }
  
  dynamic _getInstantiatedAnnotation(LibraryElement lib, String className) =>
      instantiateAnnotation(_getClassAnnotation(lib, className));
  
  ElementAnnotation _getClassAnnotation(LibraryElement lib, String className) =>
      _getAnnotatedClass(lib, className).metadata.single;
  
  ClassElement _getAnnotatedClass(LibraryElement lib, String className) => lib
      .units.expand((cu) => cu.types).singleWhere((cd) => cd.name == className);
  
  /// Returns a mock [ElementAnnotationImpl] whose
  