use of org.sonar.api.issue.Issue.STATUS_CONFIRMED in project sonarqube by SonarSource.
the class IssueWorkflowTest method automatically_reopen_closed_issue_to_most_recent_previous_status_from_changelog.
@Test
@UseDataProvider("allStatusesLeadingToClosed")
public void automatically_reopen_closed_issue_to_most_recent_previous_status_from_changelog(String previousStatus) {
DefaultIssue[] issues = Arrays.stream(SUPPORTED_RESOLUTIONS_FOR_UNCLOSING).map(resolution -> {
DefaultIssue issue = newClosedIssue(resolution);
Date now = new Date();
addStatusChange(issue, addDays(now, -60), STATUS_OPEN, STATUS_CONFIRMED);
addStatusChange(issue, addDays(now, -10), STATUS_CONFIRMED, previousStatus);
setStatusPreviousToClosed(issue, previousStatus);
return issue;
}).toArray(DefaultIssue[]::new);
Date now = new Date();
underTest.start();
Arrays.stream(issues).forEach(issue -> {
underTest.doAutomaticTransition(issue, IssueChangeContext.createScan(now));
assertThat(issue.status()).isEqualTo(previousStatus);
assertThat(issue.updateDate()).isEqualTo(DateUtils.truncate(now, Calendar.SECOND));
assertThat(issue.closeDate()).isNull();
assertThat(issue.isChanged()).isTrue();
});
}
Aggregations