anchor.diff:    });
   
     test('class with final fields', () async {
  -    var element = await _getClassForCodeString('FinalFields');
  -    var generateResult = await _generator.generate(element, null);
  +    var generateResult = await _runForElementNamed('FinalFields');
       expect(generateResult, contains("Map<String, dynamic> toJson()"));
     });
   
     test('unannotated classes no-op', () async {
  -    var element = await _getClassForCodeString('NoAnnotation');
  -    var output = _generator.generate(element, null);
  +    var output = await _runForElementNamed('NoAnnotation');
   
       expect(output, isNull);
     });
   
     group('valid inputs', () {
       test('class with no fields', () async {
  -      var element = await _getClassForCodeString('Person');
  -      var output = await _generator.generate(element, null);
  +      var output = await _runForElementNamed('Person');
   
         expect(output, isNotNull);
   
  
positive.code:     });
  
      test('class with child json-able object', () async {
        var element = await _getClassForCodeString('ParentObject');
        var output = await _generator.generate(element, null);
  
        expect(output, contains('new ChildObject.fromJson'));
      });
  
      test('class with child list of json-able objects', () async {
        var element = await _getClassForCodeString('ParentObjectWithChildren');
        var output = await _generator.generate(element, null);
  
        expect(output, contains('.toList()'));
        expect(output, contains('new ChildObject.fromJson'));
      });
  
      test('class with child list of dynamic objects is left alone', () async {
        var element =
            await _getClassForCodeString('ParentObjectWithDynamicChildren');
        var output = await _generator.generate(element, null);
  
        expect(output, contains('children = json[\'children\'] as List;'));
      });
  
      test('class with list of int is cast for strong mode', () async {
        var element = await _getClassForCodeString('Person');
        var output = await _generator.generate(element, null);
  
        expect(output,
            contains("json['listOfInts'] as List)?.map((v0) => v0 as int)"));
  
negative.code: import 'dart:async';
  
  import 'package:analyzer/dart/ast/ast.dart';
  import 'package:analyzer/src/string_source.dart';
  import 'package:json_serializable/json_serializable.dart';
  import 'package:path/path.dart' as p;
  