use of org.sonar.java.checks.xml.maven.PomElementOrderCheck in project sonar-java by SonarSource.
the class XmlFileSensorTest method createSonarComponentsMock.
private static SonarComponents createSonarComponentsMock(DefaultFileSystem fs, @Nullable File file) throws IOException {
SonarComponents sonarComponents = mock(SonarComponents.class);
when(sonarComponents.checkClasses()).thenReturn(new JavaCheck[] { new PomElementOrderCheck() });
when(sonarComponents.getFileSystem()).thenReturn(fs);
if (file != null) {
when(sonarComponents.fileLines(any(File.class))).thenReturn(Files.readLines(file, StandardCharsets.UTF_8));
}
Checks<JavaCheck> checks = mock(Checks.class);
when(checks.ruleKey(any(JavaCheck.class))).thenReturn(RuleKey.of("squid", RuleAnnotationUtils.getRuleKey(PomElementOrderCheck.class)));
when(sonarComponents.checks()).thenReturn(Lists.<Checks<JavaCheck>>newArrayList(checks));
return sonarComponents;
}
Aggregations