anchor.diff:      await assertNoFix();
     }
   
  +  test_lib() async {
  +    addPackageFile('my_pkg', 'a.dart', 'class Test {}');
  +    newFile('/home/test/pubspec.yaml', content: r'''
  +dependencies:
  +  my_pkg: any
  +''');
  +
  +    await resolveTestUnit('''
  +main() {
  +  Test test = null;
  +  print(test);
  +}
  +''');
  +
  +    await assertHasFix('''
  +import 'package:my_pkg/a.dart';
  +
  +main() {
  +  Test test = null;
  +  print(test);
  +}
  +''', expectedNumberOfFixesForKind: 1);
  +  }
  +
  +  test_lib_src() async {
  +    addPackageFile('my_pkg', 'src/a.dart', 'class Test {}');
  +    newFile('/home/test/pubspec.yaml', content: r'''
  +dependencies:
  +  my_pkg: any
  +''');
  +    await resolveTestUnit('''
  +main() {
  +  Test test = null;
  +  print(test);
  +}
  +''');
  +    await assertNoFix();
  +  }
  +
     test_notInLib() async {
       addSource('/home/other/test/lib.dart', 'class Test {}');
       await resolveTestUnit('''
  
positive.code:     await assertNoFix();
    }
  
    test_preferDirectOverExport() async {
      addPackageFile('my_pkg', 'a.dart', "export 'b.dart';");
      addPackageFile('my_pkg', 'b.dart', 'class Test {}');
      newFile('/home/test/pubspec.yaml', content: r'''
  dependencies:
    my_pkg: any
  ''');
  
      await resolveTestUnit('''
  main() {
    Test test = null;
    print(test);
  }
  ''');
  
      await assertHasFix('''
  import 'package:my_pkg/b.dart';
  
  main() {
    Test test = null;
    print(test);
  }
  ''', expectedNumberOfFixesForKind: 1);
    }
  
    test_preferDirectOverExport_src() async {
      addPackageFile('my_pkg', 'a.dart', "export 'b.dart';");
      addPackageFile('my_pkg', 'b.dart', 'class Test {}');
      newFile('/home/test/pubspec.yaml', content: r'''
  dependencies:
    my_pkg: any
  ''');
      await resolveTestUnit('''
  main() {
    Test test = null;
    print(test);
  }
  ''');
      await assertHasFix('''
  import 'package:my_pkg/b.dart';
  
  main() {
    Test test = null;
    print(test);
  }
  ''', expectedNumberOfFixesForKind: 1);
    }
  
    test_relativeDirective() async {
      addSource('/home/test/lib/a.dart', '''
  import "b.dart";
  ''');
      addSource('/home/test/lib/b.dart', '''
  class Foo {}
  ''');
      await resolveTestUnit('''
  main() { new Foo(); }
  ''');
      await assertHasFix('''
  import 'b.dart';
  
  main() { new Foo(); }
  ''',
          expectedNumberOfFixesForKind: 2,
          matchFixMessage: "Import library 'b.dart'");
    }
  
    test_relativeDirective_downOneDirectory() async {
      addSource('/home/test/lib/dir/a.dart', '''
  import "b.dart";
  ''');
      addSource('/home/test/lib/dir/b.dart', '''
  class Foo {}
  ''');
      await resolveTestUnit('''
  main() { new Foo(); }
  ''');
      await assertHasFix('''
  import 'dir/b.dart';
  
  main() { new Foo(); }
  ''',
          expectedNumberOfFixesForKind: 2,
          matchFixMessage: "Import library 'dir/b.dart'");
    }
  
    test_relativeDirective_upOneDirectory() async {
      addSource('/home/test/lib/a.dart', '''
  import "b.dart";
  ''');
      addSource('/home/test/lib/b.dart', '''
  class Foo {}
  ''');
      testFile = convertPath('/home/test/lib/dir/test.dart');
      await resolveTestUnit('''
  main() { new Foo(); }
  ''');
      await assertHasFix('''
  import '../b.dart';
  
  main() { new Foo(); }
  ''',
          expectedNumberOfFixesForKind: 2,
          matchFixMessage: "Import library '../b.dart'");
    }
  
    test_withClass_annotation() async {
      addSource('/home/test/lib/lib.dart', '''
  library lib;
  class Test {
    const Test(int p);
  }
  ''');
      await resolveTestUnit('''
  @Test(0)
  main() {
  }
  ''');
      await assertHasFix('''
  import 'package:test/lib.dart';
  
  @Test(0)
  main() {
  }
  ''');
    }
  
    test_withClass_hasOtherLibraryWithPrefix() async {
      addSource('/home/test/lib/a.dart', '''
  library a;
  class One {}
  ''');
      addSource('/home/test/lib/b.dart', '''
  library b;
  class One {}
  class Two {}
  ''');
      await resolveTestUnit('''
  import 'package:test/b.dart' show Two;
  main () {
    new Two();
    new One();
  }
  ''');
      await assertHasFix('''
  import 'package:test/a.dart';
  import 'package:test/b.dart' show Two;
  main () {
    new Two();
    new One();
  }
  ''');
    }
  
    test_withClass_inParentFolder() async {
      testFile = convertPath('/home/test/bin/aaa/test.dart');
      addSource('/home/test/bin/lib.dart', '''
  library lib;
  class Test {}
  ''');
      await resolveTestUnit('''
  main() {
    Test t = null;
    print(t);
  }
  ''');
      await assertHasFix('''
  import '../lib.dart';
  
  main() {
    Test t = null;
    print(t);
  }
  ''');
    }
  
    test_withClass_inRelativeFolder() async {
      testFile = convertPath('/home/test/bin/test.dart');
      addSource('/home/test/tool/sub/folder/lib.dart', '''
  library lib;
  class Test {}
  ''');
      await resolveTestUnit('''
  main() {
    Test t = null;
    print(t);
  }
  ''');
      await assertHasFix('''
  import '../tool/sub/folder/lib.dart';
  
  main() {
    Test t = null;
    print(t);
  }
  ''');
    }
  
    test_withClass_inSameFolder() async {
      testFile = convertPath('/home/test/bin/test.dart');
      addSource('/home/test/bin/lib.dart', '''
  library lib;
  class Test {}
  ''');
      await resolveTestUnit('''
  main() {
    Test t = null;
    print(t);
  }
  ''');
      await assertHasFix('''
  import 'lib.dart';
  
  main() {
    Test t = null;
    print(t);
  }
  ''');
    }
  
    test_withClass_instanceCreation_const() async {
      addSource('/home/test/lib/lib.dart', '''
  class Test {
    const Test();
  }
  ''');
      await resolveTestUnit('''
  main() {
    return const Test();
  }
  ''');
      await assertHasFix('''
  import 'package:test/lib.dart';
  
  main() {
    return const Test();
  }
  ''');
    }
  
    test_withClass_instanceCreation_const_namedConstructor() async {
      addSource('/home/test/lib/lib.dart', '''
  class Test {
    const Test.named();
  }
  ''');
      await resolveTestUnit('''
  main() {
    const Test.named();
  }
  ''');
      await assertHasFix('''
  import 'package:test/lib.dart';
  
  main() {
    const Test.named();
  }
  ''');
    }
  
    test_withClass_instanceCreation_implicit() async {
      addSource('/home/test/lib/lib.dart', '''
  class Test {
    const Test();
  }
  ''');
      await resolveTestUnit('''
  main() {
    return Test();
  }
  ''');
      await assertHasFix('''
  import 'package:test/lib.dart';
  
  main() {
    return Test();
  }
  ''');
    }
  
    test_withClass_instanceCreation_new() async {
      addSource('/home/test/lib/lib.dart', '''
  class Test {
    const Test();
  }
  ''');
      await resolveTestUnit('''
  main() {
    return new Test();
  }
  ''');
      await assertHasFix('''
  import 'package:test/lib.dart';
  
  main() {
    return new Test();
  }
  ''');
    }
  
    test_withClass_instanceCreation_new_namedConstructor() async {
      addSource('/home/test/lib/lib.dart', '''
  class Test {
    Test.named();
  }
  ''');
      await resolveTestUnit('''
  main() {
    new Test.named();
  }
  ''');
      await assertHasFix('''
  import 'package:test/lib.dart';
  
  main() {
    new Test.named();
  }
  ''');
    }
  
    test_withFunction() async {
      addSource('/home/test/lib/lib.dart', '''
  library lib;
  myFunction() {}
  ''');
      await resolveTestUnit('''
  main() {
    myFunction();
  }
  ''');
      await assertHasFix('''
  import 'package:test/lib.dart';
  
  main() {
    myFunction();
  }
  ''');
    }
  
    test_withFunction_functionTopLevelVariable() async {
      addSource('/home/test/lib/lib.dart', 'var myFunction = () {};');
      await resolveTestUnit('''
  main() {
    myFunction();
  }
  ''');
      await assertHasFix('''
  import 'package:test/lib.dart';
  
  main() {
    myFunction();
  }
  ''');
    }
  
    @failingTest
    test_withFunction_nonFunctionType() async {
      addSource('/home/test/lib/lib.dart', 'int zero = 0;');
      await resolveTestUnit('''
  main() {
    zero();
  }
  ''');
      await assertNoFix();
    }
  
    test_withFunction_unresolvedMethod() async {
      addSource('/home/test/lib/lib.dart', '''
  library lib;
  myFunction() {}
  ''');
      await resolveTestUnit('''
  class A {
    main() {
      myFunction();
    }
  }
  ''');
      await assertHasFix('''
  import 'package:test/lib.dart';
  
  class A {
    main() {
      myFunction();
    }
  }
  ''');
    }
  
    test_withFunctionTypeAlias() async {
      addSource('/home/test/lib/lib.dart', '''
  library lib;
  typedef MyFunction();
  ''');
      await resolveTestUnit('''
  main() {
    MyFunction t = null;
    print(t);
  }
  ''');
      await assertHasFix('''
  import 'package:test/lib.dart';
  
  main() {
    MyFunction t = null;
    print(t);
  }
  ''');
    }
  
    test_withMixin() async {
      addSource('/home/test/lib/lib.dart', '''
  mixin Test {}
  ''');
      await resolveTestUnit('''
  class X = Object with Test;
  ''');
      await assertHasFix('''
  import 'package:test/lib.dart';
  
  class X = Object with Test;
  ''', errorFilter: (error) {
        return error.errorCode == StaticWarningCode.UNDEFINED_CLASS;
      });
    }
  
    test_withTopLevelVariable() async {
      addSource('/home/test/lib/lib.dart', '''
  library lib;
  int MY_VAR = 42;
  ''');
      await resolveTestUnit('''
  main() {
    print(MY_VAR);
  }
  ''');
      await assertHasFix('''
  import 'package:test/lib.dart';
  
  main() {
    print(MY_VAR);
  }
  ''');
    }
  }
  
  @reflectiveTest
  class ImportLibraryProject2Test extends FixProcessorTest {
    @override
    FixKind get kind => DartFixKind.IMPORT_LIBRARY_PROJECT2;
  
    test_preferDirectOverExport() async {
      addPackageFile('my_pkg', 'a.dart', "export 'b.dart';");
      addPackageFile('my_pkg', 'b.dart', 'class Test {}');
      newFile('/home/test/pubspec.yaml', content: r'''
  dependencies:
    my_pkg: any
  ''');
      await resolveTestUnit('''
  main() {
    Test test = null;
  
negative.code: ''');
    }
  
    test_lib_src() async {
      addPackageFile('my_pkg', 'a.dart', "export 'src/b.dart';");
      addPackageFile('my_pkg', 'src/b.dart', 'class Test {}');
      newFile('/home/test/pubspec.yaml', content: r'''
  dependencies:
    my_pkg: any
  