GithubIssue extends BlueIssue { static Collection<String> findIssueKeys(String input) { Collection<String> ids = new ArrayList<>(); Matcher m = PATTERN.matcher(input); while (m.find()) { if (m.groupCount() >= 1) { String issue = m.group(1); ids.add(issue.substring(1, issue.length())); } } return ids; } GithubIssue(String id, String url); @Override String getId(); @Override String getURL();  }
@Test public void findIssueKeys() { Assert.assertEquals("Find single", Lists.newArrayList("123"), GithubIssue.findIssueKeys("Closed #123")); Assert.assertEquals("Find multiple", Lists.newArrayList("123", "143"), GithubIssue.findIssueKeys("Closed #123 and #143")); Assert.assertEquals("Do not find alpha", Lists.newArrayList(), GithubIssue.findIssueKeys("#AAA")); }