Search in sources :

Example 1 with TrackedIssueAdapter

use of org.sonar.scanner.issue.TrackedIssueAdapter in project sonarqube by SonarSource.

the class TrackedIssueAdapterTest method improve_coverage.

@Test
public void improve_coverage() {
    Date creationDate = new Date();
    TrackedIssue trackedIssue = new TrackedIssue().setKey("XYZ123").setComponentKey("foo").setRuleKey(RuleKey.of("repo", "rule")).setSeverity("MAJOR").setMessage("msg").setStartLine(1).setGap(2.0).setStatus("RESOLVED").setResolution("FIXED").setAssignee("tata").setNew(true).setCreationDate(creationDate);
    Issue issue = new TrackedIssueAdapter(trackedIssue);
    assertThat(issue.key()).isEqualTo("XYZ123");
    assertThat(issue.componentKey()).isEqualTo("foo");
    assertThat(issue.ruleKey()).isEqualTo(RuleKey.of("repo", "rule"));
    assertThat(issue.severity()).isEqualTo("MAJOR");
    assertThat(issue.message()).isEqualTo("msg");
    assertThat(issue.line()).isEqualTo(1);
    assertThat(issue.gap()).isEqualTo(2.0);
    assertThat(issue.status()).isEqualTo("RESOLVED");
    assertThat(issue.resolution()).isEqualTo("FIXED");
    assertThat(issue.assignee()).isEqualTo("tata");
    assertThat(issue.isNew()).isTrue();
    assertThat(issue.attribute("foo")).isNull();
    assertThat(issue.creationDate()).isEqualTo(creationDate);
    assertThat(issue.language()).isNull();
    assertThat(issue.updateDate()).isNull();
    assertThat(issue.closeDate()).isNull();
    assertThat(issue.authorLogin()).isNull();
    assertThat(issue.comments()).isEmpty();
    assertThat(issue.effort()).isNull();
    assertThat(issue.projectKey()).isNull();
    assertThat(issue.projectUuid()).isNull();
    assertThat(issue.componentUuid()).isNull();
    assertThat(issue.tags()).isEmpty();
    assertThat(issue).isNotEqualTo(null);
    assertThat(issue).isNotEqualTo("Foo");
    assertThat(issue).isEqualTo(new TrackedIssueAdapter(trackedIssue));
    assertThat(issue.hashCode()).isEqualTo(trackedIssue.key().hashCode());
    assertThat(issue).isNotEqualTo(new TrackedIssueAdapter(new TrackedIssue().setKey("another")));
}
Also used : TrackedIssue(org.sonar.scanner.issue.tracking.TrackedIssue) Issue(org.sonar.api.issue.Issue) TrackedIssue(org.sonar.scanner.issue.tracking.TrackedIssue) Date(java.util.Date) TrackedIssueAdapter(org.sonar.scanner.issue.TrackedIssueAdapter) Test(org.junit.Test)

Aggregations

Date (java.util.Date)1 Test (org.junit.Test)1 Issue (org.sonar.api.issue.Issue)1 TrackedIssueAdapter (org.sonar.scanner.issue.TrackedIssueAdapter)1 TrackedIssue (org.sonar.scanner.issue.tracking.TrackedIssue)1