use of org.sonar.api.batch.fs.internal.DefaultFileSystem in project sonar-java by SonarSource.
the class XmlAnalyzerTest method should_not_scan_file_with_parsing_issue.
@Test
public void should_not_scan_file_with_parsing_issue() {
DefaultFileSystem fs = new DefaultFileSystem(new File(""));
File xmlFile = new File(PARSE_ISSUE_POM);
fs.add(new TestInputFileBuilder("", xmlFile.getAbsolutePath()).setLanguage("xml").build());
SonarComponents sonarComponents = createSonarComponentsMock(fs, XML_CHECK, POM_CHECK);
XmlAnalyzer analyzer = new XmlAnalyzer(sonarComponents, XML_CHECK, POM_CHECK);
analyzer.scan(Lists.newArrayList(xmlFile));
verify(sonarComponents, never()).addIssue(any(File.class), any(JavaCheck.class), any(Integer.class), anyString(), isNull());
verify(sonarComponents, never()).reportIssue(any(AnalyzerMessage.class));
}
use of org.sonar.api.batch.fs.internal.DefaultFileSystem in project sonar-java by SonarSource.
the class XmlAnalyzerTest method should_not_scan_invalid_pom_file.
@Test
public void should_not_scan_invalid_pom_file() {
DefaultFileSystem fs = new DefaultFileSystem(new File(""));
File xmlFile = new File(INVALID_POM);
fs.add(new TestInputFileBuilder("", xmlFile.getAbsolutePath()).setLanguage("xml").build());
SonarComponents sonarComponents = createSonarComponentsMock(fs, POM_CHECK);
XmlAnalyzer analyzer = new XmlAnalyzer(sonarComponents, POM_CHECK);
analyzer.scan(Lists.newArrayList(xmlFile));
verify(sonarComponents, never()).addIssue(any(File.class), any(JavaCheck.class), any(Integer.class), anyString(), isNull());
verify(sonarComponents, never()).reportIssue(any(AnalyzerMessage.class));
}
use of org.sonar.api.batch.fs.internal.DefaultFileSystem in project sonar-java by SonarSource.
the class XmlAnalyzerTest method should_not_scan_when_no_xml_check_provided.
@Test
public void should_not_scan_when_no_xml_check_provided() {
DefaultFileSystem fs = new DefaultFileSystem(new File(""));
File pomFile = new File(VALID_POM);
fs.add(new TestInputFileBuilder("", pomFile.getAbsolutePath()).setLanguage("xml").build());
SonarComponents sonarComponents = createSonarComponentsMock(fs, JAVA_CHECK);
XmlAnalyzer analyzer = new XmlAnalyzer(sonarComponents, JAVA_CHECK);
analyzer.scan(Lists.newArrayList(pomFile));
verify(sonarComponents, never()).addIssue(any(File.class), any(JavaCheck.class), any(Integer.class), anyString(), isNull());
verify(sonarComponents, never()).reportIssue(any(AnalyzerMessage.class));
}
use of org.sonar.api.batch.fs.internal.DefaultFileSystem in project sonar-java by SonarSource.
the class XmlAnalyzerTest method should_scan_xml_file_provided.
@Test
public void should_scan_xml_file_provided() {
DefaultFileSystem fs = new DefaultFileSystem(new File(""));
File xmlFile = new File(VALID_POM);
fs.add(new TestInputFileBuilder("", xmlFile.getAbsolutePath()).build());
SonarComponents sonarComponents = createSonarComponentsMock(fs, XML_CHECK, POM_CHECK);
XmlAnalyzer analyzer = new XmlAnalyzer(sonarComponents, XML_CHECK, POM_CHECK);
analyzer.scan(Lists.newArrayList(xmlFile));
verify(sonarComponents, times(2)).addIssue(any(File.class), any(JavaCheck.class), any(Integer.class), anyString(), isNull());
verify(sonarComponents, never()).reportIssue(any(AnalyzerMessage.class));
}
use of org.sonar.api.batch.fs.internal.DefaultFileSystem in project sonar-java by SonarSource.
the class XmlAnalyzerTest method should_not_run_pom_check_when_no_pom_file_provided.
@Test
public void should_not_run_pom_check_when_no_pom_file_provided() {
DefaultFileSystem fs = new DefaultFileSystem(new File(""));
File xmlFile = new File("src/test/files/xml/parsing.xml");
fs.add(new TestInputFileBuilder("", xmlFile.getAbsolutePath()).setLanguage("xml").build());
SonarComponents sonarComponents = createSonarComponentsMock(fs, XML_CHECK, POM_CHECK);
XmlAnalyzer analyzer = new XmlAnalyzer(sonarComponents, XML_CHECK, POM_CHECK);
analyzer.scan(Lists.newArrayList(xmlFile));
verify(sonarComponents, never()).addIssue(any(File.class), eq(POM_CHECK), any(Integer.class), anyString(), isNull());
verify(sonarComponents, times(1)).addIssue(any(File.class), eq(XML_CHECK), any(Integer.class), anyString(), isNull());
verify(sonarComponents, never()).reportIssue(any(AnalyzerMessage.class));
}
Aggregations