@Test public void multiIssueTypes() { IssueResponse issue = new IssueResponse(); issue.setEstimate("1"); IssueResponse issue2 = new IssueResponse(); issue2.setEstimate("2"); IssueTypeResponse response = new IssueTypeResponse(); response.setIssues(singletonList("/issues/1")); IssueTypeResponse response2 = new IssueTypeResponse(); response2.setIssues(singletonList("/issues/2")); JiraClient client = mock(JiraClient.class); when(client.getIssueType("bug")).thenReturn(response); when(client.getIssueType("story")).thenReturn(response2); when(client.getIssue(1)).thenReturn(issue); when(client.getIssue(2)).thenReturn(issue2); StoryPointCounter counter = new StoryPointCounter(client); Map<String, Integer> result = counter.getTotalsByIssueType(asList("bug", "story")); assertEquals("Bug estimate mismatch", 1, result.get("bug").intValue()); // Ambiguous unbox here assertEquals("Story estimate mismatch", 2, result.get("story").intValue()); }
@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 }