use of org.sonar.api.batch.sensor.issue.internal.DefaultExternalIssue in project sonarqube by SonarSource.
the class IssuePublisherTest method add_external_issue_to_cache.
@Test
public void add_external_issue_to_cache() {
ruleBuilder.add(SQUID_RULE_KEY).setName(SQUID_RULE_NAME);
initModuleIssues();
DefaultExternalIssue issue = new DefaultExternalIssue(project).at(new DefaultIssueLocation().on(file).at(file.selectLine(3)).message("Foo")).type(RuleType.BUG).forRule(SQUID_RULE_KEY).severity(org.sonar.api.batch.rule.Severity.CRITICAL);
moduleIssues.initAndAddExternalIssue(issue);
ArgumentCaptor<ScannerReport.ExternalIssue> argument = ArgumentCaptor.forClass(ScannerReport.ExternalIssue.class);
verify(reportPublisher.getWriter()).appendComponentExternalIssue(eq(file.scannerId()), argument.capture());
assertThat(argument.getValue().getSeverity()).isEqualTo(org.sonar.scanner.protocol.Constants.Severity.CRITICAL);
}
use of org.sonar.api.batch.sensor.issue.internal.DefaultExternalIssue in project sonarqube by SonarSource.
the class DefaultSensorStorageTest method should_save_external_issue.
@Test
public void should_save_external_issue() {
InputFile file = new TestInputFileBuilder("foo", "src/Foo.php").build();
DefaultExternalIssue externalIssue = new DefaultExternalIssue(project).at(new DefaultIssueLocation().on(file));
underTest.store(externalIssue);
ArgumentCaptor<ExternalIssue> argumentCaptor = ArgumentCaptor.forClass(ExternalIssue.class);
verify(moduleIssues).initAndAddExternalIssue(argumentCaptor.capture());
assertThat(argumentCaptor.getValue()).isEqualTo(externalIssue);
}
Aggregations