Search in sources :

Example 1 with SetSeverityRequest

use of org.sonarqube.ws.client.issue.SetSeverityRequest in project sonarqube by SonarSource.

the class IssueActionTest method change_severity.

/**
   * SONAR-4352
   */
@Test
public void change_severity() {
    String componentKey = "sample";
    // there are no blocker issues
    assertThat(searchIssuesBySeverities(componentKey, "BLOCKER")).isEmpty();
    // increase the severity of an issue
    issuesService.setSeverity(new SetSeverityRequest(randomIssue.getKey(), "BLOCKER"));
    assertThat(searchIssuesBySeverities(componentKey, "BLOCKER")).hasSize(1);
    projectAnalysis.run();
    Issue reloaded = issueRule.getByKey(randomIssue.getKey());
    assertThat(reloaded.getSeverity()).isEqualTo(BLOCKER);
    assertThat(reloaded.getStatus()).isEqualTo("OPEN");
    assertThat(reloaded.hasResolution()).isFalse();
    assertThat(reloaded.getCreationDate()).isEqualTo(randomIssue.getCreationDate());
    assertThat(toDatetime(reloaded.getCreationDate())).isBefore(toDatetime(reloaded.getUpdateDate()));
}
Also used : Issue(org.sonarqube.ws.Issues.Issue) SetSeverityRequest(org.sonarqube.ws.client.issue.SetSeverityRequest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Issue (org.sonarqube.ws.Issues.Issue)1 SetSeverityRequest (org.sonarqube.ws.client.issue.SetSeverityRequest)1