use of org.sonar.wsclient.issue.IssueClient in project sonar-java by SonarSource.
the class JavaTest method filtered_issues.
/**
* SONARJAVA-1615
*/
@Test
public void filtered_issues() throws Exception {
MavenBuild build = MavenBuild.create(TestUtils.projectPom("filtered-issues")).setCleanPackageSonarGoals().setProperty("sonar.profile", "filtered-issues");
orchestrator.executeBuild(build);
assertThat(getMeasureAsInteger("org.example:example", "violations")).isEqualTo(2);
IssueClient issueClient = orchestrator.getServer().wsClient().issueClient();
List<Issue> issues = issueClient.find(IssueQuery.create().components("org.example:example:src/main/java/EclispeI18NFiltered.java")).list();
assertThat(issues).hasSize(2);
for (Issue issue : issues) {
assertThat(issue.ruleKey()).matches(value -> "squid:S1444".equals(value) || "squid:ClassVariableVisibilityCheck".equals(value));
assertThat(issue.line()).isEqualTo(17);
}
}
use of org.sonar.wsclient.issue.IssueClient in project sonar-java by SonarSource.
the class SquidTest method should_detect_missing_package_info.
@Test
public void should_detect_missing_package_info() throws Exception {
IssueClient issueClient = orchestrator.getServer().wsClient().issueClient();
List<Issue> issues = issueClient.find(IssueQuery.create().components(JavaTestSuite.keyFor("com.sonarsource.it.samples:squid", "package1", ""))).list();
assertThat(issues).hasSize(1);
assertThat(issues.get(0).ruleKey()).isEqualTo("squid:S1228");
assertThat(issues.get(0).line()).isNull();
issues = issueClient.find(IssueQuery.create().components("com.sonarsource.it.samples:squid:src/test/java/package1")).list();
assertThat(issues).isEmpty();
}
use of org.sonar.wsclient.issue.IssueClient in project sonar-go by SonarSource.
the class GoIntegrationTest method issues.
@Test
public void issues() {
IssueClient issueClient = orchestrator.getServer().wsClient().issueClient();
assertThat(issueClient.find(IssueQuery.create().componentRoots("project").rules("go:S1656")).list()).hasSize(2);
assertThat(issueClient.find(IssueQuery.create().componentRoots("project").severities("BLOCKER")).list()).hasSize(1);
assertThat(issueClient.find(IssueQuery.create().componentRoots("project").severities("MAJOR")).list()).hasSize(4);
assertThat(issueClient.find(IssueQuery.create().componentRoots("project").severities("MINOR")).list()).hasSize(1);
}
Aggregations