Package org.sonar.api.issue

Examples of org.sonar.api.issue.Issue


        "]}");
  }

  @Test
  public void write_only_comment_action() throws Exception {
    Issue issue = new DefaultIssue()
      .setKey("ABCD")
      .setComponentKey("sample:src/main/xoo/sample/Sample.xoo")
      .setProjectKey("sample")
      .setRuleKey(RuleKey.of("squid", "AvoidCycle"))
      .setResolution("CLOSED");
View Full Code Here


        "]}");
  }

  @Test
  public void write_no_action_if_not_logged() throws Exception {
    Issue issue = new DefaultIssue()
      .setKey("ABCD")
      .setComponentKey("sample:src/main/xoo/sample/Sample.xoo")
      .setProjectKey("sample")
      .setRuleKey(RuleKey.of("squid", "AvoidCycle"));
View Full Code Here

      "{\"actions\": []}");
  }

  @Test
  public void write_actions_without_assign_to_me() throws Exception {
    Issue issue = new DefaultIssue()
      .setKey("ABCD")
      .setComponentKey("sample:src/main/xoo/sample/Sample.xoo")
      .setProjectKey("sample")
      .setRuleKey(RuleKey.of("squid", "AvoidCycle"))
      .setAssignee("john");
View Full Code Here

        "]}");
  }

  @Test
  public void write_transitions() throws Exception {
    Issue issue = new DefaultIssue()
      .setKey("ABCD")
      .setComponentKey("sample:src/main/xoo/sample/Sample.xoo")
      .setProjectKey("sample")
      .setRuleKey(RuleKey.of("squid", "AvoidCycle"));
View Full Code Here

        "      ]}");
  }

  @Test
  public void write_no_transitions() throws Exception {
    Issue issue = new DefaultIssue()
      .setKey("ABCD")
      .setComponentKey("sample:src/main/xoo/sample/Sample.xoo")
      .setProjectKey("sample")
      .setRuleKey(RuleKey.of("squid", "AvoidCycle"));
View Full Code Here

    // Check that Issue is in Index
    assertThat(indexClient.get(IssueIndex.class).countAll()).isEqualTo(1);

    // should find by key
    Issue issueDoc = indexClient.get(IssueIndex.class).getByKey(issue.getKey());

    // Check all normalized fields
    assertThat(issueDoc.actionPlanKey()).isEqualTo(issue.getActionPlanKey());
    assertThat(issueDoc.assignee()).isEqualTo(issue.getAssignee());
    assertThat(issueDoc.authorLogin()).isEqualTo(issue.getAuthorLogin());
    assertThat(issueDoc.closeDate()).isEqualTo(issue.getIssueCloseDate());
    assertThat(issueDoc.effortToFix()).isEqualTo(issue.getEffortToFix());
    assertThat(issueDoc.resolution()).isEqualTo(issue.getResolution());
    assertThat(issueDoc.ruleKey()).isEqualTo(RuleKey.of(issue.getRuleRepo(), issue.getRule()));
    assertThat(issueDoc.line()).isEqualTo(issue.getLine());
    assertThat(issueDoc.message()).isEqualTo(issue.getMessage());
    assertThat(issueDoc.reporter()).isEqualTo(issue.getReporter());
    assertThat(issueDoc.key()).isEqualTo(issue.getKey());
    assertThat(issueDoc.updateDate()).isEqualTo(issue.getIssueUpdateDate());
    assertThat(issueDoc.status()).isEqualTo(issue.getStatus());
    assertThat(issueDoc.severity()).isEqualTo(issue.getSeverity());
    assertThat(issueDoc.attributes()).isEqualTo(KeyValueFormat.parse(issue.getIssueAttributes()));
    assertThat(issueDoc.attribute("key")).isEqualTo("value");
  }
View Full Code Here

  Function.Context context = mock(Function.Context.class);
  SetEndOfLifeResolution function = new SetEndOfLifeResolution();

  @Test
  public void should_resolve_as_fixed() throws Exception {
    Issue issue = new DefaultIssue().setEndOfLife(true).setOnDisabledRule(false);
    when(context.issue()).thenReturn(issue);
    function.execute(context);
    verify(context, times(1)).setResolution(Issue.RESOLUTION_FIXED);
  }
View Full Code Here

    verify(context, times(1)).setResolution(Issue.RESOLUTION_FIXED);
  }

  @Test
  public void should_resolve_as_removed_when_rule_is_disabled() throws Exception {
    Issue issue = new DefaultIssue().setEndOfLife(true).setOnDisabledRule(true);
    when(context.issue()).thenReturn(issue);
    function.execute(context);
    verify(context, times(1)).setResolution(Issue.RESOLUTION_REMOVED);
  }
View Full Code Here

    verify(context, times(1)).setResolution(Issue.RESOLUTION_REMOVED);
  }

  @Test
  public void should_fail_if_issue_is_not_resolved() throws Exception {
    Issue issue = new DefaultIssue().setEndOfLife(false);
    when(context.issue()).thenReturn(issue);
    try {
      function.execute(context);
      fail();
    } catch (IllegalStateException e) {
View Full Code Here

      .ruleKey(RuleKey.of("foo", "bar"))
      .message("Foo")
      .atLine(3)
      .effortToFix(10.0));

    Issue issue = argumentCaptor.getValue();
    assertThat(issue.ruleKey()).isEqualTo(RuleKey.of("foo", "bar"));
    assertThat(issue.message()).isEqualTo("Foo");
    assertThat(issue.line()).isEqualTo(3);
    assertThat(issue.severity()).isNull();
    assertThat(issue.effortToFix()).isEqualTo(10.0);
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.issue.Issue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.