use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class IssueLifecycleTest method doAutomaticTransition.
@Test
public void doAutomaticTransition() throws Exception {
DefaultIssue issue = new DefaultIssue();
underTest.doAutomaticTransition(issue);
verify(workflow).doAutomaticTransition(issue, issueChangeContext);
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class IssueLifecycleTest method initNewOpenIssue.
@Test
public void initNewOpenIssue() throws Exception {
DefaultIssue issue = new DefaultIssue();
when(debtCalculator.calculate(issue)).thenReturn(DEFAULT_DURATION);
underTest.initNewOpenIssue(issue);
assertThat(issue.key()).isNotNull();
assertThat(issue.creationDate()).isNotNull();
assertThat(issue.updateDate()).isNotNull();
assertThat(issue.status()).isEqualTo(STATUS_OPEN);
assertThat(issue.debt()).isEqualTo(DEFAULT_DURATION);
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class IssueLifecycleTest method mergeExistingOpenIssue_with_manual_severity.
@Test
public void mergeExistingOpenIssue_with_manual_severity() throws Exception {
DefaultIssue raw = new DefaultIssue().setNew(true).setKey("RAW_KEY");
DefaultIssue base = new DefaultIssue().setKey("BASE_KEY").setResolution(RESOLUTION_FIXED).setStatus(STATUS_CLOSED).setSeverity(BLOCKER).setManualSeverity(true);
underTest.mergeExistingOpenIssue(raw, base);
assertThat(raw.manualSeverity()).isTrue();
assertThat(raw.severity()).isEqualTo(BLOCKER);
verify(updater, never()).setPastSeverity(raw, BLOCKER, issueChangeContext);
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class MovedIssueVisitorTest method onIssue_does_not_alter_issue_if_component_is_not_a_file.
@Test
public void onIssue_does_not_alter_issue_if_component_is_not_a_file() {
DefaultIssue issue = mock(DefaultIssue.class);
underTest.onIssue(ReportComponent.builder(Component.Type.DIRECTORY, 1).build(), issue);
verifyZeroInteractions(issue);
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class CommonRuleEngineImplTest method process_files_with_known_language.
@Test
public void process_files_with_known_language() throws Exception {
ReportComponent file = ReportComponent.builder(Component.Type.FILE, 1).setKey("FILE_KEY").setUuid("FILE_UUID").setFileAttributes(new FileAttributes(false, "java", 1)).build();
DefaultIssue issue = new DefaultIssue();
when(rule1.processFile(file, "java")).thenReturn(issue);
when(rule2.processFile(file, "java")).thenReturn(null);
Collection<DefaultIssue> issues = underTest.process(file);
assertThat(issues).containsOnly(issue);
}
Aggregations