use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class CommentDensityRuleTest method no_issues_if_enough_comments.
@Test
public void no_issues_if_enough_comments() {
activeRuleHolder.put(new ActiveRule(RULE_KEY, Severity.CRITICAL, ImmutableMap.of(CommonRuleKeys.INSUFFICIENT_COMMENT_DENSITY_PROPERTY, "25"), 1_000L));
measureRepository.addRawMeasure(FILE.getReportAttributes().getRef(), CoreMetrics.COMMENT_LINES_DENSITY_KEY, Measure.newMeasureBuilder().create(90.0, 1));
DefaultIssue issue = underTest.processFile(FILE, "java");
assertThat(issue).isNull();
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class MovedIssueVisitorTest method onIssue_throws_ISE_if_issue_has_different_component_uuid_but_component_has_no_original_file.
@Test
public void onIssue_throws_ISE_if_issue_has_different_component_uuid_but_component_has_no_original_file() {
DefaultIssue issue = mockIssue("other component uuid");
when(issue.toString()).thenReturn("[bad issue, bad!]");
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage("Issue [bad issue, bad!] for component ReportComponent{ref=1, key='key_1', type=FILE} " + "has a different component key but no original file exist in MovedFilesRepository");
underTest.onIssue(FILE, issue);
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class MovedIssueVisitorTest method onIssue_does_not_alter_issue_if_component_file_but_issue_has_the_same_component_uuid.
@Test
public void onIssue_does_not_alter_issue_if_component_file_but_issue_has_the_same_component_uuid() {
DefaultIssue issue = mockIssue(FILE_UUID);
underTest.onIssue(FILE, issue);
verify(issue).componentUuid();
verifyNoMoreInteractions(issue);
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class NewEffortAggregatorTest method sum_new_securtiy_effort_of_issues.
@Test
public void sum_new_securtiy_effort_of_issues() {
periodsHolder.setPeriod(PERIOD);
DefaultIssue unresolved1 = newVulnerabilityIssue(10L);
DefaultIssue unresolved2 = newVulnerabilityIssue(30L);
DefaultIssue unresolvedWithoutDebt = newVulnerabilityIssueWithoutEffort();
DefaultIssue resolved = newVulnerabilityIssue(50L).setResolution(RESOLUTION_FIXED);
when(calculator.calculate(same(unresolved1), anyList(), same(PERIOD))).thenReturn(4L);
when(calculator.calculate(same(unresolved2), anyList(), same(PERIOD))).thenReturn(3L);
verifyNoMoreInteractions(calculator);
underTest.beforeComponent(FILE);
underTest.onIssue(FILE, unresolved1);
underTest.onIssue(FILE, unresolved2);
underTest.onIssue(FILE, unresolvedWithoutDebt);
underTest.onIssue(FILE, resolved);
underTest.afterComponent(FILE);
assertVariation(FILE, NEW_SECURITY_REMEDIATION_EFFORT_KEY, 3 + 4);
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class NewEffortAggregatorTest method sum_new_maintainability_effort_of_issues.
@Test
public void sum_new_maintainability_effort_of_issues() {
periodsHolder.setPeriod(PERIOD);
DefaultIssue unresolved1 = newCodeSmellIssue(10L);
DefaultIssue unresolved2 = newCodeSmellIssue(30L);
DefaultIssue unresolvedWithoutDebt = newCodeSmellIssueWithoutEffort();
DefaultIssue resolved = newCodeSmellIssue(50L).setResolution(RESOLUTION_FIXED);
when(calculator.calculate(same(unresolved1), anyList(), same(PERIOD))).thenReturn(4L);
when(calculator.calculate(same(unresolved2), anyList(), same(PERIOD))).thenReturn(3L);
verifyNoMoreInteractions(calculator);
underTest.beforeComponent(FILE);
underTest.onIssue(FILE, unresolved1);
underTest.onIssue(FILE, unresolved2);
underTest.onIssue(FILE, unresolvedWithoutDebt);
underTest.onIssue(FILE, resolved);
underTest.afterComponent(FILE);
assertVariation(FILE, NEW_TECHNICAL_DEBT_KEY, 3 + 4);
}
Aggregations