BlueJiraIssue extends BlueIssue { static Collection<String> findIssueKeys(String input, Pattern pattern) { Matcher m = pattern.matcher(input); Set<String> issues = new HashSet(); while (m.find()) { if (m.groupCount() >= 1) { String id = m.group(1); issues.add(id); } } return issues; } BlueJiraIssue(String issueKey, String issueURL); @Override String getId(); @Override String getURL(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void findIssueKeys() throws MalformedURLException { Pattern issuePattern = JiraSite.DEFAULT_ISSUE_PATTERN; Assert.assertEquals(Sets.newHashSet("JENKINS-43400"), BlueJiraIssue.findIssueKeys("[JENKINS-43400] Print the error to the build log rather than", issuePattern)); Assert.assertEquals(Sets.newHashSet("JENKINS-43400"), BlueJiraIssue.findIssueKeys("JENKINS-43400 Print the error to the build log rather than", issuePattern)); Assert.assertEquals(Sets.newHashSet("JENKINS-43400"), BlueJiraIssue.findIssueKeys("foo/JENKINS-43400 Print the error to the build log rather than", issuePattern)); Assert.assertEquals(Sets.newHashSet("TEST-123", "EXAMPLE-123", "JENKINS-43400"), BlueJiraIssue.findIssueKeys("foo/JENKINS-43400 TEST-123 [EXAMPLE-123] Print the error to the build log rather than", issuePattern)); }