コード例 #1
0
  @Test
  public void noIssues() {
    IssueTypeResponse response = new IssueTypeResponse();
    response.setIssues(emptyList());
    JiraClient client = mock(JiraClient.class);
    when(client.getIssueType("bug")).thenReturn(response);

    StoryPointCounter counter = new StoryPointCounter(client);
    Map<String, Integer> result = counter.getTotalsByIssueType(singletonList("bug"));

    assertThat("Input key not in output map", result, hasKey("bug"));
    assertEquals("Nonzero estimate", 0, result.get("bug").intValue()); // Ambiguous unbox here
  }
コード例 #2
0
  @Test
  public void oneIssue() {
    IssueResponse issue = new IssueResponse();
    issue.setEstimate("1");
    IssueTypeResponse response = new IssueTypeResponse();
    response.setIssues(singletonList("/issues/1"));
    JiraClient client = mock(JiraClient.class);
    when(client.getIssueType("bug")).thenReturn(response);
    when(client.getIssue(1)).thenReturn(issue);

    StoryPointCounter counter = new StoryPointCounter(client);
    Map<String, Integer> result = counter.getTotalsByIssueType(singletonList("bug"));

    assertEquals("Estimate mismatch", 1, result.get("bug").intValue()); // Ambiguous unbox here
  }