use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class IssueWorkflowTest method close_reopened_dead_issue.
@Test
public void close_reopened_dead_issue() {
workflow.start();
DefaultIssue issue = new DefaultIssue().setKey("ABCDE").setResolution(null).setStatus(STATUS_REOPENED).setNew(false).setBeingClosed(true);
Date now = new Date();
workflow.doAutomaticTransition(issue, IssueChangeContext.createScan(now));
assertThat(issue.resolution()).isEqualTo(RESOLUTION_FIXED);
assertThat(issue.status()).isEqualTo(STATUS_CLOSED);
assertThat(issue.closeDate()).isNotNull();
assertThat(issue.updateDate()).isEqualTo(DateUtils.truncate(now, Calendar.SECOND));
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class IssueWorkflowTest method list_out_transitions_from_status_resolved.
@Test
public void list_out_transitions_from_status_resolved() {
workflow.start();
DefaultIssue issue = new DefaultIssue().setStatus(STATUS_RESOLVED);
List<Transition> transitions = workflow.outTransitions(issue);
assertThat(keys(transitions)).containsOnly("reopen");
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class IssueWorkflowTest method close_open_dead_issue.
@Test
public void close_open_dead_issue() {
workflow.start();
DefaultIssue issue = new DefaultIssue().setKey("ABCDE").setResolution(null).setStatus(STATUS_OPEN).setNew(false).setBeingClosed(true);
Date now = new Date();
workflow.doAutomaticTransition(issue, IssueChangeContext.createScan(now));
assertThat(issue.resolution()).isEqualTo(RESOLUTION_FIXED);
assertThat(issue.status()).isEqualTo(STATUS_CLOSED);
assertThat(issue.closeDate()).isNotNull();
assertThat(issue.updateDate()).isEqualTo(DateUtils.truncate(now, Calendar.SECOND));
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class IssueWorkflowTest method list_no_out_transition_from_status_closed.
@Test
public void list_no_out_transition_from_status_closed() {
workflow.start();
DefaultIssue issue = new DefaultIssue().setStatus(STATUS_CLOSED).setRuleKey(RuleKey.of("java", "R1 "));
List<Transition> transitions = workflow.outTransitions(issue);
assertThat(transitions).isEmpty();
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class SetClosedTest method should_resolve_as_fixed.
@Test
public void should_resolve_as_fixed() {
Issue issue = new DefaultIssue().setBeingClosed(true).setOnDisabledRule(false);
when(context.issue()).thenReturn(issue);
INSTANCE.execute(context);
verify(context, times(1)).setResolution(Issue.RESOLUTION_FIXED);
}
Aggregations