Package org.sonar.api.issue.internal

Examples of org.sonar.api.issue.internal.DefaultIssue.key()


    when(debtModel.characteristicById(1)).thenReturn(new DefaultDebtCharacteristic().setKey("K1").setId(1).setName("Maintainability"));
    when(debtModel.characteristicById(2)).thenReturn(new DefaultDebtCharacteristic().setKey("K2").setId(2).setName("Readability").setParentId(1));
    when(debtModel.characteristicByKey("K2")).thenReturn(new DefaultDebtCharacteristic().setKey("K2").setId(2).setName("Readability").setParentId(1));

    MockUserSession.set();
    WsTester.TestRequest request = tester.newGetRequest("api/issues", "show").setParam("key", issue.key());
    request.execute().assertJson(getClass(), "show_issue_with_characteristics.json");
  }

  @Test
  public void show_issue_with_default_characteristics() throws Exception {
View Full Code Here


  }

  @Test
  public void show_issue_with_default_characteristics() throws Exception {
    DefaultIssue issue = createStandardIssue().setDebt(Duration.create(7260L));
    when(issueService.getByKey(issue.key())).thenReturn(issue);

    when(rule.debtCharacteristicKey()).thenReturn("K2");
    when(debtModel.characteristicById(1)).thenReturn(new DefaultDebtCharacteristic().setKey("K1").setId(1).setName("Maintainability"));
    when(debtModel.characteristicById(2)).thenReturn(new DefaultDebtCharacteristic().setKey("K2").setId(2).setName("Readability").setParentId(1));
    when(debtModel.characteristicByKey("K2")).thenReturn(new DefaultDebtCharacteristic().setKey("K2").setId(2).setName("Readability").setParentId(1));
View Full Code Here

    when(debtModel.characteristicById(1)).thenReturn(new DefaultDebtCharacteristic().setKey("K1").setId(1).setName("Maintainability"));
    when(debtModel.characteristicById(2)).thenReturn(new DefaultDebtCharacteristic().setKey("K2").setId(2).setName("Readability").setParentId(1));
    when(debtModel.characteristicByKey("K2")).thenReturn(new DefaultDebtCharacteristic().setKey("K2").setId(2).setName("Readability").setParentId(1));

    MockUserSession.set();
    WsTester.TestRequest request = tester.newGetRequest("api/issues", "show").setParam("key", issue.key());
    System.out.println("request.execute().outputAsString() = " + request.execute().outputAsString());
    request.execute().assertJson(getClass(), "show_issue_with_characteristics.json");
  }

  @Test
View Full Code Here

    DefaultIssue issue = createStandardIssue()
      .setCreationDate(creationDate)
      .setUpdateDate(updateDate)
      .setCloseDate(closedDate);
    when(issueService.getByKey(issue.key())).thenReturn(issue);

    when(i18n.formatDateTime(any(Locale.class), eq(creationDate))).thenReturn("Jan 22, 2014 10:03 AM");
    when(i18n.formatDateTime(any(Locale.class), eq(updateDate))).thenReturn("Jan 23, 2014 10:03 AM");
    when(i18n.ageFromNow(any(Locale.class), eq(updateDate))).thenReturn("9 days");
    when(i18n.formatDateTime(any(Locale.class), eq(closedDate))).thenReturn("Jan 24, 2014 10:03 AM");
View Full Code Here

    when(i18n.formatDateTime(any(Locale.class), eq(updateDate))).thenReturn("Jan 23, 2014 10:03 AM");
    when(i18n.ageFromNow(any(Locale.class), eq(updateDate))).thenReturn("9 days");
    when(i18n.formatDateTime(any(Locale.class), eq(closedDate))).thenReturn("Jan 24, 2014 10:03 AM");

    MockUserSession.set();
    WsTester.TestRequest request = tester.newGetRequest("api/issues", "show").setParam("key", issue.key());
    request.execute().assertJson(getClass(), "show_issue_with_dates.json");
  }

  @Test
  public void show_issue_with_comments() throws Exception {
View Full Code Here

  public void show_issue_with_comments() throws Exception {
    Date date1 = DateUtils.parseDateTime("2014-02-22T19:10:03+0100");
    Date date2 = DateUtils.parseDateTime("2014-02-23T19:10:03+0100");

    DefaultIssue issue = createStandardIssue();
    when(issueService.getByKey(issue.key())).thenReturn(issue);

    when(commentService.findComments(issue.key())).thenReturn(newArrayList(
      new DefaultIssueComment()
        .setKey("COMMENT-ABCD")
        .setMarkdownText("*My comment*")
 
View Full Code Here

    Date date2 = DateUtils.parseDateTime("2014-02-23T19:10:03+0100");

    DefaultIssue issue = createStandardIssue();
    when(issueService.getByKey(issue.key())).thenReturn(issue);

    when(commentService.findComments(issue.key())).thenReturn(newArrayList(
      new DefaultIssueComment()
        .setKey("COMMENT-ABCD")
        .setMarkdownText("*My comment*")
        .setUserLogin("john")
        .setCreatedAt(date1),
View Full Code Here

    when(i18n.ageFromNow(any(Locale.class), eq(date1))).thenReturn("9 days");
    when(i18n.ageFromNow(any(Locale.class), eq(date2))).thenReturn("10 days");

    MockUserSession.set().setLogin("arthur");
    WsTester.TestRequest request = tester.newGetRequest("api/issues", "show").setParam("key", issue.key());
    request.execute().assertJson(getClass(), "show_issue_with_comments.json");
  }

  @Test
  public void show_issue_with_transitions() throws Exception {
View Full Code Here

  @Test
  public void show_issue_with_transitions() throws Exception {
    DefaultIssue issue = createStandardIssue()
      .setStatus("RESOLVED")
      .setResolution("FIXED");
    when(issueService.getByKey(issue.key())).thenReturn(issue);

    when(issueService.listTransitions(eq(issue))).thenReturn(newArrayList(Transition.create("reopen", "RESOLVED", "REOPEN")));

    MockUserSession.set().setLogin("john");
    WsTester.TestRequest request = tester.newGetRequest("api/issues", "show").setParam("key", issue.key());
View Full Code Here

    when(issueService.getByKey(issue.key())).thenReturn(issue);

    when(issueService.listTransitions(eq(issue))).thenReturn(newArrayList(Transition.create("reopen", "RESOLVED", "REOPEN")));

    MockUserSession.set().setLogin("john");
    WsTester.TestRequest request = tester.newGetRequest("api/issues", "show").setParam("key", issue.key());
    request.execute().assertJson(getClass(), "show_issue_with_transitions.json");
  }

  @Test
  public void show_issue_with_actions() throws Exception {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.