ApexAstScanner { public static AstScanner<Grammar> create(ApexConfiguration config, SquidAstVisitor<Grammar>... visitors) { final SourceProject sourceProject = new SourceProject(PROJECT_NAME); final SquidAstVisitorContextImpl<Grammar> context = new SquidAstVisitorContextImpl<>(sourceProject); final Parser<Grammar> parser = ApexParser.create(config); AstScanner.Builder<Grammar> builder = AstScanner.<Grammar>builder(context).setBaseParser(parser); builder.withMetrics(ApexMetric.values()); builder.setFilesMetric(ApexMetric.FILES); setCommentAnalyser(builder); setClassesAnalyser(builder); setMethodAnalyser(builder); setMetrics(config, builder); for (SquidAstVisitor<Grammar> visitor : visitors) { builder.withSquidAstVisitor(visitor); } return builder.build(); } private  ApexAstScanner(); static AstScanner<Grammar> create(ApexConfiguration config, SquidAstVisitor<Grammar>... visitors); static SourceFile scanFile(File file, SquidAstVisitor<Grammar>... visitors);  }
@Test public void testTheNumberOfScannedFiles() { AstScanner<Grammar> scanner = ApexAstScanner.create(apexConfiguration); scanner.scanFiles(ImmutableList.of( new File("src/test/resources/metrics/methods.cls"), new File("src/test/resources/metrics/lines.cls"))); SourceProject project = buildProject(scanner); assertThat(project.getInt(ApexMetric.FILES)).isEqualTo(2); }