### Question:
FeaturePlugin implements Plugin { static FeatureGraph createFeatureGraph( JCTree.JCCompilationUnit compilationUnit, Context context) { FeatureGraph featureGraph = new FeatureGraph( compilationUnit.getSourceFile().getName(), compilationUnit.endPositions, compilationUnit.lineMap); AstScanner.addToGraph(compilationUnit, featureGraph); Tokens.addToGraph(compilationUnit.getSourceFile(), context, featureGraph); linkTokensToAstNodes(featureGraph); featureGraph.pruneAstNodes(); JavacProcessingEnvironment processingEnvironment = JavacProcessingEnvironment.instance(context); ImmutableMap<ClassTree, ImmutableMap<MethodTree, DataflowOutputs>> analysisResults = DataflowOutputs.create(compilationUnit, processingEnvironment); DataflowOutputsScanner.addToGraph(compilationUnit, analysisResults, featureGraph); TypeAnalysis typeAnalysis = new TypeAnalysis(compilationUnit, processingEnvironment); TypeScanner.addToGraph(compilationUnit, featureGraph, typeAnalysis); AssignabilityAnalysis.addToGraph(featureGraph, typeAnalysis); ComputedFromScanner.addToGraph(compilationUnit, featureGraph); LastLexicalUseScanner.addToGraph(compilationUnit, featureGraph); ReturnsToScanner.addToGraph(compilationUnit, featureGraph); FormalArgScanner.addToGraph(compilationUnit, featureGraph); GuardedByScanner.addToGraph(compilationUnit, featureGraph); SymbolScanner.addToGraph(compilationUnit, featureGraph); linkCommentsToAstNodes(featureGraph); checkSymbols(featureGraph); return featureGraph; }  @Override String getName(); @Override void init(JavacTask task, String... args);  }### Answer:
@Test public void createIsSuccessful_fromEmptyFile() { TestCompilation compilation = TestCompilation.compile("Test.java", ""); FeatureGraph featureGraph = FeaturePlugin.createFeatureGraph(compilation.compilationUnit(), compilation.context()); assertThat(featureGraph.astNodes()).isEmpty(); }
@Test public void createIsSuccessful_fromPackageInfo() { TestCompilation compilation = TestCompilation.compile("package-info.java", "package foo.bar;"); FeatureGraph featureGraph = FeaturePlugin.createFeatureGraph(compilation.compilationUnit(), compilation.context()); assertThat(featureGraph.astNodes()).isNotEmpty(); }
@Test public void createIsSuccessful_multiVariableDecl() { TestCompilation compilation = TestCompilation.compile( "Test.java", "public class Test {", " private static final String a = \"A\", b = \"B\";", "}"); FeatureGraph featureGraph = FeaturePlugin.createFeatureGraph(compilation.compilationUnit(), compilation.context()); assertThat(featureGraph.astNodes()).isNotEmpty(); }
@Test public void createIsSuccessful_implicitSuperConstructor() { TestCompilation compilation = TestCompilation.compile( "Test.java", "public class Test {", " Test() {}", "}"); FeatureGraph featureGraph = FeaturePlugin.createFeatureGraph(compilation.compilationUnit(), compilation.context()); assertThat(featureGraph.astNodes()).isNotEmpty(); }